File indexing completed on 2025-01-19 04:00:01
0001 #!/usr/bin/env python3 0002 import sys 0003 import os 0004 sys.path.insert(0, os.path.join( 0005 os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 0006 "lib" 0007 )) 0008 from lottie.utils import script 0009 from lottie import objects 0010 from lottie.utils.animation import spring_pull 0011 from lottie import Point, Color 0012 0013 0014 an = objects.Animation(100) 0015 0016 layer = objects.ShapeLayer() 0017 an.add_layer(layer) 0018 0019 settings = [ 0020 (Color(1, 1, 0), 128, 7), 0021 (Color(1, 0, 0), 256, 15), 0022 (Color(0, .5, 1), 384, 30), 0023 ] 0024 0025 for color, x, falloff in settings: 0026 group = layer.add_shape(objects.Group()) 0027 ball = group.add_shape(objects.Ellipse()) 0028 ball.size.value = Point(100, 100) 0029 group.add_shape(objects.Fill(color)) 0030 group.transform.position.value = Point(x, -100) 0031 spring_pull(group.transform.position, Point(x, 256), 0, 60, falloff, 7) 0032 group.transform.position.add_keyframe(85, Point(x, -100)) 0033 0034 0035 script.script_main(an)