-
Notifications
You must be signed in to change notification settings - Fork 0
/
sketch.js
82 lines (66 loc) · 1.42 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
let w, h;
let walls = [];
let particle;
let ray;
// Perlin noise movement
let xoff = 0;
let yoff = 1000;
let fontOpacity;
let fontSize;
let isActive;
let currentFrame;
function setup() {
w = windowWidth;
h = windowHeight;
createCanvas(w, h);
particle = new Particle();
// Boundary.randomWalls(5);
Boundary.pentagon();
// Boundary.showWalls();
fontOpacity = 0;
fontSize = w * 0.018;
isActive = false;
currentFrame = 0;
}
function draw() {
background(30);
// Walls
for (let wall of walls) {
wall.show();
}
// Dot
particle.update(mouseX, mouseY);
// particle.update(noise(xoff) * width, noise(yoff) * height);
particle.show(walls);
xoff += 0.001;
yoff += 0.001;
// Instructions when under mouse control
// let limit = 40;
// if (!isActive && frameCount <= currentFrame + limit) {
// if (fontSize < w * 0.02) {
// fontSize += w * 0.0001;
// }
// fontOpacity += 15;
// } else if (isActive && frameCount > currentFrame + limit) {
// fontOpacity -= 15;
// if (fontSize < w * 0.023) {
// fontSize += 0.06;
// }
// }
// fill(255, fontOpacity);
// textSize(fontSize);
// textAlign(CENTER, CENTER);
// text("Move the mouse", w / 2, h / 2);
}
function windowResized() {
w = windowWidth;
h = windowHeight;
resizeCanvas(w, h);
}
function mouseMoved() {
if (!isActive) {
currentFrame = frameCount;
isActive = true;
}
return false;
}