//! Holes through a morph (vector/morph.zig), for test/scene_morph.script: //! a ring into a disc, a 0 into a 5, and a 0 whose path has its hole first //! into a ring, side by side, together over 4 s at a steady pace. const anim = @import("anim"); pub const scene = anim.Scene(construct); const disc = "M 40 0 C 40 22 22 40 0 40 C -22 40 -40 22 -40 0 C -40 -22 -22 -40 0 -40 C 22 -40 40 -22 40 0 Z "; const ring_hole = "M 20 0 C 20 -11 11 -20 0 -20 C -11 -20 -20 -11 -20 0 C -20 11 -11 20 0 20 C 11 20 20 11 20 0 Z "; const zero = "M 0 -45 C 25 -45 30 -20 30 0 C 30 20 25 45 0 45 C -25 45 -30 20 -30 0 C -30 -20 -25 -45 0 -45 Z "; const zero_hole = "M 0 -25 C -12 -25 -14 -12 -14 0 C -14 12 -12 25 0 25 C 12 25 14 12 14 0 C 14 -12 12 -25 0 -25 Z "; const five = "M -25 -45 H 25 V -33 H -13 V -8 H 5 L 20 -3 L 28 10 V 25 L 20 40 L 5 45 H -25 V 33 H 5 L 14 25 V 10 L 5 4 H -25 Z "; const head = ""; fn construct(s: *anim.Builder) void { const pairs = .{ .{ disc ++ ring_hole, disc, -400 }, .{ zero ++ zero_hole, five, 0 }, .{ zero_hole ++ zero, disc ++ ring_hole, 400 } }; var morphs: [pairs.len]anim.Animation = undefined; inline for (pairs, &morphs) |p, *m| { const from = s.svg(head ++ p[0] ++ tail, .{ .x = p[2], .scale = 2, .visible = true }); m.* = from.transformInto(s.svg(head ++ p[1] ++ tail, .{ .x = p[2], .scale = 2 })); } s.play(morphs, .{ .seconds = 4, .ease = anim.ease.linear }); }