elementMovement
Parallax
stable
Computes the X/Y translation offset to apply to a parallax target element based on cursor or scroll position, a strength multiplier, and optional min/max clamps.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- actionrequisIParallaxElementMovement
- Configuration object that includes the current cursor/scroll position (x, y), the origin point (originX, originY defaults 50), a strength multiplier, optional clamp values (minX, maxX, minY, maxY), the event type, and the target element.
API
Valeur de retour
La valeur retournée par cet util.
- An object with the computed x and y translation offsets and the target element reference.
Usage
Exemples
Extraits de code prêts à coller.
Compute parallax offset