Skip to main content

setAnimation

MahiruLess than 1 minute

setAnimation

Sets an animation.

Statement Content

Sets the custom animation name and drives the specified stage object target to perform a multi-segment animation.
See Custom Animations and Animation Reference for details.

Info

If you want to define a multi-segment animation directly in the script, use setTempAnimation.
If you only want to set a single-segment animation, use setTransform.

setAnimation:shake -target=aaa;

Parameters

target

  • String

The target of an animation.

Available targets:

  • fig-center: center figure
  • fig-left: left figure
  • fig-right: right figure
  • fig-left13, fig-right13, fig-left14, fig-right14: the figure at the corresponding position
  • The id of a free figure
  • bg-main: background
  • stage-main: stage
changeFigure:1/open_eyes.png -id=aaa;
setAnimation:shake -target=aaa;

transformFrom

  • String
  • Available values: current, default
  • Default value: current

Specifies where the animation's transform starts from, i.e. how transform and effect properties not written in the animation are handled.

  • current: Starts from the object's current transform. The animation only modifies the properties it writes. Other properties keep their current values, and properties being modified by other parallel animations on the same object are not overwritten.
  • default: Starts from the default transform. Properties not written in the animation are reset to their default values.

When this argument is set, the legacy writeDefault argument is ignored.

changeFigure:1/open_eyes.png -id=aaa;
setAnimation:shake -target=aaa -transformFrom=default;

writeDefault

  • Boolean

Note

This argument is deprecated. Use transformFrom instead: -writeDefault is equivalent to -transformFrom=default. When transformFrom is set, this argument is ignored.

When the value is true, all unassigned transform and effect properties are written with their default values.
When the value is false, unassigned properties inherit the existing values.

changeFigure:1/open_eyes.png -id=aaa;
setAnimation:shake -target=aaa -writeDefault;

keep

  • Boolean

Converts the animation into a cross-statement animation. The current animation keeps playing while subsequent statements run, until it ends or is interrupted by another setTransform, setAnimation, or setTempAnimation with the same target.
It is usually used together with the next parameter.

; Assume this is a very long animation
setAnimation:shake -target=aaa -keep -next;
CharacterA:First line;
CharacterA:Second line;
CharacterA:Third line;
; This interrupts aaa's cross-statement animation and plays a new animation
setAnimation:rotate -target=aaa -keep -next;

parallel

  • Boolean

Plays alongside other animations already running on the same target.

By default, a new setTransform setAnimation setTempAnimation on the same target interrupts the animation currently playing on it. With -parallel, the new animation does not interrupt existing ones, and they play at the same time. A later animation without -parallel still interrupts all running animations on the target, including parallel ones.

Parallel animations should modify different properties. If several parallel animations modify the same property, the result is unpredictable. With -parallel, the animation only modifies the properties it writes.

changeFigure:1/open_eyes.png -id=aaa;
; Shake and change brightness at the same time
setAnimation:shake -target=aaa -next;
setTransform:{"brightness":0.5} -target=aaa -duration=1000 -parallel;