-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
176 lines (159 loc) · 5.05 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Vivus開發svg動畫 - August - Let's Write</title>
<meta property="fb:app_id" content="484081328635964"/>
<meta property="og:url" content="https://letswritetw.github.io/letswrite-vivus/"/>
<meta property="og:type" content="website"/>
<meta property="og:site_name" content="Let's Write"/>
<meta property="og:title" content="開發svg動畫的好套件:Vivus - August - Let's Write"/>
<meta property="og:description" content="開發svg動畫的好套件:Vivus - August - Let's Write"/>
<meta property="og:image" content="https://letswritetw.github.io/letswrite-vivus/fb.jpg"/>
<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="630"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
<style>
.svg {
margin-right: auto;
margin-left: auto;
max-width: 400px;
}
.svg svg {
width: 100%;
height: 100%;
stroke-width: 1;
}
svg, path {
transition: fill .4s ease;
}
.svg svg:not(#fox):not(#giraffe) {
fill: white;
stroke: #008BBF;
}
.fill svg:not(#fox):not(#giraffe) {
fill: #008BBF;
}
#append-fox:not(.fill) #fox path,
#append-giraffe:not(.fill) #giraffe path {
fill: #FFF;
}
.twelve {
margin-bottom: 5vh;
}
</style>
<link rel="shortcut icon" href="https://letswritetw.github.io/letswritetw/dist/img/logo_512.png"/>
<!-- Google Tag Manager-->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PGQ9WQT');
</script>
</head>
<body>
<!-- Google Tag Manager (noscript)-->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PGQ9WQT" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<div class="container">
<div class="twelve columns full-height">
<h1>Vivus svg Demo</h1>
<h6>
使用教學文:
<a href="https://letswrite.tw/vivus-svg/" target="_blank">如何使用vivus.js製作輕量快速svg動畫</a>
</h6>
</div>
<!-- snow -->
<div class="twelve columns">
<h2>snow</h2>
<div id="append-snow" class="svg"></div>
</div>
<!-- tree -->
<div class="twelve columns">
<h2>tree</h2>
<div id="append-tree" class="svg"></div>
</div>
<!-- stag -->
<div class="twelve columns">
<h2>stag</h2>
<div id="append-stag" class="svg"></div>
</div>
<!-- year -->
<div class="twelve columns">
<h2>year</h2>
<div id="append-year" class="svg"></div>
</div>
<!-- fox -->
<div class="twelve columns">
<h2>fox</h2>
<div id="append-fox" class="svg"></div>
</div>
<!-- giraffe -->
<div class="twelve columns">
<h2>giraffe</h2>
<div id="append-giraffe" class="svg"></div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vivus@0.4.4/dist/vivus.min.js"></script>
<script>
new Vivus('append-snow', {
duration: 400,
type: 'delayed',
pathTimingFunction: Vivus.EASE,
file: 'img/snow.svg?v=2'
}, snowCallback);
function snowCallback() {
document.getElementById('append-snow').classList.add('fill');
}
new Vivus('append-tree', {
duration: 200,
type: 'delayed',
pathTimingFunction: Vivus.EASE,
file: 'img/tree.svg'
}, treeCallback);
function treeCallback() {
document.getElementById('append-tree').classList.add('fill');
}
new Vivus('append-stag', {
duration: 500,
type: 'oneByOne',
pathTimingFunction: Vivus.EASE_IN,
file: 'img/stag.svg'
}, stagCallback);
function stagCallback() {
document.getElementById('append-stag').classList.add('fill');
}
new Vivus('append-year', {
duration: 200,
type: 'delayed',
pathTimingFunction: Vivus.EASE_OUT,
file: 'img/year.svg?v=2'
}, yearCallback);
function yearCallback() {
document.getElementById('append-year').classList.add('fill');
}
new Vivus('append-fox', {
duration: 150,
type: 'delayed',
pathTimingFunction: Vivus.EASE_OUT_BOUNCE,
file: 'img/fox.svg'
}, foxCallback);
function foxCallback() {
document.getElementById('append-fox').classList.add('fill');
}
new Vivus('append-giraffe', {
duration: 150,
type: 'oneByOne',
pathTimingFunction: Vivus.EASE_OUT,
file: 'img/giraffe.svg'
}, giraffeCallback);
function giraffeCallback() {
document.getElementById('append-giraffe').classList.add('fill');
}
</script>
</body>
</html>