-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
73 lines (63 loc) · 1.56 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
function setup() {
createCanvas(windowWidth,windowHeight);
background(0);
textSize(60);
colorMode(HSB);
//strokeWeight(4); // line width
//stroke(51); // line color grayscale (one number)
noStroke();
}
// setTimeout(() => {
// var i;
// for (i = 0; i < 100; i++) {
// fill(211,122,32,100-i);
// text("Press space for fullscreen.", 100, 200);
// }, 2000);
// }
// event = keyup or keydown
document.addEventListener('keyup', event => {
if (event.code === 'Space') {
console.log('Space pressed')
// Set the value of fullscreen
// into the variable
let fs = fullscreen();
// Call to fullscreen function
fullscreen(!fs);
}
})
// function keyPressed() {
// if (keyCode === SPACE) {
// // Set the value of fullscreen
// // into the variable
// let fs = fullscreen();
// // Call to fullscreen function
// fullscreen(!fs);
// }
// }
// function mousePressed() {
// // Set the value of fullscreen
// // into the variable
// let fs = fullscreen();
// // Call to fullscreen function
// fullscreen(!fs);
// }
// function windowResized() {
// resizeCanvas(windowWidth, windowHeight);
// }
function draw() {
const radius = 80;
if (mouseIsPressed) {
fill(mouseX/windowWidth*255,255,255);
} else {
fill(255-mouseX/windowWidth*255,255,255);
}
if (
mouseX > radius &&
mouseX < windowWidth-radius &&
mouseY > radius &&
mouseY < windowHeight-radius
) {
ellipse(mouseX, mouseY, radius, radius);
}
console.log(mouseX);
}