Skip to main content

Animate transforms

Move, scale, or rotate painted content without changing its layout allocation.

Before you start: Springs.

transition-transform selects translation, scale, and rotation. The presented transform affects hit testing; it does not shrink the required accessible touch target.

Translate on one axis​

Physical X translation uses the four-unit spacing scale.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform ' + (changed ? 'translate-x-24' : 'translate-x-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Translate on one axis
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Change translate-x-24 to translate-x-12.

Scale a box​

Scale is a percentage: 100 is unchanged.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform ' + (changed ? 'scale-75' : 'scale-100')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Scale a box
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Change 75 to 125.

Rotate a box​

Rotation is in degrees along the authored numeric path.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform ' + (changed ? 'rotate-90' : 'rotate-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Rotate a box
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Change 90 to 180.

Change the pivot​

An origin changes the pivot, not the layout position.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform origin-left ' + (changed ? 'rotate-45' : 'rotate-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Change the pivot
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Compare origin-left with origin-center.

Logical translation​

Inline translation follows the logical direction.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform ' + (changed ? 'translate-inline-24' : 'translate-inline-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Logical translation
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Switch Environment & events to RTL.

Translate by measured width​

translate-x-full uses this node’s measured width.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-12 bg-accent transition-transform ' + (changed ? 'translate-x-full' : 'translate-x-0')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Translate by measured width
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Change the box width; the translation distance changes with it.

Next: size and spacing. Reference: translate, scale, rotate, and origin.