-
Notifications
You must be signed in to change notification settings - Fork 3
Canvas draw
mohayonao edited this page Aug 11, 2014
·
4 revisions
Runs a drawing function and restores changed parameters after exit.
var star = function(x, y, color) {
this.stroke(color).noFill()
.polygon([
[ x - 12, y - 4 ],
[ x + 12, y - 4 ],
[ x - 8, y + 12 ],
[ x + 0, y - 12 ],
[ x + 8, y + 12 ]
]);
};
canvas
.draw(star, 50, 70, 10)
.draw(star, 100, 40, 11)
.draw(star, 150, 50, 12)
.draw(star, 200, 60, 13)
.draw(star, 250, 30, 14);
canvas.draw(fn);
-
fn: function
- drawing function
-
...args: *
- arguments for the drawing function
Canvas: self for method chaining