-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.html
More file actions
63 lines (52 loc) · 1.86 KB
/
index.html
File metadata and controls
63 lines (52 loc) · 1.86 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
63
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Next2D - BlendMode Test</title>
<script defer type="module" src="./src/index.ts"></script>
</head>
<body style="margin: 0; padding: 0; background: #333333;">
<script>
window.addEventListener("DOMContentLoaded", async () =>
{
await next2d.load("develop");
return ;
const count = 8000;
const root = next2d
.createRootMovieClip(1000, 416, 60)
.then((root) =>
{
const { Shape } = next2d.display;
const rects = [];
for (let i = 0; i < count; i++) {
const x = Math.random() * 1000;
const y = Math.random() * 416;
const size = 10 + Math.random() * 40;
const speed = 1 + Math.random();
var rect = new Shape();
rect
.graphics
.beginFill("#fff")
.lineStyle(1, "#000")
.drawRect(0, 0, size, size);
rect.x = x;
rect.y = y;
root.addChild(rect);
rects.push({ size, speed, el: rect });
}
root.addEventListener("enterFrame", () =>
{
for (let i = 0; i < count; i++) {
const rect = rects[i];
if (rect.el.x + rect.size < 0) {
rect.el.x = 1000 + rect.size / 2;
}
rect.el.x -= rect.speed;
}
});
});
});
</script>
</body>
</html>