小编Ale*_*x K的帖子

paper.js onFrame方法不起作用

我正在尝试学习一些paper.js,并且它的onFrame事件对我不起作用:(在下面的代码中,我在画布上创建了30个随机形状,并尝试通过onFrame方法旋转它们中的每个形状,但没有任何反应,路径固定。

var len = 30;
var array = new Array();
var rand;
var colors = ['#fbff00', '#99ff37', '#00eeff', '#374afe', '#ff005e'];
for(var i = 0; i < len; i++) {      
    rand = getRandom(0, 4);
    switch (rand) {
        case 0: // if 0, create circle
            var path = new Path.Circle({
                center: [getRandom(30, scrwidth - 30), getRandom(30, scrheight - 30)],
                radius: 30
            });
            path.fillColor = colors[getRandom(0, 4)];
            array.push(path);
            break;
//and some others in the same way
    }
}
function …
Run Code Online (Sandbox Code Playgroud)

javascript paperjs

1
推荐指数
1
解决办法
2850
查看次数

标签 统计

javascript ×1

paperjs ×1