Diorama

Made for a big screen.

This site is one 3D scene, built for a computer: a wide window and a mouse. Open dioramajs.dev on a desktop or a laptop to see it.This site is one 3D scene, built for a wide window. Make this one wider, or open dioramajs.dev on a larger screen.

GitHub

DioramaDocs

follow function

Follows the pointer the way a light or a brush on an element wants it: a mouse or pen while it is over the element, the first finger while it is pressed on it.

View as Markdown
import { follow } from '@dioramajs/diorama/kit'

. Touch never blocks the page's scroll: the browser takes the finger with pointercancel when one starts. Each change asks for a frame. Listeners go with ctx.signal. Returns the live pointer; on adds callbacks.

function follow(
  ctx: Pick<EffectContext, 'element' | 'signal' | 'invalidate'>,
  on?: FollowHandlers,
): FollowedPointer

Parameters

NameTypeDescription
ctxPick<EffectContext, 'element' | 'signal' | 'invalidate'>
on?FollowHandlers

Default {}.

Also exported from @dioramajs/effects/kit.

Defined in packages/effects/src/kit.ts.