Voxel View
One voxel model that turns by itself, by drag or with the arrow keys. It can land voxel by voxel, come apart, and move its parts.
import { VoxelView, voxelModel, volumeFromPixels } from "pleate/effects/voxel-scene";Take it apart
Drag the model to turn it, and the slider to separate its parts.
Moving a part
The lid lifts and the gem turns in the air.
From a pixel drawing
Any drawing of the pixel gallery becomes a model.
Props
- model
From pleate/effects/voxel-gallery, or yours: { id, name, parts: [{ id, volume, at, away }] }.
VoxelModel- spin
Turns per minute while nobody drags. 0 stands still and draws only on change.
numberdefault 4- interactive
Drag and arrow keys.
booleandefault true- explode
How far apart the parts are. Changes are eased.
number (0..1)default 0- build
The voxels land when it mounts.
booleandefault false- pose(actor, { time, delta })
Called before each frame, to move parts by hand.
function- margin
Room around the model.
numberdefault 1.15- pixel, outline, disc, bands, dither, grain, light
The look.
as in VoxelScene
Accessibility
- A named image. When it is interactive it takes the focus and the arrow keys turn it.
- On touch screens a vertical swipe scrolls the page; only the sideways drag turns the model.
- Reduced motion stops the turning and the landing, and parts jump to their place.