Extrapolate
How interpolate treats input outside its range: 'clamp' to the ends, or 'extend' linearly beyond them.
Utilisation
Choose behavior beyond interpolation stops.
// 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>
);
}Déclaration du type
export type Extrapolate = 'clamp' | 'extend';Type
"clamp" | "extend"Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.