python-lottie  0.7.0+dev66cafb9
A framework to work with lottie files and telegram animated stickers (tgs)
charts.py
1 #!/usr/bin/env python3
2 import sys
3 import os
4 import math
5 sys.path.insert(0, os.path.join(
6  os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
7  "lib"
8 ))
9 from lottie.utils import script, charts
10 from lottie import Color
11 
12 chart = charts.Chart()
13 chart.data.add(0.5, Color(1, 0, 0))
14 chart.data.add(0.3, Color(0, 1, 0))
15 chart.data.add(0.7, Color(0, 0, 1))
16 chart.compute_animation(150, 50, 30)
17 chart.order = charts.RandomOrder()
18 
19 # For a pie chart
20 #chart.data.normalize_values(True)
21 #chart.type = charts.PieGrow()
22 
23 animation = chart.animation()
24 animation.out_point = 180
25 script.script_main(animation)
26