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.

coverflow({ step: 42, spread: 16, depth: 55, angle: 50 })
ts
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

OptionDefaultWhat it does
step92Pixels between one card and the next.
spread75Extra room the centered card claims on each side.
depth80Pixels each card recedes as it goes back.
angle58Degrees a card turns away from you.
reach6Cards each side before one has finished fading.
perspective900Distance to the vanishing point.
The same call with spread: 60. The center floats, the sides crowd.