-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (48 loc) · 1.14 KB
/
index.html
File metadata and controls
62 lines (48 loc) · 1.14 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>add title here</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #fb0813;
height: 100dvh;
}
#root {
height: 100%;
}
</style>
</head>
<body>
<div id="root"></div>
<script type="module">
import { Context2D } from './index.js';
const draw = ({ ctx, w, h, oscillate, memoize }) => {
// draw circle in the center of the screen
ctx.beginPath()
const ox = oscillate({
from: -100,
to: 100,
speed: 2,
})
const oy = oscillate({
from: -100,
to: 100,
speed: 1,
})
// draw a circle
ctx.arc(w / 2 + ox, h / 2 - oy, 100, 0, Math.PI * 2, false)
// fill the circle with a color
ctx.fillStyle = 'white'
ctx.fill()
}
const context2d = new Context2D({
rootElement: 'root',
})
context2d.draw(draw)
</script>
</body>
</html>