Write a function to create a movie where one item is moving in a diagonal line from top left to bottom right and another item is moving from the right to the left.

What will be an ideal response?


```
def movingRectangle5(directory):
for num in range (1 ,30): #29 frames
canvas = makeEmptyPicture (300 ,250)
#add a filled rect moving linearly
addRectFilled(canvas,num*8,num*7,50,50,red)
addRectFilled(canvas,250-num*8 ,200-num*7,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...

What is the most common use for Bluetooth?

A) printers and plotters B) keyboards and trackballs C) hands-free headsets for cell phones D) optical mouse

Computer Science & Information Technology

Explain whether or not a LastName field would be a good candidate for a lookup field.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is not a C type?

A. Boolean B. Character C. Number D. Real E. Imaginary

Computer Science & Information Technology

?Match each correct item with the statement below.?

A. ?A variable that is altered by loop constructs to ensure that commands are not executed indefinitely. B. ?A special construct used in a shell script to alter the flow of the program based on the outcome of a command or contents of a variable. Common decision constructs include if, case, &&, and ||. C. ?The variables that store information commonly accessed by the system or programs executing on the system; together, these variables form the user environment. D. ?The numeric labels used to define command input and command output. E. ?The first line in a shell script, which defines the shell that will be used to interpret the commands in the script file. F. ?A special construct used in a shell script to execute commands repetitively. Common decision constructs include for and while. G. ?The process of changing the default locations of Standard Input, Standard Output, and Standard Error. H. ?A file descriptor that represents any error messages generated by a command. I. ?A file descriptor that represents information input to a command during execution. J. ?A file descriptor that represents the desired output from a command.

Computer Science & Information Technology