python-lottie  0.6.10+dev2509936
A framework to work with lottie files and telegram animated stickers (tgs)
simple_animations.py
1 #!/usr/bin/env python3
2 import sys
3 import os
4 sys.path.insert(0, os.path.join(
5  os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
6  "lib"
7 ))
8 from lottie.utils import script
9 from lottie import objects
10 from lottie import Point, Color
11 
12 
13 an = objects.Animation(59)
14 
15 layer = objects.ShapeLayer()
16 an.add_layer(layer)
17 
18 circle = layer.add_shape(objects.Ellipse())
19 circle.size.value = Point(100, 100)
20 circle.position.add_keyframe(0, Point(0, 256))
21 circle.position.add_keyframe(20, Point(256, 256))
22 circle.position.add_keyframe(40, Point(256, 0))
23 circle.position.add_keyframe(60, Point(0, 256))
24 
25 
26 fill = layer.add_shape(objects.Fill(Color(1, 1, 0)))
27 fill.opacity.add_keyframe(0, 100)
28 fill.opacity.add_keyframe(30, 10)
29 fill.opacity.add_keyframe(60, 100)
30 
31 
32 script.script_main(an)
33 
34 
lottie.nvector.Point
def Point(x, y)
Definition: nvector.py:135
lottie.utils
Definition: __init__.py:1