mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 23:24:41 +00:00
Container alpha added
This commit is contained in:
parent
c2236e47eb
commit
9d39bd7b45
3 changed files with 16 additions and 2 deletions
|
@ -36,6 +36,7 @@ var Container = new Class({
|
|||
Extends: GameObject,
|
||||
|
||||
Mixins: [
|
||||
Components.Alpha,
|
||||
Components.BlendMode,
|
||||
Components.Depth,
|
||||
Components.Transform,
|
||||
|
@ -128,6 +129,7 @@ var Container = new Class({
|
|||
this._displayList = scene.sys.displayList;
|
||||
|
||||
this.setPosition(x, y);
|
||||
this.clearAlpha();
|
||||
|
||||
if (Array.isArray(children))
|
||||
{
|
||||
|
|
|
@ -45,9 +45,15 @@ var ContainerCanvasRenderer = function (renderer, container, interpolationPercen
|
|||
transformMatrix.scale(container.scaleX, container.scaleY);
|
||||
}
|
||||
|
||||
var alpha = container._alpha;
|
||||
|
||||
for (var index = 0; index < children.length; ++index)
|
||||
{
|
||||
children[index].renderCanvas(renderer, children[index], interpolationPercentage, camera, transformMatrix);
|
||||
var child = children[index];
|
||||
var childAlpha = child._alpha;
|
||||
child.setAlpha(childAlpha * alpha);
|
||||
child.renderCanvas(renderer, child, interpolationPercentage, camera, transformMatrix);
|
||||
child.setAlpha(childAlpha);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -45,9 +45,15 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
|
|||
transformMatrix.scale(container.scaleX, container.scaleY);
|
||||
}
|
||||
|
||||
var alpha = container._alpha;
|
||||
|
||||
for (var index = 0; index < children.length; ++index)
|
||||
{
|
||||
children[index].renderWebGL(renderer, children[index], interpolationPercentage, camera, transformMatrix);
|
||||
var child = children[index];
|
||||
var childAlpha = child._alpha;
|
||||
child.setAlpha(childAlpha * alpha);
|
||||
child.renderWebGL(renderer, child, interpolationPercentage, camera, transformMatrix);
|
||||
child.setAlpha(childAlpha);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue