Morphiq

Components / Animations / Puzzle Transition

Puzzle Transition

Content changes by moving to the next piece of one jigsaw. Every page is a piece whose outline lies just outside its edge, so at rest the page is only the page. On a change the camera pulls back a little, far enough to show the outline; the pages slide across with the arm of this piece locked into the next; and the camera closes in on the next page. Two pieces that lock share their cut, so it is one line, and the arm is a real tab’s shape: a short neck and a round head twice as wide. Each step moves the camera on the minimum-jerk law, x(τ) = 10τ³ − 15τ⁴ + 6τ⁵, solved from wherever it is, so changing back partway turns the step in progress round and runs the rest backwards.

Model

s: 1 → zoom,  x: 0 → d,  s: zoom → 1,   each 10τ³ − 15τ⁴ + 6τ⁵

the camera pulls back, slides and closes in, one step after another, each on the minimum-jerk law, τ = t/T · the slide d = A + 2m + t + 2.39·r: a page A, a margin m either side, the line t and the arm’s reach, r its head radius

Props

PropertyTypeDefaultDescription
transitionKeystring | number—Changing this sends the camera to the next page, which lies beside the page on show as the jigsaw piece it locks into: it pulls back, slides and closes in. Changed back before it arrives, it goes back the way it came; changed again while it moves, the next page is brought once it has arrived.
direction'left' | 'right' | 'up' | 'down''left'The way the pages move. The next page comes in from the opposite side.
durationnumber1400The whole move, ms: pulling back and closing in take a fifth each, the slide the rest. Held to at least 300; anything that is not a finite number falls back to 1400.
zoomnumber0.85The scale the camera pulls back to before the slide, which brings the outline into view. 1 for no pull back; held to at least 0.3.
knobsnumber1How many arms are cut along the joining edge, 1 to 8.
marginnumber12How far outside a page's edge its outline lies, px, measured to the line's edge. At rest it is out of view.
thicknessnumber6The line's width, px, the same at any scale.
colorstring'currentColor'The line's colour. Any CSS colour; by default the text colour.
onComplete() => void—Called once the camera has arrived at the next page, or gone back to the one on show.
childrenReactNode—What is showing for the current transitionKey.