ParallaxLayer

Media
stable

Depth layer inside a Parallax container. Each layer registers a speed multiplier with the parent and is driven frame-by-frame via a rAF loop (JS path) or CSS scroll-driven animations (CSS path).

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamParallaxLayerSchematic of the ParallaxLayer component with 4 numbered internal parts. origam-parallax (host) Layer — speed 0.2 (background) Layer — speed 1 (neutral) Layer — speed 1.5 (foreground) 1 2 3 4
Anatomy of <origam-parallax-layer> — 4 parts: ① host parallax, ② background layer (low speed), ③ neutral layer (speed 1), ④ foreground layer (high speed). Each layer is positioned absolute; inset: 0 and driven by a shared rAF loop or CSS scroll-driven animation.
1.origam-parallax (host)
Parent OrigamParallax providing the injection context. Owns the scroll/mouse listeners and the rAF loop. Layers register on mount and unregister on unmount.
2.origam-parallax__layer (background)
Background layer (speed < 1). Positioned absolute; inset: 0. Moves slower than the scroll — creates the depth illusion.
3.origam-parallax__layer (neutral)
Neutral layer (speed = 1). Moves with the scroll. When the CSS scroll-driven path is active, carries .origam-parallax__layer--css-driven.
4.origam-parallax__layer (foreground)
Foreground layer (speed > 1). Moves faster than the scroll. Under prefers-reduced-motion: reduce, carries .origam-parallax__layer--reduced-motion and transform is locked to translate3d(offsetX, offsetY, 0).

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

speed
number
1
Parallax speed multiplier: 0 = fixed, 0.5 = half scroll speed (far background), 1 = neutral, >1 = faster than scroll (foreground). Negative values reverse the direction.
offsetX
number
0
Static horizontal offset in px applied on top of the parallax translation. Useful to nudge a layer without changing its speed.
offsetY
number
0
Static vertical offset in px applied on top of the parallax translation.
zIndex
number
Optional z-index override. By default layers stack in document order.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
Root HTML element tag.

API

Slots

Emplacements de contenu exposés par ce composant.

#default
Content of this depth layer. Any markup is valid — images, text, decorative elements.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to a child component.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

CSS will-change hint for the layer. Defaults to transform to promote layers to compositor.
Transform origin for each layer element.
Speed multiplier used by the CSS scroll-driven keyframe (from 0 to 100% view coverage).
Static X offset applied in the reduced-motion keyframe.
Static Y offset applied in the reduced-motion keyframe.

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Notes

  • Under prefers-reduced-motion: reduce, the CSS keyframe animation and the rAF loop are both disabled. The layer is rendered at its static offset (offsetX, offsetY) without any movement.
  • ParallaxLayer is a purely presentational layer. All semantic content must come from the slotted markup.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

Source
other
transform
CSS will-change hint for each layer — promotes to compositor.
other
center center
Default transform-origin shared by all layers.
cubicBezier
cubic-bezier(0.16, 1, 0.3, 1)
Spring-like easing curve available for the multi-layer scroll path.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Scroll-driven multi-layer

vue

CSS scroll-driven (progressive enhancement)

vue