-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
45 lines (41 loc) · 966 Bytes
/
sketch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var brushSize = 20;
var redColor = 50;
var greenColor = 50;
var blueColor = 50;
var inverse = false;
function setup() {
createCanvas(1920,1080);
background(30);
}
function draw() {
noStroke();
if (mouseIsPressed){
fill(redColor,greenColor,blueColor);
ellipse(mouseX,mouseY,brushSize,brushSize);
colorRandomizer();
brushSizeChanger();
}
}
function keyPressed() {
if (keyCode === DELETE) {
background(255);
}
}
function brushSizeChanger() {
if (brushSize > 0 && !inverse){
brushSize = brushSize - 5;
} else if (brushSize == 0) {
inverse = true;
brushSize = brushSize + 5;
} else if (brushSize < 200 && inverse){
brushSize = brushSize + 5;
} else if (brushSize == 200){
inverse = false;
brushSize = brushSize - 5;
}
}
function colorRandomizer(){
redColor = random(255);
greenColor = random(255);
blueColor = random(255);
}