Skip to content

Animations Overview

Asset Studio supports per-item animations organized into three categories: enter, exit, and effect. Animations are driven by the timeline and controlled via the usePlayer hook.

Animation Categories

CategoryPropertyWhen It Plays
EnterenterWhen the item first appears on the timeline
ExitexitBefore the item disappears from the timeline
EffecteffectContinuously loops while the item is visible

Setting Animations

Animations are set as properties on any item:

tsx
const { updateItem } = useStudio()

updateItem(item.id, {
  enter: {
    animation: 'fade',
    duration: 0.6,   // seconds
    delay: 0,
    strength: 80,
  },
  exit: {
    animation: 'fade',
    duration: 0.4,   // seconds
    endDelay: 0,
    strength: 80,
  },
  effect: {
    animation: 'pulse',
    strength: 80,
  },
})

Removing an Animation

Set the property to undefined:

tsx
updateItem(item.id, { enter: undefined })

Animation Config Types

EnterAnimation

PropertyTypeDescription
animationstringAnimation name (see Enter Animations below).
durationnumberDuration in seconds.
delaynumberDelay before the animation starts, in seconds.
strengthnumberIntensity of the animation (0–200).

ExitAnimation

PropertyTypeDescription
animationstringAnimation name (see Exit Animations below).
durationnumberDuration in seconds.
endDelaynumberDelay from the end of the timeline, in seconds.
strengthnumberIntensity of the animation (0–200).

EffectAnimation

PropertyTypeDescription
animationstringAnimation name (see Effect Animations below).
strengthnumberIntensity of the animation (0–200).

Enter Animations (ENTER_ANIMATIONS)

ValueDescription
fadeFades in from transparent to full opacity
move-rightSlides in from the left
move-leftSlides in from the right
move-upSlides in from the bottom
move-downSlides in from the top
move-up-rightSlides in from the bottom-left
move-up-leftSlides in from the bottom-right
move-down-rightSlides in from the top-left
move-down-leftSlides in from the top-right
scaleScales up from a smaller size
riseRises upward while fading in

Exit Animations (EXIT_ANIMATIONS)

ValueDescription
fadeFades out to transparent
move-rightSlides out to the right
move-leftSlides out to the left
move-upSlides out upward
move-downSlides out downward
move-up-rightSlides out to the top-right
move-up-leftSlides out to the top-left
move-down-rightSlides out to the bottom-right
move-down-leftSlides out to the bottom-left
scaleScales down to a smaller size
fallFalls downward while fading out

Effect Animations (EFFECT_ANIMATIONS)

ValueDescription
pulseContinuously pulses scale up and down
blinkBlinks opacity on and off
bounceBounces vertically
spinRotates continuously

Using Animation Constants

The animation name lists are exported as constants you can use to build UI pickers:

tsx
import {
  ENTER_ANIMATIONS,
  EXIT_ANIMATIONS,
  EFFECT_ANIMATIONS,
} from '@asset-studio/core'

function AnimationPicker({ onSelect }) {
  return (
    <select onChange={e => onSelect(e.target.value)}>
      <option value="">None</option>
      {ENTER_ANIMATIONS.map(name => (
        <option key={name} value={name}>
          {name}
        </option>
      ))}
    </select>
  )
}

Playback

Animations play automatically when you use usePlayer to play the timeline:

tsx
const { play } = usePlayer()

// Start timeline — all enter/exit/effect animations play in sync
play()

Released under a proprietary license.