Create a new movie that has two rectangles moving a random amount (from ?5 to 5) in each direction in each frame.
What will be an ideal response?
```
import random
def movingRectangle6(directory):
rect1X = 100
rect1Y = 125
rect2X = 150
rect2Y = 125
for num in range (1 ,30): #29 frames
canvas = makeEmptyPicture (300 ,250)
rect1X+= -5+random.random()*10
rect1Y+= -5+random.random()*10
rect2X+= -5+random.random()*10
rect2Y+= -5+random.random()*10
#add a filled rect moving linearly
addRectFilled(canvas,rect1X,rect1Y,50,50,red)
addRectFilled(canvas,rect2X,rect2Y,50,50,blue)
# 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")
if num >= 10:
writePictureTo ( canvas , directory +"//frame"+ numStr +".jpg")
movie = makeMovieFromInitialFile(directory+"//frame00.jpg");
return movie
```
You might also like to view...
In a classic Webmail configuration _____.
A. Outbox is stored on the Web B. Outbox resides on your computer C. Outbox is not needed D. Outbox and Inbox are combined
Running the Disk Defragmenter utility will ________.
A. detect and remove spyware B. mark bad memory cells C. make the hard drive work more efficiently D. clean out your Startup folder
The ___________ Act places restrictions on online organizations in the collection of data from children under the age of 13.
Fill in the blank(s) with the appropriate word(s).
When you create a new external CSSĀ file, where will it appear as a related files document?
A. External Files window B. Document window C. Root folder D. Styles window