ParallaxElement
Individually moving element inside a Parallax container. Driven by mouse position, scroll or audio data. Uses translate, rotate, scale or opacity transforms.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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
All props accepted by this component, with their type, default value and 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
Content slots exposed by this component.
- #default
- Content to animate. Any markup placed here is translated/rotated/scaled by the parallax effect.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <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.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
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.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- 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.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Mouse-driven element
Constrained axis
Clamped movement