base_image = pygame.image.load("res/sunflowers1.jpg") # Zoom in on a position within a larger image slowly # Zoom back out # Repeat with a new position old_image = Surface(display_size) while True: # Zoom in and out again pos = (random(), random()) steps = 100 for x in chain( tween(easeInOutCubic, 0, steps*0.6, steps, True, False), tween(easeInOutCubic, steps*0.6, 0, steps, True, False)): zoom = x / float(steps); frame = get_window_at_pos ( smoothscale(base_image, ( int(round((base_image.get_width()-display_size[0]) * zoom + display_size[0])), int(round((base_image.get_height()-display_size[1]) * zoom + display_size[1])) )), pos) cans.drawSurface(frame) cans.update() for event in pygame.event.get(): if event.type==QUIT: sys.exit(0) time.sleep(1/float(steps))