Slingshot

ProTransitionsShowcase & MediaWebGLpowered by @vectorvesper/motion

A slideshow of images and videos that hands each frame to the next through a gravity well. The frame on show winds into a tilted, ringed disc around the pull point, the disc turns, and the next frame unwinds out of it. Plays on its own, and a click moves the pull point.

Slingshot

Included with membership

Members install Slingshot with one command and get the full source, the usage code and the Framer remix, licensed for client work. One membership covers the whole library and the CLI.

When to use it

A hero or a lookbook where a few strong pictures or short films take turns: a collection, a portfolio, a launch reel. It fills its box, so give the box a height, usually the screen's.

  • Use seamless loops for films, so one never jumps while it holds.
  • Use fit="contain" for pictures of different shapes, so each floats whole on the background. cover crops each one to fill the frame.
  • Give every item alt text. The slideshow tells screen readers which item is showing.
  • Leave light as "media" to light the disc in the colours of the frames themselves, or pass a near and a far colour to match a brand.

Avoid:

  • Do not set the hold much shorter than the default. Each hand-over takes its own few seconds on top, and a slideshow that never rests is hard to watch.
  • Do not put two on one page. Each draws a scene the size of its box.

Props

A slideshow of images and videos that hands each frame to the next through a gravity well. The frame on show winds into a tilted, ringed disc around the pull point, the disc turns, and the next frame unwinds out of it. It plays on its own, and a click moves the pull point to where you clicked.

<Slingshot />

The slideshow. It fills the element it renders, so give that element a height.

PropTypeDefaultDescription
items*(string | SlingshotItem)[]—The images and videos, in order: each a path, or an item with its type and alt text.
intervalnumber3Seconds each item holds before the next is pulled in.
durationnumber4.5Seconds for one hand-over, in and back out.
dwellnumber0.2Share of the hand-over spent as a turning disc, between the pull in and the release.
autoPlaybooleantrueMoves on to the next item on its own. Off, only a click hands over.
fit"cover" | "contain""cover"cover fills the frame; contain floats each item on the background.
insetnumber0.8contain only: the share of the frame an item may fill.
backgroundstring"#000000"The colour behind the frames.
light"media" | readonly [string, string]"media""media" lights the disc in the colours of the frames themselves; or a near and a far colour.
radiusnumber0.42Disc size, as a share of the frame's height.
tiltnumber-12Disc tilt in degrees.
squashnumber0.34Height of the disc against its width: 1 is seen face on, lower is more side on.
spinnumber0.8Turns the disc makes over one hand-over.
streaknumber0.6Length of the streaks, 0 to 1.
flarenumber1Strength of the light and the flare, 0 to 2.
labelstring"Slideshow"What a screen reader calls the slideshow.
onChange(index: number) => void—Called with the index of the item now on show.
onPull(pull: SlingshotPull) => void—Called as each hand-over starts, with the items it goes from and to and where it pulls.
classNamestring—Class for the outer element, which the slideshow fills.
styleReact.CSSProperties—Style for the outer element.

<SlingshotItem />

type

One image or video, when a plain path is not enough.

PropTypeDefaultDescription
src*string—The image or video.
type"image" | "video"—Read from the file extension when left out.
altstring—What a screen reader says for it.

<SlingshotPull />

type

What onPull receives as each hand-over starts.

PropTypeDefaultDescription
from*number—The item handed over.
to*number—The item coming in.
x*number—The pull point, as a share of the width from the left.
y*number—The pull point, as a share of the height from the top.
Visitors who prefer reduced motion see one frame at a time, still, with films on their first frame, and a click shows the next. Devices below the runtime's floor get the same.
It runs on the shared frame loop, at up to one and a half times the screen's pixel density, and the runtime lowers the resolution when frames run long.
The timing, the disc and the light change live.
Client component. The server renders the box, and the scene is built in the browser.
Back to all components