Write a function that draws a sun on the picture of a beach at different places on the picture in successive frames. The goal is to make it look like the sun is moving across the sky through the day.
Note: The sun tends to move in an arc across the sky from left to top center to right, depending on one’s perspective in the world. Therefore, making use of sin and cos for arcing movement makes the most sense.
```
def makeSunCrossSky(directory):
for num in range (1 ,30): #29 frames
canvas = makePicture(getMediaPath("beach.jpg"))
# Let's have the sun moving on an arc
sunX = 100+ num*4
sunY = 100+int(-20* cos(num/8.0))
addOvalFilled(canvas ,sunX ,sunY ,50,50,yellow)
# Now , write out the frame
# Have to deal with single digit vs. double digit
numStr=str(num)
if num < 10:
writePictureTo ( canvas , directory +"//frame0"+ numStr +".jpg")
elif num >= 10:
writePictureTo ( canvas , directory +"//frame"+ numStr +".jpg")
movie = makeMovieFromInitialFile(directory+"//frame00.jpg");
return movie
```
You might also like to view...
Which of the following is one of the dimensions of the McCumber Cube?
A) Safeguards B) Goals C) Information states D) All of the above
A type of query that retrieves data from one or more tables and makes it available for use in the format of a datasheet is a ________ query
Fill in the blank(s) with correct word
When the Clipboard pane is closed, the clipboard can accumulate the content from multiple copies
Indicate whether the statement is true or false
Word has a feature that allows you to link two or more text boxes
Indicate whether the statement is true or false