Skip to main content

Your first transition

Animate one target value when local state changes.

Before you start: Local state and bind-class.

Classes describe the target appearance. transition-opacity tells Relo to animate opacity changes. It uses a spring by default, including for opacity and colors. No spring tuning is needed to begin.

Animate opacity​

Press Change target to fade between 100% and 25% opacity. State updates immediately; motion follows the target.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'w-16 h-16 bg-accent transition-opacity ' + (changed ? 'opacity-25' : 'opacity-100')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Your first transition
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: Remove transition-opacity and compare. Add it back to restore the transition.

Respect reduced motion​

Open Environment & events and select Reduced or Off. Both currently snap to the target. The interaction still works. System follows the platform preference. A document cannot force full motion against a reduced host policy.

Next: choose what transitions. Find exact selectors in transition reference.