-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipes.html
94 lines (72 loc) · 2.3 KB
/
pipes.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<style>
canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
<body>
<canvas id="canvas"></canvas>
<script>
const canvas = document.getElementById('canvas') // sets up our canvas a bit
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// let t0 = new Date().getTime();
(function () {
var centerx = ctx.canvas.width / 2;
var centery = ctx.canvas.height / 2;
let a=.1
let b=.1
let count = 1;
let x=centerx
let y=centery
let boop = .1
let bop = 1
setInterval(() => {
bop += 1;
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (let r = 1; r <= 255; r+=8) {
for (let g = 1; g <= 255; g+=8) {
for (let b = 1; b <= 3; b+=8) {
ctx.beginPath();
ctx.moveTo(x, y);
angle = (boop*bop) * count;
x = centerx + (a + b * angle) * Math.cos(angle);
y = centery + (a + b * angle) * Math.sin(2^-2 * angle);
ctx.lineTo(x, y);
ctx.strokeStyle = `RGB(${r},${g},${b})`
ctx.stroke();
ctx.closePath()
if (count > -50) {
count -= .001;
} else {
count += .001;
}
if (count < .73) count = 1
// if (count < .7) count = 10
// if (count < .74) count = 1
// console.log(count)
}
}
}
// console.log(count);
}, 100);
})();
// let t1 = new Date().getTime();
// console.log(t1-t0)
</script>
</body>
</html>