-
Notifications
You must be signed in to change notification settings - Fork 214
/
visual-studio-code-snippet.json
45 lines (43 loc) · 1.17 KB
/
visual-studio-code-snippet.json
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
"Animated icon": {
"prefix": "anic",
"body": [ "<!--${1:id} animated icon begins-->",
"<div id='icons8-${1:id}' class='bodymovin'></div>",
"",
"<script>",
"",
" (function() {",
" var anime;",
" var state = 0;",
" var name = '${1:id}';",
"",
" function start() {",
" if (state % 2 == 0) {",
" // All animations have 28 frames:",
" // - First 14 ones for changing the satate",
" // - And the next 14 back to return to the original state",
" anim.playSegments([0, 13], true);",
" } else {",
" anim.playSegments([14, 27], true);",
" }",
" state++;",
" }",
"",
" $(document).ready(function () {",
" // Feel free to handle any other events here, not just click or hover",
" $('#icons8-'+name).click(start);",
" $('#icons8-'+name).hover(start);",
"",
" anim = bodymovin.loadAnimation({",
" container: document.getElementById('icons8-'+name),",
" renderer: 'svg',",
" loop: false,",
" autoplay: false,",
" path: 'icons/'+name+'.json'",
" });",
" });",
" })();",
"",
"</script>",
"<!--${1:id} animated icon ends-->"]
}
}