Phaser API Documentation

  Version: 

Member of: Phaser.Actions

<static> Spread(items, property, min, max, [inc])

Description:

Takes an array of Game Objects and then modifies their property so the value equals, or is incremented, by the calculated spread value.

The spread value is derived from the given min and max values and the total number of items in the array.

For example, to cause an array of Sprites to change in alpha from 0 to 1 you could call:

Phaser.Actions.Spread(itemsArray, 'alpha', 0, 1);

Parameters:

name type arguments Default description
items array | Array.<Phaser.GameObjects.GameObject>

An array of Game Objects. The contents of this array are updated by this Action.

property string

The property of the Game Object to spread.

min number

The minimum value.

max number

The maximum value.

inc boolean <optional> false

Should the values be incremented? true or set (false)

Returns:
Description:

The array of Game Objects that were passed to this Action.

Type:
Since: 3.0.0
Source: src/actions/Spread.js (Line 7)