python-lottie  0.6.10+dev2509936
A framework to work with lottie files and telegram animated stickers (tgs)
effects.py
Note
Effects are not supported by telegram
1 #!/usr/bin/env python3
2 """
3 @note Effects are not supported by telegram
4 """
5 import sys
6 import os
7 sys.path.insert(0, os.path.join(
8  os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
9  "lib"
10 ))
11 from lottie.utils import script
12 from lottie import objects
13 from lottie.parsers.svg import parse_svg_file
14 from lottie import Point, Color
15 
16 
17 last_frame = 120
18 an = parse_svg_file(
19  os.path.join(os.path.dirname(os.path.abspath(__file__)), "blep.svg"),
20  0,
21  last_frame
22 )
23 
24 gaussian = objects.effects.GaussianBlurEffect()
25 an.layers[0].effects = [
26  #objects.effects.TritoneEffect(Color(1, 0, 0), Color(0, 1, 0), Color(0, 0, 1)),
27  #objects.effects.FillEffect(color=Color(1, 0, 0), opacity=0.5)
28  objects.effects.DropShadowEffect(Color(0, 0, 0), 128, 135, 10, 7),
29  objects.effects.TintEffect(Color(0, 0, 0), Color(0, 1, 0), 90),
30  gaussian,
31 ]
32 gaussian.sigma.add_keyframe(last_frame/2, 0)
33 gaussian.sigma.add_keyframe(last_frame*3/4, 25)
34 gaussian.sigma.add_keyframe(last_frame, 0)
35 
36 script.script_main(an)
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.utils
Definition: __init__.py:1