Class: Utils

HelperClasses.Utils()

This class holds useful, reusable methods that any gameobject could use. This class has static methods that can be used anywhere in order to reduce the amount of code written and really helps readability which further helps development.

Constructor

new Utils()

Author:
  • Christian P. Auman
Source:

Methods

(static) scaleIn(scene, delay, scale, alpha, easeParams, duration, from, …targets) → {Phaser.Tweens.Tween}

This method is used to create an animation for Phaser gameobjects. It creates and returns a Phaser.Tween and will animate the object's scale and alpha in a way that looks like the object is growing from nothing which is a useful animation for things like displaying things that have not been displayed yet.
Parameters:
Name Type Attributes Description
scene Phaser.Scene current scene being rendered.
delay number amount of time in milliseconds to wait before playing the animation.
scale number the scale value to animate to.
alpha number the alpha value to animate to.
easeParams Array the parameters to customize the feel of the animation.
duration number how long the animation will last.
from any values to animate from
targets any <repeatable>
the Phaser gameobjects that will be animated
Source:
Returns:
- the Phaser.Tween object which can be used to create callbacks on animation complete, the destruction of the animation, or for anything that might require access to the animation tween.
Type
Phaser.Tweens.Tween

(static) scaleOut(scene, delay, scale, alpha, easeParams, duration, from, …targets) → {Phaser.Tweens.Tween}

This method is used to create an animation for Phaser gameobjects. It creates and returns a Phaser.Tween and will animate the object's scale and alpha in a way that looks like the object is shrinking which is a useful animation for things like hiding objects in a nice modern way.
Parameters:
Name Type Attributes Description
scene Phaser.Scene current scene being rendered.
delay number amount of time in milliseconds to wait before playing the animation.
scale number the scale value to animate to.
alpha number the alpha value to animate to.
easeParams Array the parameters to customize the feel of the animation.
duration number how long the animation will last.
from any values to animate from
targets any <repeatable>
the Phaser gameobjects that will be animated
Source:
Returns:
- the Phaser.Tween object which can be used to create callbacks on animation complete, the destruction of the animation, or for anything that might require access to the animation tween.
Type
Phaser.Tweens.Tween