ParallaxElement
Individually moving element inside a Parallax container. Driven by mouse position, scroll or audio data. Uses translate, rotate, scale or opacity transforms.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-parallax-element> — 3 parts: ① host container, ② root element (receives transform style), ③ default slot content.- 1.origam-parallax (host)
- Parent OrigamParallax required as the injection context. Provides movement data via provide(ORIGAM_PARALLAX_KEY).
- 2.origam-parallax-element
- Root element. Receives the computed CSS transform (translate/rotate/scale/opacity) and transition parameters on each animation frame.
- 3#default slot
- User content rendered inside the animated root. Any markup is valid.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- transformOriginTAnchor'center'
- CSS transform-origin value, e.g. "center", "top left". Passed directly to the transform CSS property.
- originXnumber50
- Horizontal reference point (0–100 %) for movement calculation relative to the parallax container.
- originYnumber50
- Vertical reference point (0–100 %) for movement calculation relative to the parallax container.
- strengthnumber10
- Magnitude of the transform effect in pixels (translate) or degrees (rotate). Larger values produce more intense movement.
- axisTAxis
- Constrains the movement to a single axis: 'x' (horizontal only) or 'y' (vertical only). When omitted both axes are active.
- maxXnumber
- Maximum horizontal translation in pixels. Clamps the computed X offset.
- maxYnumber
- Maximum vertical translation in pixels. Clamps the computed Y offset.
- minXnumber
- Minimum horizontal translation in pixels. Clamps the computed X offset.
- minYnumber
- Minimum vertical translation in pixels. Clamps the computed Y offset.
- cyclenumber0
- Number of cyclic loops for the movement pattern. 0 = linear, ≥1 = cyclic sinusoidal path.
- audioIndexnumber50
- Index into the audio frequency array (0–255) used as the movement driver when event="audio" on the host Parallax.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- Root HTML element tag.
- paddingboolean | number | string
- Shorthand CSS padding applied to the root element.
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- Shorthand CSS margin applied to the root element.
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border. Pass true for the default border or a CSS shorthand string.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- Border-radius token or boolean. true = theme default; pill = full-round.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- Box-shadow elevation token applied to the element root.
- typeTParallaxElementType'translate'
- Transform type applied by the element: 'translate', 'rotate', 'scale' or 'opacity'.
API
Slots
Emplacements de contenu exposés par ce composant.
- #default
- Content to animate. Any markup placed here is translated/rotated/scaled by the parallax effect.
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.
- Ref<string>
- Reactive CSS string generated by useStyle from the computed parallaxElementStyles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
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 perspective depth inherited from the host Parallax. Applied on the parent container, not the element itself.
- Transition duration for the transform applied to each element. Sourced from parallax.element.transition-duration token.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Notes
- The transform transition is inherited from the host Parallax. Under prefers-reduced-motion: reduce, the host disables transitions, so all element movements stop automatically.
- ParallaxElement is a presentational wrapper — it carries no ARIA role. Accessible text must come from the slotted content.
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.
- other1000px
- CSS perspective value set on the host Parallax container.
- othercenter center
- Default transform-origin for the host container. Elements can override via the transformOrigin prop.
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.
Mouse-driven element
Constrained axis
Clamped movement