如何在paperJs中获取每个数组元素?

时间:2017-03-06 05:59:53

标签: javascript arrays paperjs

var path = new Path.Rectangle(new Point(50, 50), new Size(100, 50));
path.style = {
    fillColor: 'white',
    strokeColor: 'black'
};
var copy = {};

//Create a copy of the path and set its stroke color to red:
for (var i = 0; i < 100; i++) {

    var copy[i] = path.clone();
    console.log(copy[i]);
    copy[i].strokeColor = 'red';
    //Rotate the copy by 45 degrees:
    copy[i].rotate(45);
}

1 个答案:

答案 0 :(得分:0)

您唯一需要做的就是将copy初始化为数组;

var copy = [];