/
index.html
30 lines (30 loc) · 887 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>web-component-number-animation</title>
<style>
main {
line-height: 70vh;
font-size: 70px;
text-align: center;
}
</style>
</head>
<body>
<button>change number</button>
<main>
<number-animation to="12345.6789" />
</main>
<script type="module">
import { NumberAnimation } from '/src/index.ts';
customElements.define('number-animation', NumberAnimation);
let start = 12345.6789;
document.querySelector('button').addEventListener('click', () => {
document.querySelector('number-animation').setAttribute('to', (start += 1000));
});
</script>
</body>
</html>