Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

sunset timelapsed movie code

def sunset(picture):
  for frameNumber in range(1, 50):
    for pixel in getPixels(picture):
      # Make the pixel less blue and green rather than more red
      setBlue(pixel, getBlue(pixel) * 0.99)
      setGreen(pixel, getGreen(pixel) * 0.99)
      writePictureTo(picture, fileName(frameNumber))
# "Deliberate" error was to unindent previous line -- which would only write a single frame instead of all of them. Can you see why?

# Return a distinct file name for a frame with this number
def fileName(n):
  if n >= 10:
    stem = "sunset"
  else:
    stem = "sunset0"
  number = str(n)
  extension = ".jpg"
  name = stem + number + extension
  return getMediaPath(name)



Link to this Page