ParallaxElement

Media
stable

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.

Anatomy of OrigamParallaxElementSchematic of the ParallaxElement component with 3 numbered internal parts. origam-parallax (host) origam-parallax-element #default slot — user content 1 2 3 Transform driven by mouse position / scroll / audio via inject(ORIGAM_PARALLAX_KEY)
Anatomy of <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.

transformOrigin
TAnchor
'center'
CSS transform-origin value, e.g. "center", "top left". Passed directly to the transform CSS property.
originX
number
50
Horizontal reference point (0–100 %) for movement calculation relative to the parallax container.
originY
number
50
Vertical reference point (0–100 %) for movement calculation relative to the parallax container.
strength
number
10
Magnitude of the transform effect in pixels (translate) or degrees (rotate). Larger values produce more intense movement.
axis
TAxis
Constrains the movement to a single axis: 'x' (horizontal only) or 'y' (vertical only). When omitted both axes are active.
maxX
number
Maximum horizontal translation in pixels. Clamps the computed X offset.
maxY
number
Maximum vertical translation in pixels. Clamps the computed Y offset.
minX
number
Minimum horizontal translation in pixels. Clamps the computed X offset.
minY
number
Minimum vertical translation in pixels. Clamps the computed Y offset.
cycle
number
0
Number of cyclic loops for the movement pattern. 0 = linear, ≥1 = cyclic sinusoidal path.
audioIndex
number
50
Index into the audio frequency array (0–255) used as the movement driver when event="audio" on the host Parallax.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
Root HTML element tag.
padding
boolean | number | string
Shorthand CSS padding applied to the root element.
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
Shorthand CSS margin applied to the root element.
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border. Pass true for the default border or a CSS shorthand string.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
Border-radius token or boolean. true = theme default; pill = full-round.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
elevation
TElevation
Box-shadow elevation token applied to the element root.
type
TParallaxElementType
'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.

Source
other
1000px
CSS perspective value set on the host Parallax container.
other
center 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

vue

Constrained axis

vue

Clamped movement

vue