API Docs for:
Show:

Component_MoveAnimation Class

Module: gs

Executes a move-animation on a game-object.

Methods

colorTo

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

Starts the color-animation.

Parameters:

  • color Color

    The target color.

  • 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
  • [callback]
)

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.

  • [callback] Function optional

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

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.

moveTo

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

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.

  • [callback] Function optional

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

scroll

(
  • speedX
  • speedY
  • duration
  • easingType
  • [callback]
)

Scrolls the game object's content with a specified speed if supported.

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.

  • [callback] Function optional

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

scrollTo

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

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.

  • [callback] Function optional

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

toDataBundle

()

Serializes the move-animation into a data-bundle.

toDataBundle

()

Serializes the color-animation into a data-bundle.

update

()

Updates the color-animation

update

()

Updates the move-animation.

updateCoordinates

() protected

Updates the game object's coordinates depending on animation type.

Properties

animationType

gs.MoveAnimationType

The move-animation type (move-in, move-out, etc.).

easing

gs.Easing

The easing-object used for the animation.

easing

gs.Easing

The easing-object used for the animation.

sourceColor

gs.Color protected

The start-color.

targetColor

gs.Color protected

The end-color.