Ordering

.play(duration) only times one action. To combine several, wrap them in one of these five combinators before calling .compile().

chain

Run fragments one after another.

[frag_a.play(s(1)), frag_b.play(s(1))].ord_chain()

frag_b starts the moment frag_a finishes.

The second circle waits for the first.

chain
a
b

all

Run fragments together. Finishes when the slowest one does.

chain([
[frag_a.play(s(1)), frag_b.play(cs(50))].ord_all(),
frag_c.play(cs(50)),
])

The square waits for the slower circle before it starts.

The square starts once both circles have arrived.

chain
all
a
b
c

any

Run fragments together. Finishes as soon as the fastest one does.

chain([
[frag_a.play(s(1)), frag_b.play(cs(50))].ord_any(),
frag_c.play(cs(50)),
])

The square starts as soon as the faster circle arrives, compare that to all above.

The square starts the moment the faster circle arrives.

chain
any
a
b
c

flow

Like chain, but each fragment starts a fixed delay after the previous one starts, not after it finishes.

circles.iter().map(|c| c.play(cs(60))).ord_flow(cs(15))

A wave ripples through the row: each circle starts shortly after the last, not after it finishes.

flow
c0
c1
c2
c3
c4

delay

Push a single fragment’s start later.

use motiongfx::track::delay;

delay(cs(30), frag_a.play(s(1)))

The circle sits still, then starts moving.

delay
a

Next

Timeline: turn the result into something you can play.