Skip to main content

setTransform

MahiruLess than 1 minute

setTransform

Sets transform and effects.

Statement Content

Sets a single-line JSON string for transform and effects.

Info

This command only generates one animation segment. If you need to set a multi-segment animation, use setAnimation or setTempAnimation.

changeFigure:character_a/normal.png -id=aaa;
; Move left
setTransform:{"position":{"x":-500},"saturation":0.8} -target=aaa -duration=500;
; Lower brightness
setTransform:{"brightness":0.5,"contrast":1.2} -target=aaa -duration=500;

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;
setTransform:{"brightness":0.5} -target=aaa -duration=500;

duration

  • Number
  • Range: 0 to positive infinity
  • Unit: milliseconds

The duration of the animation.

changeFigure:1/open_eyes.png -id=aaa;
setTransform:{"brightness":0.5} -target=aaa -duration=500;

ease

  • String

Sets the easing type used by the animation. The default value is easeInOut. Available values include:

  • linear: linear
  • easeIn: ease in
  • easeOut: ease out
  • easeInOut: ease in and out
  • circIn: circular ease in
  • circOut: circular ease out
  • circInOut: circular ease in and out
  • backIn: back ease in
  • backOut: back ease out
  • backInOut: back ease in and out
  • bounceIn: bounce in
  • bounceOut: bounce out
  • bounceInOut: bounce in and out
  • anticipate: anticipate

Any other string falls back to the default value.

changeFigure:1/open_eyes.png -id=aaa;
setTransform:{"brightness":0.5} -target=aaa -duration=500 -ease=linear;

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;
setTransform:{"brightness":0.5} -target=aaa -duration=500 -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;
setTransform:{"brightness":0.5} -target=aaa -duration=500 -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
setTransform:{"scale":{"x":2,"y":2}} -target=aaa -duration=10000 -keep -next;
CharacterA:First line;
CharacterA:Second line;
CharacterA:Third line;
; This interrupts aaa's cross-statement animation and plays a new animation
setTransform:{"scale":{"x":1,"y":1}} -target=aaa -duration=10000 -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;
; Move and change brightness at the same time
setTransform:{"position":{"x":-500}} -target=aaa -duration=1000 -next;
setTransform:{"brightness":0.5} -target=aaa -duration=1000 -parallel;