Verwendung

Choose behavior beyond interpolation stops.

tsx
// Choose behavior beyond interpolation stops.
import { Box, Scroll, interpolate, scrollMotion, type Extrapolate } from 'kuito';

function Header(props: { parallax: boolean }) {
  const feed = scrollMotion();
  // 'extend' keeps the image moving past 200 points; 'clamp' (the default) stops it there.
  const extrapolate: Extrapolate = props.parallax ? 'extend' : 'clamp';

  return (
    <Scroll motion={feed}>
      <Box
        height={240}
        translateY={interpolate(feed.offset, [0, 200], [0, 100], { extrapolate })}
      />
    </Scroll>
  );
}

Signaturen

ts
(name?: string): ScrollMotion

Parameter

NameTypErforderlichBeschreibung
namestringNein—

Rückgabe

ScrollMotion

Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.