-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.html
46 lines (46 loc) · 1.33 KB
/
test.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
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.svg {
width: 400px;
}
</style>
</head>
<body>
<div class="container">
<div class="svg hide" id="svg"></div>
<button>boom blast</button>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/5.8.1/lottie.min.js"
integrity="sha512-V1YyTKZJrzJNhcKthpNAaohFXBnu5K9j7Qiz6gv1knFuf13TW/3vpgVVhJu9fvbdW8lb5J6czIhD4fWK2iHKXA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script>
const play = document.querySelector("button");
const svgContainer = document.querySelector("#svg");
const animItem = bodymovin.loadAnimation({
wrapper: svgContainer,
animType: "svg",
loop: false,
autoplay: false,
path: "https://assets3.lottiefiles.com/datafiles/U1I3rWEyksM9cCH/data.json",
});
play.addEventListener("click", () => {
animItem.goToAndPlay(0, true);
});
</script>
</body>
</html>