4 sys.path.insert(0, os.path.join(
5 os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
9 from lottie
import objects
11 from lottie
import Point, Color
13 an = objects.Animation(60)
15 layer = objects.ShapeLayer()
17 g = layer.add_shape(objects.Group())
19 sine_displacer = anutils.SineDisplacer(300, 50, 0, 60, 10, 1, 45)
21 displacer = anutils.DisplacerDampener(sine_displacer,
lambda p: p.x / 128
if p.x < 128
else 1)
23 for i
in range(0, 512+1, 16):
24 b = g.add_shape(objects.Ellipse())
25 b.size.value =
Point(16, 16)
26 b.position.value =
Point(i, 100)
27 displacer.animate_point(b.position)
30 bez = g.add_shape(objects.Path())
31 bez.shape.value.add_smooth_point(
Point(256, 200),
Point(50, 0))
32 bez.shape.value.add_smooth_point(
Point(156, 300),
Point(0, -50))
33 bez.shape.value.add_smooth_point(
Point(256, 400),
Point(-50, 0))
34 bez.shape.value.add_smooth_point(
Point(356, 300),
Point(0, 50))
35 bez.shape.value.close()
36 bez.shape.value.split_self_chunks(8)
37 displacer.animate_bezier(bez.shape)
39 g.add_shape(objects.Fill(Color(1, 1, 0)))
42 g = layer.add_shape(objects.Group())
43 bez = g.add_shape(objects.Path())
44 g.add_shape(objects.Stroke(Color(1, 0, 0), 5))
45 g.add_shape(objects.Fill(Color(0, 0, 1)))
47 bez.shape.value.add_point(
Point(i*64, 160),
Point(-20, 0),
Point(20, 0))
50 bez.shape.value.add_point(
Point(512-i*64, 420),
Point(20, 0),
Point(-20, 0))
51 bez.shape.value.close()
52 displacer.animate_bezier(bez.shape)
55 script.script_main(an)