-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsketch.js
103 lines (75 loc) · 2.53 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var shuffle = false;
var pr = 0, pg = 255, pb = 255;
var lock = false;
function windowResized() {
//console.log('resized');
resizeCanvas(windowWidth, windowHeight);
}
function setup() {
canvas = createCanvas(windowWidth,windowHeight);
canvas.position(0,0);
noStroke();
canvas.style('z-index',-1)
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw() {
if (lock === false) {
if (shuffle === true) {
console.log(shuffle);
pr = random(150,255);
pg = random(150,255);
pb = random(150,255);
shuffle = false;
}
fill(pr,pg-(mouseY/3),pb-(mouseY/3),120);
// rect(mouseX,mouseY,(mouseY/10),(mouseY/10));
// fill(50,220,50);
// rect(windowWidth-(windowWidth*.9), windowHeight-(windowHeight*.9),32,25,20);
// fill(0);
// text("on",windowWidth-(windowWidth*.9)+9, windowHeight-(windowHeight*.9)+16);
// if (mouseX > (windowWidth-(windowWidth*.9)) && mouseX < (windowWidth - (windowWidth*.9) + 30) && mouseY > windowHeight-(windowHeight*.9) && mouseY < (windowHeight-(windowHeight*.9)+22)) {
// fill(50,220,50);
// rect(windowWidth-(windowWidth*.9), windowHeight-(windowHeight*.9),32,25,20);
// fill(255);
// text("on",windowWidth-(windowWidth*.9)+9, windowHeight-(windowHeight*.9)+16);
// }
}
// else {
// background(255);
// fill(220,50,50);
// rect(windowWidth-(windowWidth*.9), windowHeight-(windowHeight*.9),32,25,20);
// fill(255);
// // text("off",windowWidth-(windowWidth*.9)+9, windowHeight-(windowHeight*.9)+16);
// if (mouseX > (windowWidth-(windowWidth*.9)) && mouseX < (windowWidth - (windowWidth*.9) + 30) && mouseY > windowHeight-(windowHeight*.9) && mouseY < (windowHeight-(windowHeight*.9)+22)) {
// fill(220,50,50);
// rect(windowWidth-(windowWidth*.9), windowHeight-(windowHeight*.9),32,25,20);
// fill(0);
// text("off",windowWidth-(windowWidth*.9)+9, windowHeight-(windowHeight*.9)+16);
// }
// }
}
function mouseClicked() {
// clear();
if (mouseX > (windowWidth-(windowWidth*.9)) && mouseX < (windowWidth - (windowWidth*.9) + 30) && mouseY > windowHeight-(windowHeight*.9) && mouseY < (windowHeight-(windowHeight*.9)+22)) {
if (lock === true) {
lock = false;
}
else {
lock = true;
}
}
var br = random(150,255);
var bg = random(150,255);
var bb = random(150,255);
background(br,bg,bb);
shuffle = true;
}
// function draw() {
// if (mouseIsPressed) {
// line(pmouseX, pmouseY, mouseX, mouseY);
// }
// // var vol = mic.getLevel();
// // ellipse(width / 2, height / 2, vol * width);
// }