mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
* SpineGameObject.setSlotAlpha
is a new method that allows you to set the alpha on a specific slot in a Spine skeleton. * The SpineGameObject.setAlpha
method has had its 2nd parameter removed. This fixes needless slot look-ups during rendering when a Spine Game Object is inside a regular Container. If you need to set slot alpha, use the new setSlotAlpha
method instead. Fix #6571
This commit is contained in:
parent
5e0a40022e
commit
c444f53d28
1 changed files with 32 additions and 11 deletions
|
@ -284,6 +284,8 @@ var SpineGameObject = new Class({
|
|||
*
|
||||
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
|
||||
*
|
||||
* To set the alpha of a specific attachment, use the `setSlotAlpha` method instead.
|
||||
*
|
||||
* @method SpineGameObject#setAlpha
|
||||
* @since 3.19.0
|
||||
*
|
||||
|
@ -291,23 +293,42 @@ var SpineGameObject = new Class({
|
|||
*
|
||||
* @return {this} This Game Object instance.
|
||||
*/
|
||||
setAlpha: function (value, slotName)
|
||||
setAlpha: function (value)
|
||||
{
|
||||
if (value === undefined) { value = 1; }
|
||||
|
||||
if (slotName)
|
||||
this.alpha = value;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the Alpha level for the given attachment slot.
|
||||
*
|
||||
* The alpha controls the opacity of the slot as it renders.
|
||||
*
|
||||
* Alpha values are provided as a float between 0, fully transparent, and 1, fully opaque.
|
||||
*
|
||||
* To set the alpha for the whole skeleton, use the `setAlpha` method instead.
|
||||
*
|
||||
* @method SpineGameObject#setSlotAlpha
|
||||
* @since 3.80.0
|
||||
*
|
||||
* @param {string} slotName - The name of the slot to find.
|
||||
* @param {number} [value=1] - The alpha value used for the slot.
|
||||
*
|
||||
* @return {this} This Game Object instance.
|
||||
*/
|
||||
setSlotAlpha: function (value, slotName)
|
||||
{
|
||||
if (value === undefined) { value = 1; }
|
||||
|
||||
var slot = this.findSlot(slotName);
|
||||
|
||||
if (slot)
|
||||
{
|
||||
slot.color.a = Clamp(value, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.alpha = value;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue