Loading...
Loading...
Use when implementing Disney's 12 animation principles with Rive interactive animations
npx skill4agent add dylantarre/animation-principles rive-animationsscaleX: 1.2scaleY: 0.8// Trigger from code
rive.play('squash_stretch');const inputs = rive.stateMachineInputs('State Machine');
const trigger = inputs.find(i => i.name === 'jump');
trigger.fire(); // Plays anticipate → action sequence// Control visibility
const bgOpacity = inputs.find(i => i.name === 'bgOpacity');
bgOpacity.value = 0.6;// Runtime speed control
rive.play('animation', { speed: 0.5 });// Listen for state changes
rive.on('statechange', (event) => {
if (event.data.includes('button_press')) {
// Secondary animations auto-trigger via state machine
}
});
// Or blend multiple animations
rive.play(['main_action', 'secondary_particles']);// Fast - snappy feedback
rive.play('click', { speed: 1.5 });
// Normal
rive.play('hover');
// Slow - dramatic reveal
rive.play('reveal', { speed: 0.5 });// Smooth hover interactions
const hover = inputs.find(i => i.name === 'isHovering');
element.addEventListener('mouseenter', () => hover.value = true);
element.addEventListener('mouseleave', () => hover.value = false);import { useRive, useStateMachineInput } from '@rive-app/react-canvas';
function AnimatedButton() {
const { rive, RiveComponent } = useRive({
src: 'button.riv',
stateMachines: 'Button',
autoplay: true
});
const hoverInput = useStateMachineInput(rive, 'Button', 'isHovering');
return (
<RiveComponent
onMouseEnter={() => hoverInput.value = true}
onMouseLeave={() => hoverInput.value = false}
/>
);
}