-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsprayCanTool.js
22 lines (20 loc) · 916 Bytes
/
sprayCanTool.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class SprayCanTool {
constructor() {
this.name = "sprayCanTool",
this.icon = "assets/sprayCan.jpg",
this.description = "The spray can tool sprays on the canvas slowly based on stroke color. Click and hold on the canvas to use it"
this.points = 13,
this.spread = 10,
this.draw = function () {
//if the mouse is pressed paint on the canvas
//spread describes how far to spread the paint from the mouse pointer
//points holds how many pixels of paint for each mouse press.
if (mouseIsPressed) {
for (var i = 0; i < this.points; i++) {
point(random(mouseX - this.spread, mouseX + this.spread),
random(mouseY - this.spread, mouseY + this.spread));
}
}
};
}
}