useParallaxTransform

Parallax
stable

Computes CSS transform strings for parallax layer elements based on normalised mouse-position coordinates. Supports five transform types: translate, rotate, depth (3-D tilt), depth-inv (inverted tilt), scale, scale-x, and scale-y. Consumed by OrigamParallax to animate child layers.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useParallaxTransform is a pure computation helper — it has no side effects and does not touch the DOM. OrigamParallax owns the mousemove listener and passes the normalised coordinates down to each layer via this composable.

Interfaces consommées

IParallaxElementProps

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

props
requis
IParallaxElementProps
Props of a parallax layer element. Reads `type` (PARALLAX_ELEMENT_TYPE enum), `strength` (movement intensity, default 10), and `axis` (AXIS enum, used for rotate type to constrain movement to a single axis).

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

strength
Resolved movement strength. For depth / depth-inv types the absolute value is taken so the depth always projects forward.
transformStyles
Function that accepts normalised mouse coordinates (typically in [-1, 1]) and returns a CSS transform string. Returns undefined when the type does not match any known case.

Usage

Exemples

Extraits de code prêts à coller.

Manual parallax layer (custom wrapper)

vue

Using OrigamParallax (recommended)

vue