File indexing completed on 2025-01-19 04:00:00
0001 #!/usr/bin/env python3 0002 import os 0003 import sys 0004 import math 0005 sys.path.insert(0, os.path.join( 0006 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 0007 "lib" 0008 )) 0009 from lottie.utils import script 0010 from lottie import objects 0011 from lottie.nvector import Point, PolarVector 0012 from lottie.utils import color 0013 0014 0015 an = objects.Animation(59) 0016 0017 layer = objects.ShapeLayer() 0018 an.add_layer(layer) 0019 0020 0021 bezier = objects.Bezier() 0022 radius = 128 0023 angle = -math.pi / 2 0024 for i in range(5+1): 0025 bezier.add_point(PolarVector(radius, angle)) 0026 angle += 2 * math.pi * 2 / 5 0027 bezier.closed = True 0028 bezier.reverse() 0029 0030 g = layer.add_shape(objects.Group()) 0031 g.transform.position.value = Point(radius, radius) 0032 g.add_shape(objects.Path(bezier)) 0033 fill = g.add_shape(objects.Fill(color.from_uint8(255, 0, 100))) 0034 fill.fill_rule = objects.FillRule.NonZero 0035 0036 g = layer.add_shape(objects.Group()) 0037 g.transform.position.value = Point(512-radius, 512-radius) 0038 g.add_shape(objects.Path(bezier)) 0039 fill = g.add_shape(objects.Fill(color.from_uint8(255, 100, 0))) 0040 fill.fill_rule = objects.FillRule.EvenOdd 0041 0042 script.script_main(an) 0043