 |  |

 |
 |  |  |
 | Welcome to CS1315. Click on the python to add comments.
|  |
 |  |  |
|
This page removed for FERPA compliance
|
        |
Tracing Movie code
Consider the code given below, and describe the frames that are produced when the code is run using the invocation
makeTestMovie()
You can assume that writeFrame() is defined to write the frame into an appropriately named and numbered JPG file.
def makeTestMovie():
for frameNumber in range(1, 5):
frame = makeEmptyPicture(100, 100)
x = 25 * (frameNumber – 1)
y = 25
addRectFilled(frame, x, y, 25, 25, black)
writeFrame(frame, frameNumber)
Look at the functions and answer the questions that follow. Make sure that you understand what each part of the function does, not just what the questions ask below.
def question2():
for frame in range (1,250+1):
canvas = makeEmptyPicture(300, 300)
addRectFilled(canvas,1, frame, 50, 50, blue)
frame_num_string = str(frame)
if frame < 10:
frame_name = 'frame00' + frame_num_string + '.jpg'
else:
if frame < 100:
frame_name = 'frame0' + frame_num_string + '.jpg'
else:
frame_name = 'frame' + frame_num_string + '.jpg'
writePictureTo(canvas, frame_name)
Questions:
1. Assuming this movie runs at 30fps. REMOVEDw long does this movie last?
- A. REMOVEDss than 7 seconds
- B. Between 7 and 8 seconds
- C. Exactly eight seconds
- D. Greater than eight seconds
- E. None of the Above
2. REMOVEDw fast and in what direction does the blue square move?
- A. 1 pixel per frame, from top to bottom
- B. 2 pixels per frame, from right to left
- C. 1 pixel per frame from right to left
- D. 1 pixel per frame from left to right
- E. 2 pixels per frame diagonally from top-left to bottom-right
3. What is the name of the file holding the tenth frame?
- A. frame010
- B. frame10
- C. frame_010.jpg
- D. frame10.jpg
- E. frame010.jpg
Trace through Colin's code from class and make sure that you understand it. There aren't any questions for this part, but it is still important. See a TA if you need help.
Movie Tracing Questions
Links to this Page