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

smoothScroll function

Smooth scroll on an Astro page.

View as Markdown
import { smoothScroll } from '@dioramajs/diorama/astro/client'

The first call makes the page's Lenis, later calls return it, so a script that needs the instance calls it too. Lenis runs on its own frames until the app of start() runs and drives it. On a ClientRouter swap it keeps the scroll Astro sets (the top, the hash, the position Back restores) and its classes on <html>.

import Lenis from 'lenis'
import { smoothScroll } from '@dioramajs/diorama/astro/client'
const lenis = smoothScroll(Lenis, { easing: (t) => 1 - (1 - t) ** 3, duration: 1.2 })
function smoothScroll<O extends object, L extends SmoothScroll>(
  Lenis: (options?: O) => L,
  options?: O,
): L

Parameters

NameTypeDescription
Lenis(options?: O) => L
options?O

Defined in packages/diorama/src/astro-client.ts.