-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimate_on_click.html
More file actions
42 lines (42 loc) · 2.11 KB
/
animate_on_click.html
File metadata and controls
42 lines (42 loc) · 2.11 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Animate in loop</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie_svg.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="dialog-gray-mark" :class="{'fade-enter-mark':isShowDialogMark, 'fade-leave-mark':!isShowDialogMark}" v-show="isShowDialogMark" @click="hideDialog()"></div>
<div class="dialog-box">
<div class="dialog-header">
<div class="center-cont">
<div class="title">Animate on click</div>
</div>
</div>
<div class="demo-wrap">
<span class="icon" id="lottie-demo"></span>
<span class="infomation">Animate an animation on each click.</br>
playSegments(segments, forceFlag)</br>
Segments: array. Can contain 2 numeric values that will be used as first and last frame of the animation. Or can contain a sequence of arrays each with 2 numeric values.</br>
ForceFlag: boolean. If set to false, it will wait until the current segment is complete. If true, it will update values immediately.</span>
<span class="desc">Made by <a href="https://www.mingcute.com/animation" target="_blank">MingCute.com</a></span>
</div>
</div>
</body>
<script>
(function() {
let svgContainer = document.querySelector('#lottie-demo');
let animItem = lottie.loadAnimation({
wrapper: svgContainer,
animType: 'svg',
loop: false,
autoplay: false,
path: "https://raw.githubusercontent.com/Richard9394/MingCute-animation/main/json/arrow_down_line.json"
});
svgContainer.addEventListener('click', function() {
animItem.playSegments([0,100], true);
});
})();
</script>
</html>