python-lottie  0.6.10+dev2509936
A framework to work with lottie files and telegram animated stickers (tgs)
trim.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 last_frame = 60
14 an = objects.Animation(last_frame)
15 
16 layer = objects.ShapeLayer()
17 an.add_layer(layer)
18 
19 group = layer.add_shape(objects.Group())
20 
21 star = objects.Star()
22 star.inner_radius.value = 40
23 star.outer_radius.value = 100
24 star.position.value = Point(256, 256)
25 star.name = "big start"
26 group.add_shape(star)
27 
28 star = objects.Star()
29 star.inner_radius.value = 20
30 star.outer_radius.value = 50
31 star.position.value = Point(256, 256)
32 star.name = "small start"
33 group.add_shape(star)
34 
35 obj = objects.Path()
36 obj.shape.value.add_point(Point(10, 10))
37 obj.shape.value.add_point(Point(500, 10))
38 group.add_shape(obj)
39 
40 trim = layer.add_shape(objects.Trim())
41 #trim.offset.value = 350
42 trim.offset.add_keyframe(0, 0)
43 trim.offset.add_keyframe(last_frame, 360)
44 trim.start.value = 0
45 trim.end.value = 50
46 #trim.multiple = objects.TrimMultipleShapes.Individually
47 
48 stroke = group.add_shape(objects.Stroke(Color(1, 1, 0), 10))
49 
50 script.script_main(an)
lottie.nvector.Point
def Point(x, y)
Definition: nvector.py:135
lottie.utils
Definition: __init__.py:1