skip the tree
system / motion / interactions9 rebuilds

Interactions

The Interactions examples of the Motion library, rebuilt in Composite: the same trigger, in steps, with the system's own parts.

the category

motion/_rebuilds
rebuilds
9
from motion+
5
easing
steps() only

motion / interactions / pinch to rotate

after a motion.dev example
turn it with two fingers, the arrows or the buttons
margin_rebuilds/​interactions/​pinch-rotate.tsx
Motion
pinch, useMotionValue
here
two pointers, or keys, or buttons
a step
15°
after the fingers
nothing moves

Two pointers turn the tile, and the left and right arrows and two buttons do the same, in whole steps of 15°. The tile stops where the fingers stop.

motion / interactions / pinch to zoom

after a motion.dev example
zoom with two fingers, a double tap, + and −, or the buttons
margin_rebuilds/​interactions/​pinch-zoom.tsx
Motion
pinch, a double tap
here
two pointers, keys, buttons
a step
25 %, from 100 % to 300 %
double tap
100 %, 200 %, in one cut

A spread of two pointers, + and −, the buttons or a double tap cut the zoom to the next whole step of 25 %. The view stays at the centre.

motion / interactions / double tap to like

after a motion.dev example
tap the picture twice
margin_rebuilds/​interactions/​tap-double.tsx
Motion
a double tap, animate
here
play(), 5 frames
a frame
100 ms, one size
also
a like button

Two taps within 300 ms draw a heart of block glyphs in five frames, each a size, and the count goes up. The like button does the same without the heart.

motion / interactions / add to basket

after a motion.dev example
press add to basket
margin_rebuilds/​interactions/​add-to-basket.tsx
Motion
animate, layout
here
play(), 6 frames
a frame
80 ms, one cell up
landed
the count glitches

A block rises to the basket in six cells, one a frame. The count goes up when it lands, and glitches.

motion / interactions / pointer collision detection

after a motion+ example
move over the grid, or use the arrow keys
margin_rebuilds/​interactions/​collision-hover-grid.tsx
Motion
hover, a spring per cell
here
every(), 80 ms
under the pointer
bone, then 4 greys
keys
the arrows move it

The cell under the pointer, and the eight round it, cut to light. Each wears down one grey every 80 ms, so a trail follows. Under reduced motion only the cells under the pointer are lit.

motion / interactions / tilt card

after a motion+ example
move the pointer over the card, or use the arrow keys
margin_rebuilds/​interactions/​tilt-card.tsx
Motion
useMotionValue, a 3D tilt
here
Retro 3D, one tile
a step
15°, to 30° each way
keys
arrows, one step
original
Tilt card

The card turns toward the quarter of the stage the pointer is in, in whole steps of 15° on both axes. It is shaded by the light, so a card that leans to the light is brighter. When the pointer leaves, the card cuts back to its three-quarter view.

motion / interactions / image reveal slider

after a motion+ example
drag the divider, or use the arrow keys
margin_rebuilds/​interactions/​image-reveal-slider.tsx
Motion
a drag, clip-path
here
a drag in whole cells
a cell
8 px
keys
arrows, Shift for 4 cells

A divider moves in whole cells of 8 px, and cuts between two inks of the same block picture. There is no momentum.

motion / interactions / swipe actions

after a motion+ example
swipe the row left, or press the left arrow
margin_rebuilds/​interactions/​swipe-actions.tsx
Motion
drag, a spring back
here
a cut at 1 cell
a cell
16 px
keys
left opens, right closes

A swipe left of one cell or more cuts the row to its open state, and a swipe right cuts it back. The row never stops half way.

motion / interactions / ios notifications stack

after a motion+ example
expand the stack, then dismiss a card
margin_rebuilds/​interactions/​notifications-stack.tsx
Motion
layout, animate
here
a cut between two layouts
closed
three cards, 6 px apart
open
a list, one card a row

A click cuts the closed stack to a list, and a click on a card removes it. The stack and the list are two layouts, with no move between them.