File indexing completed on 2025-01-19 04:00:00
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, NVector 0010 from lottie import Color, Point 0011 0012 0013 an = objects.Animation(59) 0014 0015 layer = objects.ShapeLayer() 0016 an.add_layer(layer) 0017 0018 g1 = layer.add_shape(objects.Group()) 0019 0020 circle = g1.add_shape(objects.Ellipse()) 0021 circle.size.value = Point(100, 100) 0022 circle.position.value = Point(128, 156) 0023 0024 0025 fill = g1.add_shape(objects.GradientFill()) 0026 fill.start_point.value = Point(100, 0) 0027 fill.end_point.value = Point(200, 0) 0028 fill.colors.set_stops([(0, Color(1, 0, 0)), (1, Color(1, 1, 0))]) 0029 0030 0031 stroke = g1.add_shape(objects.GradientStroke(5)) 0032 stroke.start_point.value = Point(100, 0) 0033 stroke.end_point.value = Point(200, 0) 0034 stroke.colors.add_keyframe( 0, [(0, Color(1, 0, 0)), (1, Color(1, 1, 0))]) 0035 stroke.colors.add_keyframe(10, [(0, Color(1, 1, 0)), (1, Color(0, 1, 0))]) 0036 stroke.colors.add_keyframe(30, [(0, Color(1, 0, 1)), (1, Color(0, 0, 1))]) 0037 stroke.colors.add_keyframe(59, [(0, Color(1, 0, 0)), (1, Color(1, 1, 0))]) 0038 stroke.colors.count = 2 0039 stroke.width.value = 10 0040 0041 0042 g2 = layer.add_shape(objects.Group()) 0043 0044 circle = g2.add_shape(objects.Ellipse()) 0045 circle.size.value = Point(200, 200) 0046 circle.position.value = Point(128+256, 256) 0047 0048 0049 fill = g2.add_shape(objects.GradientFill()) 0050 fill.gradient_type = objects.GradientType.Radial 0051 fill.start_point.value = Point(128+256, 256) 0052 fill.end_point.value = Point(128+256+100, 256) 0053 fill.colors.set_stops([(0, Color(1, 0, 0)), (1, Color(1, 1, 0))]) 0054 #fill.highlight_length.add_keyframe(0, -50) 0055 #fill.highlight_length.add_keyframe(30, 50) 0056 #fill.highlight_length.add_keyframe(59, -50) 0057 #fill.highlight_angle.value = 45 0058 fill.highlight_length.value = 90 0059 0060 0061 g3 = layer.add_shape(objects.Group()) 0062 circle = g3.add_shape(objects.Ellipse()) 0063 circle.size.value = Point(100, 100) 0064 circle.position.value = Point(128, 356) 0065 fill = g3.add_shape(objects.GradientFill()) 0066 fill.start_point.value = Point(100, 0) 0067 fill.end_point.value = Point(200, 0) 0068 fill.colors.set_stops([(0, NVector(1, 0, 0, 1)), (0.5, NVector(1, .5, 0, 1)), (1, NVector(1, 1, 0, 0))]) 0069 0070 0071 script.script_main(an)