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

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

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

All props accepted by this component, with their type, default value and 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

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.

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.

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

vue

Constrained axis

vue

Clamped movement

vue