-
Notifications
You must be signed in to change notification settings - Fork 0
/
or.html
65 lines (50 loc) · 1.41 KB
/
or.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
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="images/icon.ico">
<script src="p5/p5.js"></script>
<title>or</title>
</head>
<body>
<div class="graphic" id="orGraphic"></div>
<div class="pageButton">
<h1 id="bothButton" onclick="changeBackground()">both</h1>
</div>
<div class="backButton"><a href="index.html">back</a></div>
<script>
function setup() {
var myCanvas = createCanvas(windowWidth, 0.8 * windowHeight, WEBGL);
myCanvas.parent("orGraphic");
}
var backgroundQ = true;
function changeBackground() {
backgroundQ = !backgroundQ;
if (backgroundQ) {
document.getElementById("bothButton").style.color = "black"
} else {
document.getElementById("bothButton").style.color = "tomato"
}
}
function draw() {
if (backgroundQ) {background("white")};
rotateY(frameCount * 0.01);
for (let i = 0; i < 2; i++) {
translate(
floor(cos(frameCount * 0.001)) * 100,
sin(frameCount * 0.001) * 100,
i * 0.1
);
rotateX(frameCount * 0.002);
push();
stroke(23, 25, 95, 80);
fill(23, 25, 95, 100);
circle(8, 6, 200);
pop();
}
}
</script>
</body>
</html>