def test_static_animation(): img1 = py_gd.Image(200, 200) img2 = py_gd.Image(200, 200) endpoints = np.array(((-100, 0), (100, 0))) offset = np.array((100, 100)) fname = "test_animation.gif" anim = py_gd.Animation(outfile(fname)) anim.begin_anim(img1, 0) for ang in range(0, 360, 10): rad = np.deg2rad(ang) rot_matrix = [(np.cos(rad), np.sin(rad)), (-np.sin(rad), np.cos(rad))] points = np.dot(endpoints, rot_matrix).astype(np.int32) + offset # print points img1.draw_line(points[0], points[1], 'red') img2.draw_line(points[0], points[1], 'red') assert img1 == img2 anim.add_frame(img1) anim.add_frame(img2) # img.draw_line(np.array((200,100)),np.array((0,100)), 'green') # anim.add_frame(img) anim.close_anim() print anim.frames_written
def start_animation(self, filename): self.animation = py_gd.Animation(filename, self.delay) looping = 0 if self.repeat else -1 print 'Starting animation' self.animation.begin_anim(self.back_image, looping)
def start_animation(self, filename): self.animation = py_gd.Animation(filename, self.delay) looping = 0 if self.repeat else -1 self.logger.info('Starting Animation') self.animation.begin_anim(self.back_image, looping)