-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
54 lines (46 loc) · 1.51 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Innovation Garage</title>
<script src="p5/p5.js"></script> <!-- Reference the local p5.js library -->
<style>
body {
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<script>
let phrase = "Innovation Garage";
let waveOffset = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
textAlign(CENTER, CENTER);
textFont('Courier New', 40);
textStyle(BOLD);
}
function draw() {
background(0);
for (let i = 0; i < phrase.length; i++) {
let letter = phrase[i];
let x = map(i, 0, phrase.length - 1, 50, width - 50);
let y = height / 2 + sin(waveOffset + i * 0.7) * 50;
// Calculate brightness based on mouse distance
let distance = dist(mouseX, mouseY, x, y);
let maxDistance = 500; // Adjust this value for the sensitivity
let brightness = map(distance, 0, maxDistance, 255, 100);
brightness = constrain(brightness, 100, 255);
fill(255, brightness);
text(letter, x, y);
}
waveOffset += 0.05;
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
</script>
</body>
</html>