-
Notifications
You must be signed in to change notification settings - Fork 0
/
real.html
59 lines (43 loc) · 1.12 KB
/
real.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
<!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>real</title>
</head>
<body>
<div class="graphic" id="realGraphic"></div>
<div class="buttons">
<h1 id="zoomInButton" onclick="zoomIn()">zoom out</h1>
<h1 id="zoomOutButton" onclick="zoomOut()">zoom in</h1>
</div>
<div class="backButton"><a href="index.html">back</a></div>
<script>
function setup() {
var myCanvas = createCanvas(windowWidth, 0.8 * windowHeight);
myCanvas.parent("realGraphic");
};
var size = 10;
function zoomIn() {
if (size < width) {
size = 2 * size;
}
};
function zoomOut() {
if (size > width/500) {
size = size / 2;
}
};
function draw() {
for (var i = windowWidth / size; i > 0; i--) {
noStroke();
fill(Math.random() * 220);
rect(0, 50, size * i, size);
}
};
</script>
</body>
</html>