python-lottie  0.6.10+dev2509936
A framework to work with lottie files and telegram animated stickers (tgs)
shake.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.utils.animation import shake, rot_shake
11 from lottie import Point, Color
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.value = Point(256, 128)
21 
22 shake(circle.position, 10, 15, 0, 59, 25)
23 
24 
25 g = layer.add_shape(objects.Group())
26 box = g.add_shape(objects.Rect())
27 box.size.value = Point(200, 100)
28 g.transform.anchor_point.value = g.transform.position.value = box.position.value = Point(256, 384)
29 rot_shake(g.transform.rotation, Point(-15, 15), 0, 60, 10)
30 
31 
32 layer.add_shape(objects.Fill(Color(1, 1, 0)))
33 
34 
35 script.script_main(an)
lottie.utils.animation.shake
def shake(position_prop, x_radius, y_radius, start_time, end_time, n_frames, interp=easing.Linear())
Definition: animation.py:10
lottie.utils.animation
Definition: animation.py:1
lottie.utils.animation.rot_shake
def rot_shake(rotation_prop, angles, start_time, end_time, n_frames)
Definition: animation.py:33
lottie.nvector.Point
def Point(x, y)
Definition: nvector.py:135
lottie.utils
Definition: __init__.py:1