Chapters
Ordering
.play(duration) turns one action into a fragment. To combine several fragments, order them with one of these five combinators before calling .compile(). In the snippets below, a, b, and c are actions, not the builder.
Chain
Run fragments one after another.
[a.play(s(1)), b.play(s(1))].ord_chain()b starts the moment a finishes.
The second circle waits for the first.
All
Run fragments together. Finishes when the slowest one does.
[
[a.play(s(1)), b.play(cs(50))].ord_all(),
c.play(cs(50)),
]
.ord_chain()The square waits for the slower circle before it starts.
The square starts once both circles have arrived.
Any
Run fragments together. Finishes as soon as the fastest one does.
[
[a.play(s(1)), b.play(cs(50))].ord_any(),
c.play(cs(50)),
]
.ord_chain()The square starts as soon as the faster circle arrives. Compare that to all above.
The square starts the moment the faster circle arrives.
Flow
Like chain, except each fragment starts a fixed delay after the previous one starts, instead of waiting for it to finish.
actions.map(|a| a.play(cs(60))).ord_flow(cs(15))A wave ripples through the row: each circle starts shortly after the last, not after it finishes.
Delay
Push a single fragment’s start later.
use motiongfx::track::delay;
delay(cs(30), a.play(s(1)))The circle sits still, then starts moving.