API Docs for:
Show:

Component_Animator Class

Module: gs

An animator-component allows to execute different kind of animations on a game object. The animations are using the game object's dstRect & offset-property to execute.

Methods

appear

(
  • x
  • y
  • animation
  • easing
  • duration
  • [callback]
)

Lets a game object appear on screen using a specified animation.

Parameters:

  • x Number

    The x-coordinate of the target-position.

  • y Number

    The y-coordinate of the target-position.

  • animation gs.AppearAnimationInfo

    The animation info-object.

  • easing Object

    The easing-type.

  • duration Number

    The duration in frames.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

blendTo

(
  • opacity
  • duration
  • easingType
  • [callback]
)

Blends a game object to specified opacity.

Parameters:

  • opacity Number

    The target opacity.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback called if blending is finished.

blendTo

(
  • param
  • value
  • duration
  • easingType
  • [callback]
)

Animates a Live2D model parameter of a Live2D game object to a specified value.

Parameters:

  • param String

    The name of the parameter to animate.

  • value Number

    The target value.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback called if blending is finished.

blurTo

(
  • power
  • duration
  • easingType
)

Blurs a game object to specified blur-power.

Parameters:

  • power Number

    The target blur-power.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

change

(
  • Value
  • field
  • duration
  • easingType
)

Changes a field of the game object to a specified value.

Parameters:

  • Value Number

    The target value.

  • field String

    The name of the field/property.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

changeFrames

(
  • frames
  • duration
  • easingType
)

A frame animation which modifies the game object's srcRect property a play an animation.

Parameters:

  • frames gs.Rect

    An array of source rectangles (frames).

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

changeImages

(
  • images
  • duration
  • easingType
)

An image animation runs from left to right using the game object's image-property.

Parameters:

  • images Array

    An array of image names.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

close

() deprecated

Changes visible-property to false. This method is deprecated.

colorTo

(
  • color
  • duration
  • easingType
)

Colors a game object to a specified target color.

Parameters:

  • color Color

    The target color.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

disappear

(
  • animation
  • easing
  • duration
  • [callback]
)

Lets a game object disappear from screen using a specified animation.

Parameters:

  • animation gs.AppearAnimationInfo

    The animation info-object.

  • easing Object

    The easing-type.

  • duration Number

    The duration in frames.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

flash

(
  • color
  • duration
)

Flashes the game object.

Parameters:

  • color Color

    The flash-color.

  • duration Number

    The duration in frames.

hide

(
  • duration
  • easing
  • [callback]
)

Lets a game object disappear from screen using blending.

Parameters:

  • duration Number

    The duration in frames.

  • easing Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

maskIn

(
  • mask
  • duration
  • easingType
  • [callback]
)

Lets a game object appear on screen using a masking-effect.

Parameters:

  • mask gs.Mask

    The mask used for the animation.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

maskOut

(
  • mask
  • duration
  • easingType
  • [callback]
)

Lets a game object disappear from screen using a masking-effect.

Parameters:

  • mask gs.Mask

    The mask used for the animation.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

maskTo

(
  • mask
  • duration
  • easingType
  • [callback]
)

Description follows...

Parameters:

  • mask gs.Mask

    The mask used for the animation.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

move

(
  • speedX
  • speedY
  • duration
  • easingType
)

Moves the game object with a specified speed.

Parameters:

  • speedX Number

    The speed on x-axis in pixels per frame.

  • speedY Number

    The speed on y-axis in pixels per frame.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type used for the animation.

moveIn

(
  • x
  • y
  • type
  • duration
  • easingType
  • [callback]
)

Lets a game object appear on screen from left, top, right or bottom using a move-animation

Parameters:

  • x Number

    The x-coordinate of the target-position.

  • y Number

    The y-coordinate of the target-position.

  • type Number

    The movement-direction from where the game object should move-in.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

moveOut

(
  • type
  • duration
  • easingType
  • [callback]
)

Lets a game object disappear from screen to the left, top, right or bottom using a move-animation

Parameters:

  • type Number

    The movement-direction in which the game object should move-out.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

movePath

(
  • path
  • loopType
  • duration
  • easingType
  • effects
)

Moves the game object along a path.

Parameters:

  • path Object

    The path to follow.

  • loopType gs.AnimationLoopType

    The loop-Type.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

  • effects Object

    Optional array of effects executed during the path-movement like playing a sound.

moveTo

(
  • x
  • y
  • duration
  • easingType
)

Moves the game object to a specified position.

Parameters:

  • x Number

    The x-coordinate of the position.

  • y Number

    The y-coordinate of the position.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

open

() deprecated

Changes visible-property to true. This method is deprecated.

pixelateTo

(
  • width
  • height
  • duration
  • easingType
)

Pixelates a game object to specified pixel-size/block-size

Parameters:

  • width Number
    • The target block-width
  • height Number
    • The target block-height
  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

playAnimation

(
  • frames
  • duration
  • easingType
)

A frame animation which modifies the game object's srcRect property a play an animation.

Parameters:

  • frames gs.Rect

    An array of source rectangles (frames).

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

rotate

(
  • direction
  • speed
  • duration
  • easingType
)

Rotates the game object around its anchor-point.

Parameters:

  • direction gs.RotationDirection

    The rotation-direction.

  • speed Number

    The rotation speed in degrees per frame.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

rotateTo

(
  • angle
  • duration
  • easingType
)

Rotates the game object around its anchor-point to a specified angle.

Parameters:

  • angle Number

    The target angle.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

scroll

(
  • speedX
  • speedY
  • duration
  • easingType
)

Scrolls the game object with a specified speed.

Parameters:

  • speedX Number

    The speed on x-axis in pixels per frame.

  • speedY Number

    The speed on y-axis in pixels per frame.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type used for the animation.

scrollPath

(
  • path
  • loopType
  • duration
  • easingType
)

Scrolls the game object along a path.

Parameters:

  • path Object

    The path to follow.

  • loopType gs.AnimationLoopType

    The loop-Type.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

scrollTo

(
  • x
  • y
  • duration
  • easingType
)

Scrolls the game object to a specified position.

Parameters:

  • x Number

    The x-coordinate of the position.

  • y Number

    The y-coordinate of the position.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

shake

(
  • range
  • speed
  • duration
  • easingType
)

Shakes the game object horizontally using the game object's offset-property.

Parameters:

  • range gs.Range

    The horizontal shake-range.

  • speed Number

    The shake speed.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

show

(
  • duration
  • easing
  • [callback]
)

Lets a game object appear on screen using blending.

Parameters:

  • duration Number

    The duration in frames.

  • easing Object

    The easing-type.

  • [callback] Function optional

    An optional callback-function called when the animation is finished.

tintTo

(
  • tone
  • duration
  • easingType
)

Tints the game object to a specified tone.

Parameters:

  • tone Tone

    The target tone.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

update

()

Updates the animator.

wobbleTo

(
  • power
  • speed
  • duration
  • easingType
)

Wobbles a game object to specified wobble-power and wobble-speed.

Parameters:

  • power Number

    The target wobble-power.

  • speed Number

    The target wobble-speed.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

zoomTo

(
  • x
  • y
  • duration
  • easingType
)

Zooms a game object to specified size.

Parameters:

  • x Number

    The x-axis zoom-factor.

  • y Number

    The y-axis zoom-factor.

  • duration Number

    The duration in frames.

  • easingType Object

    The easing-type.

Properties

callback

Function private

Standard Callback Routine