mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Make Phyllotaxis Raster example run a little less hot.
This commit is contained in:
parent
981bce31cb
commit
581f99f345
1 changed files with 3 additions and 5 deletions
|
@ -51,8 +51,8 @@
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorizePaths() {
|
function colorizePaths(offset) {
|
||||||
for (var i = 0, l = group.children.length; i < l; i++) {
|
for (var i = offset % 50, l = group.children.length; i < l; i += 50) {
|
||||||
var path = group.children[i];
|
var path = group.children[i];
|
||||||
// Set the path's fill color to the average color of the
|
// Set the path's fill color to the average color of the
|
||||||
// raster pixels that fall within it:
|
// raster pixels that fall within it:
|
||||||
|
@ -86,9 +86,7 @@
|
||||||
group.children[i].rotate(2);
|
group.children[i].rotate(2);
|
||||||
}
|
}
|
||||||
// Colorize the paths every other frame:
|
// Colorize the paths every other frame:
|
||||||
if (event.count % 2 == 0) {
|
colorizePaths(event.count);
|
||||||
colorizePaths();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue