/
index.html
45 lines (42 loc) · 1.19 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Lottie実装編 | lottie-interactivity(cursor)</title>
<style>
body {
display: grid;
place-content: center;
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
<!-- ▼lottie-player用 -->
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<!-- ▼lottie-interactivity用 -->
<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></script>
</head>
<body>
<p>▼カーソルを動かしてください</p>
<lottie-player
id="lottie"
src="https://lottie.host/2dc80a15-d7f9-49d4-9be0-3d3450b826e6/0JAw6NYf0o.json"
></lottie-player>
<script>
// カーソルの位置と連動するアニメーションの作例
LottieInteractivity.create({
player: "#lottie", // lottie-playerに追加したid
mode: "cursor", // カーソルモード
actions: [
{
position: { x: [0, 1], y: [0, 1] },
type: "seek",
frames: [0, 217],
},
],
});
</script>
</body>
</html>