-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
60 lines (39 loc) · 1.09 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
let font;
let tilesX = 50;
let tilesY = 50;
let xoff = 0;
let oscillator = 0;
let pg;
function preload() {
font = loadFont("/assets/Maax Mono - Bold Italic-205TF.otf");
}
function setup() {
createCanvas(windowWidth, windowHeight);
pg = createGraphics(width, height);
pg.textFont(font);
pg.textAlign(CENTER, CENTER);
pg.textSize(width);
pg.fill(255);
pg.text('↖', pg.width / 2, pg.height / 2);
}
function draw() {
background(0);
let tileW = floor(width / tilesX);
let tileH = floor(height / tilesY);
oscillator = floor(sin(frameCount * 0.05) * 100);
for (let y = 0; y < tilesY; y++) {
for (let x = 0; x < tilesX; x++) {
let nX = noise(xoff + x * 0.1) * oscillator;
let nY = noise(xoff + y * 0.1) * oscillator;
let posX = x * tileW + nX;
let posY = y * tileH + nY;
copy(pg, 0, 0, pg.width, pg.height, posX, posY, tileW, tileH);
fill("white")
stroke(0);
strokeWeight(3);
textSize(64)
text("↗", posX - dist(posX, posY, mouseX, mouseY), posY + dist(posX, posY, mouseX, mouseY))
}
}
xoff += 0.0002;
}