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 import Point, Color
0011 
0012 
0013 an = objects.Animation(60)
0014 
0015 layer = objects.ShapeLayer()
0016 an.add_layer(layer)
0017 
0018 shapes = layer.add_shape(objects.Group())
0019 
0020 circle = shapes.add_shape(objects.Ellipse())
0021 circle.size.add_keyframe(0, Point(100, 100))
0022 circle.size.add_keyframe(30, Point(50, 120))
0023 circle.size.add_keyframe(60, Point(100, 100))
0024 circle.position.add_keyframe(0, Point(220, 110))
0025 circle.position.add_keyframe(20, Point(180, 110))
0026 circle.position.add_keyframe(40, Point(220, 110))
0027 
0028 star = shapes.add_shape(objects.Star())
0029 star.inner_radius.add_keyframe(0, 20)
0030 star.inner_radius.add_keyframe(30, 50)
0031 star.inner_radius.add_keyframe(60, 20)
0032 star.outer_radius.value = 50
0033 #star.inner_roundness.value = 100
0034 #star.outer_roundness.value = 40
0035 star.rotation.value = 45
0036 star.position.value = Point(330, 110)
0037 
0038 rect = shapes.add_shape(objects.Rect())
0039 rect.size.add_keyframe(0, Point(100, 100))
0040 rect.size.add_keyframe(30, Point(50, 120))
0041 rect.size.add_keyframe(60, Point(100, 100))
0042 rect.position.add_keyframe(0, Point(110, 110))
0043 rect.position.add_keyframe(20, Point(80, 110))
0044 rect.position.add_keyframe(40, Point(110, 110))
0045 
0046 
0047 rrect = shapes.add_shape(objects.Rect())
0048 rrect.size.value = Point(100, 100)
0049 rrect.position.value = Point(440, 110)
0050 rrect.rounded.add_keyframe(0, 0)
0051 rrect.rounded.add_keyframe(30, 30)
0052 rrect.rounded.add_keyframe(60, 0)
0053 
0054 fill = shapes.add_shape(objects.Fill(Color(1, 1, 0)))
0055 stroke = shapes.add_shape(objects.Stroke(Color(0, 0, 0), 5))
0056 
0057 
0058 beziers = layer.add_shape(objects.Group())
0059 beziers.transform.position.value = Point(0, 130)
0060 beziers.add_shape(rect.to_bezier())
0061 beziers.add_shape(rrect.to_bezier())
0062 beziers.add_shape(circle.to_bezier())
0063 beziers.add_shape(star.to_bezier())
0064 
0065 
0066 
0067 fill = beziers.add_shape(objects.Fill(Color(0, 0, 1)))
0068 stroke = beziers.add_shape(objects.Stroke(Color(1, 1, 1), 5))
0069 
0070 
0071 script.script_main(an)