folk-canvas/website/[tests]many-shapes.html

53 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Perf</title>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
position: relative;
margin: 0;
}
folk-shape {
border: 2px solid black;
}
</style>
</head>
<body>
<script type="module">
import '../lib/standalone/folk-shape.ts';
const geometries = [];
const now = performance.now();
for (let i = 0; i < 100; i++) {
for (let j = 0; j < 100; j++) {
const geo = document.createElement('folk-shape');
geo.x = 50 * i;
geo.y = 50 * j;
geo.width = geo.height = 45;
geometries.push(geo);
document.body.append(geo);
}
}
console.log(performance.now() - now);
setTimeout(() => {
const now = performance.now();
for (const geometry of geometries) {
geometry.x += 50;
// geometry.rotate += 45;
}
console.log(performance.now() - now);
}, 1000);
</script>
</body>
</html>