python-lottie  0.6.10+dev2509936
A framework to work with lottie files and telegram animated stickers (tgs)
matte.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.parsers.svg import parse_svg_file
11 from lottie import Point, Color
12 
13 
14 an = parse_svg_file(os.path.join(
15  os.path.dirname(os.path.abspath(__file__)),
16  "blep.svg"
17 ))
18 
19 layer = an.insert_layer(0, objects.ShapeLayer())
20 r = layer.add_shape(objects.Rect())
21 r.position.value = Point(256, 256)
22 r.size.value = Point(512, 512)
23 gf = layer.add_shape(objects.GradientFill([(0, Color(1, 1, 1)), (1, Color(0, 0, 0))]))
24 gf.start_point.value = Point(256, 256)
25 gf.end_point.value = Point(256, 64)
26 
27 an.layers[-1].matte_mode = objects.MatteMode.Luma
28 
29 
30 script.script_main(an)
31 
lottie.parsers.svg.importer.parse_svg_file
def parse_svg_file(file, layer_frames=0, *args, **kwargs)
Definition: importer.py:1310
lottie.parsers.svg
Definition: __init__.py:1
lottie.nvector.Point
def Point(x, y)
Definition: nvector.py:135
lottie.utils
Definition: __init__.py:1