mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Added Scale Actions.
This commit is contained in:
parent
358b74237a
commit
3c423b5b7d
9 changed files with 126 additions and 1 deletions
11
v3/src/actions/ScaleX.js
Normal file
11
v3/src/actions/ScaleX.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var ScaleX = function (items, value)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].scaleX += value;
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = ScaleX;
|
12
v3/src/actions/ScaleXY.js
Normal file
12
v3/src/actions/ScaleXY.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
var ScaleXY = function (items, x, y)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].scaleX += x;
|
||||
items[i].scaleY += y;
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = ScaleXY;
|
11
v3/src/actions/ScaleY.js
Normal file
11
v3/src/actions/ScaleY.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
var ScaleY = function (items, value)
|
||||
{
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].scaleY += value;
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = ScaleY;
|
17
v3/src/actions/SetScale.js
Normal file
17
v3/src/actions/SetScale.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
var SetScale = function (items, x, y, stepX, stepY)
|
||||
{
|
||||
if (stepX === undefined) { stepX = 0; }
|
||||
if (stepY === undefined) { stepY = 0; }
|
||||
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].setScale(
|
||||
x + (i * stepX),
|
||||
y + (i * stepY)
|
||||
);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = SetScale;
|
13
v3/src/actions/SetScaleX.js
Normal file
13
v3/src/actions/SetScaleX.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var SetScaleX = function (items, value, step)
|
||||
{
|
||||
if (step === undefined) { step = 0; }
|
||||
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].scaleX = value + (i * step);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = SetScaleX;
|
13
v3/src/actions/SetScaleY.js
Normal file
13
v3/src/actions/SetScaleY.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var SetScaleY = function (items, value, step)
|
||||
{
|
||||
if (step === undefined) { step = 0; }
|
||||
|
||||
for (var i = 0; i < items.length; i++)
|
||||
{
|
||||
items[i].scaleY = value + (i * step);
|
||||
}
|
||||
|
||||
return items;
|
||||
};
|
||||
|
||||
module.exports = SetScaleY;
|
|
@ -12,8 +12,14 @@ module.exports = {
|
|||
Rotate: require('./Rotate'),
|
||||
RotateAround: require('./RotateAround'),
|
||||
RotateAroundDistance: require('./RotateAroundDistance'),
|
||||
ScaleX: require('./ScaleX'),
|
||||
ScaleXY: require('./ScaleXY'),
|
||||
ScaleY: require('./ScaleY'),
|
||||
SetAlpha: require('./SetAlpha'),
|
||||
SetRotation: require('./SetRotation'),
|
||||
SetScale: require('./SetScale'),
|
||||
SetScaleX: require('./SetScaleX'),
|
||||
SetScaleY: require('./SetScaleY'),
|
||||
SetVisible: require('./SetVisible'),
|
||||
SetX: require('./SetX'),
|
||||
SetXY: require('./SetXY'),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var CHECKSUM = {
|
||||
build: '00b50b50-13b6-11e7-a00b-efd0cd0ce446'
|
||||
build: 'b4d4a8d0-13ba-11e7-974b-e96ec5d8ff04'
|
||||
};
|
||||
module.exports = CHECKSUM;
|
|
@ -251,6 +251,27 @@ var Layer = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
scaleX: function (value)
|
||||
{
|
||||
Actions.ScaleX(this.children.entries, value);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
scaleXY: function (x, y)
|
||||
{
|
||||
Actions.ScaleXY(this.children.entries, x, y);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
scaleY: function (value)
|
||||
{
|
||||
Actions.ScaleY(this.children.entries, value);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setRotation: function (value, step)
|
||||
{
|
||||
Actions.SetRotation(this.children.entries, value, step);
|
||||
|
@ -258,6 +279,27 @@ var Layer = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
setScale: function (x, y, stepX, stepY)
|
||||
{
|
||||
Actions.SetScale(this.children.entries, x, y, stepX, stepY);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setScaleX: function (value, step)
|
||||
{
|
||||
Actions.SetScaleX(this.children.entries, value, step);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setScaleY: function (value, step)
|
||||
{
|
||||
Actions.SetScaleY(this.children.entries, value, step);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setVisible: function (value)
|
||||
{
|
||||
Actions.SetVisible(this.children.entries, value);
|
||||
|
|
Loading…
Reference in a new issue