Cover Flow
The coverflow preset, real depth with one line of setup.
Cards turn away from the center and recede into the page. Real perspective, not
a scale trick: items carry a z in pixels and the track has a vanishing point.
import { createPicker } from 'loopem'
import { coverflow } from 'loopem/layouts'
createPicker(el, {
items,
renderItem,
...coverflow(),
})A preset returns a partial options object, not just a layout function, so it
can bring the spacing, perspective and overscan its geometry needs. Spread
it, and override anything after.
Both demos on this page pass smaller numbers than the bare call, because these swatches are 56px. Each caption gives the exact call.
Tuning it
| Option | Default | What it does |
|---|---|---|
step | 92 | Pixels between one card and the next. |
spread | 75 | Extra room the centered card claims on each side. |
depth | 80 | Pixels each card recedes as it goes back. |
angle | 58 | Degrees a card turns away from you. |
reach | 6 | Cards each side before one has finished fading. |
perspective | 900 | Distance to the vanishing point. |