Added Random Actions.

This commit is contained in:
Richard Davey 2017-03-28 14:57:42 +01:00
parent 304dfe3318
commit ae18f7ebf2
7 changed files with 86 additions and 1 deletions

View file

@ -0,0 +1,13 @@
var Random = require('../geom/circle/Random');
var RandomCircle = function (items, circle)
{
for (var i = 0; i < items.length; i++)
{
Random(circle, items[i]);
}
return items;
};
module.exports = RandomCircle;

View file

@ -0,0 +1,13 @@
var Random = require('../geom/ellipse/Random');
var RandomEllipse = function (items, ellipse)
{
for (var i = 0; i < items.length; i++)
{
Random(ellipse, items[i]);
}
return items;
};
module.exports = RandomEllipse;

View file

@ -0,0 +1,13 @@
var Random = require('../geom/line/Random');
var RandomLine = function (items, line)
{
for (var i = 0; i < items.length; i++)
{
Random(line, items[i]);
}
return items;
};
module.exports = RandomLine;

View file

@ -0,0 +1,13 @@
var Random = require('../geom/rectangle/Random');
var RandomRectangle = function (items, rect)
{
for (var i = 0; i < items.length; i++)
{
Random(rect, items[i]);
}
return items;
};
module.exports = RandomRectangle;

View file

@ -9,6 +9,10 @@ module.exports = {
IncXY: require('./IncXY'),
IncY: require('./IncY'),
PositionAroundCircle: require('./PositionAroundCircle'),
RandomCircle: require('./RandomCircle'),
RandomEllipse: require('./RandomEllipse'),
RandomLine: require('./RandomLine'),
RandomRectangle: require('./RandomRectangle'),
Rotate: require('./Rotate'),
RotateAround: require('./RotateAround'),
RotateAroundDistance: require('./RotateAroundDistance'),

View file

@ -1,4 +1,4 @@
var CHECKSUM = {
build: 'b4d4a8d0-13ba-11e7-974b-e96ec5d8ff04'
build: '72b30ba0-13be-11e7-bd1a-0b21ce51903e'
};
module.exports = CHECKSUM;

View file

@ -101,6 +101,7 @@ var Layer = new Class({
createMultiple: function (quantity, key, frame, options)
{
if (frame === undefined) { frame = null; }
// if (options === undefined) { options = {}; }
var visible = GetObjectValue(options, 'visible', true);
@ -223,6 +224,34 @@ var Layer = new Class({
return this;
},
randomCircle: function (circle)
{
Actions.RandomCircle(this.children.entries, circle);
return this;
},
randomEllipse: function (ellipse)
{
Actions.RandomEllipse(this.children.entries, ellipse);
return this;
},
randomLine: function (line)
{
Actions.RandomLine(this.children.entries, line);
return this;
},
randomRectangle: function (rect)
{
Actions.RandomRectangle(this.children.entries, rect);
return this;
},
rotate: function (value)
{
Actions.Rotate(this.children.entries, value);