Phaser API Documentation

  Version: 
setAlphas([alphas], [bottomAlpha])

Description:

Set the alpha values used by the Rope during rendering.

You can provide the values in a number of ways:

  1. One single numeric value: setAlphas(0.5) - This will set a single alpha for the whole Rope.
  2. Two numeric value: setAlphas(1, 0.5) - This will set a 'top' and 'bottom' alpha value across the whole Rope.
  3. An array of values: setAlphas([ 1, 0.5, 0.2 ])

If you provide an array of values and the array has exactly the same number of values as points in the Rope, it will use each alpha value per rope segment.

If the provided array has a different number of values than points then it will use the values in order, from the first Rope segment and on, until it runs out of values. This allows you to control the alpha values at all vertices in the Rope.

Note this method is called setAlphas (plural) and not setAlpha.

Parameters:

name type arguments description
alphas number | Array.<number> <optional>

Either a single alpha value, or an array of values. If nothing is provided alpha is reset to 1.

bottomAlpha number <optional>

An optional bottom alpha value. See the method description for details.

Returns:
Description:

This Game Object instance.

Since: 3.23.0