-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
33 lines (31 loc) · 914 Bytes
/
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Preview</title>
</head>
<body>
<script src="./dist/cm.umd.min.js" type="text/javascript"></script>
<script>
const app = cm.app({
width: 640,
height: 640,
});
app
.data(cm.range(240))
.process(cm.map, (_, i, data) => (i * Math.PI * 2) / data.length)
.append(cm.circle, {
x: (t) => Math.cos(t) * Math.cos(t * 3),
y: (t) => Math.sin(t) * Math.cos(t * 3),
r: (_, i) => i,
})
.transform(cm.mapAttrs, {
x: { range: [15, app.prop("width") - 30] },
y: { range: [15, app.prop("height") - 30] },
r: { range: [1, 15] },
});
document.body.appendChild(app.render().node());
</script>
</body>
</html>