Only the first example in this chapter uses the movie object. Rewrite any of the other example programs to create a movie object and return the movie object.

Note: For most examples this only involves adding the final two lines from program 170 onto the end of the example.


```
def movingRectangle2(directory):
for num in range (1 ,30): #29 frames
canvas = makeEmptyPicture (300 ,250)
#add a filled rect moving linearly
addRectFilled(canvas ,num*10,num*5,50,50,red)
# Let’s have one just moving around
blueX = 100+ int(10 * sin(num))
blueY = 4*num+int(10* cos(num))
addRectFilled(canvas ,blueX ,blueY ,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
```

Computer Science & Information Technology

You might also like to view...

These devices are typically associated with WANs.

What will be an ideal response?

Computer Science & Information Technology

A task’s effective priority is calculated when ________.

a) a task sleeps b) a task sleeps or consumes its time slice c) a task consumes its time slice or is awakened by another thread d) a task sleeps, consumes its time slice or is awakened by another thread.

Computer Science & Information Technology

Often presentations are enhanced when individuals collaborate to fine-tune text, visuals, and design elements on the slides.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The semicolon at the end of the statement for (count = 0; count < 10; count++); is called a(n) ____________________ statement.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology