5 sys.path.insert(0, os.path.join(
6 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
10 from lottie
import objects
12 from lottie
import Color, Point
17 an = objects.Animation(rot_time*4)
20 layer = objects.ShapeLayer()
24 def add_shape(shape, color, parent):
25 g = parent.add_shape(objects.Group())
26 s = g.add_shape(shape)
27 g.add_shape(objects.Fill(color))
31 face1 = add_shape(objects.Ellipse(), Color(1, 1, 0), layer)
32 face2 = add_shape(objects.Ellipse(), Color(0, 1, 0), layer)
34 side = layer.add_shape(objects.Group())
35 side1 = add_shape(objects.Ellipse(), Color(1, 0, 0), side)
36 side2 = add_shape(objects.Ellipse(), Color(1, 0, 0), side)
37 sider = add_shape(objects.Rect(), Color(1, 0, 0), side)
42 face1.size.add_keyframe(rot_time*0,
Point(256, 256), easing.EaseIn())
43 face1.size.add_keyframe(rot_time*1,
Point(0, 256))
44 face1.size.add_keyframe(rot_time*2,
Point(0, 256))
45 face1.size.add_keyframe(rot_time*3,
Point(0, 256), easing.EaseOut())
46 face1.size.add_keyframe(rot_time*4,
Point(256, 256))
47 face1.position.add_keyframe(rot_time*0,
Point(256, 256), easing.EaseIn())
48 face1.position.add_keyframe(rot_time*1,
Point(256-width, 256))
49 face1.position.add_keyframe(rot_time*2,
Point(256-width, 256))
50 face1.position.add_keyframe(rot_time*3,
Point(256+width, 256), easing.EaseOut())
51 face1.position.add_keyframe(rot_time*4,
Point(256, 256))
54 face2.size.add_keyframe(rot_time*0,
Point(0, 256))
55 face2.size.add_keyframe(rot_time*1,
Point(0, 256), easing.EaseOut())
56 face2.size.add_keyframe(rot_time*2,
Point(256, 256), easing.EaseIn())
57 face2.size.add_keyframe(rot_time*3,
Point(0, 256))
58 face2.position.add_keyframe(rot_time*0,
Point(256+width, 256))
59 face2.position.add_keyframe(rot_time*1,
Point(256+width, 256), easing.EaseOut())
60 face2.position.add_keyframe(rot_time*2,
Point(256, 256), easing.EaseIn())
61 face2.position.add_keyframe(rot_time*3,
Point(256-width, 256))
64 side1.size = face1.size
65 side1.position.add_keyframe(rot_time*0,
Point(256, 256), easing.EaseIn())
66 side1.position.add_keyframe(rot_time*1,
Point(256+width, 256))
67 side1.position.add_keyframe(rot_time*2,
Point(256-width, 256))
68 side1.position.add_keyframe(rot_time*3,
Point(256-width, 256), easing.EaseOut())
69 side1.position.add_keyframe(rot_time*4,
Point(256, 256))
71 sider.position.value =
Point(256, 256)
72 sider.size.add_keyframe(rot_time*0,
Point(0, 256))
73 sider.size.add_keyframe(rot_time*1,
Point(2*width, 256))
74 sider.size.add_keyframe(rot_time*2,
Point(0, 256))
75 sider.size.add_keyframe(rot_time*3,
Point(2*width, 256))
77 side2.size = face2.size
78 side2.position.add_keyframe(rot_time*0,
Point(256-width, 256))
79 side2.position.add_keyframe(rot_time*1,
Point(256-width, 256), easing.EaseOut())
80 side2.position.add_keyframe(rot_time*2,
Point(256, 256), easing.EaseIn())
81 side2.position.add_keyframe(rot_time*3,
Point(256+width, 256))
82 side2.position.add_keyframe(rot_time*4,
Point(256-width, 256))
85 script.script_main(an)
Package with all the Lottie Python bindings.