-
Notifications
You must be signed in to change notification settings - Fork 4
/
demo2.html
146 lines (116 loc) · 4.63 KB
/
demo2.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
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>CodePen - DrawSVGPlugin (All SVG Shape Types)</title>
<style>
body{
background-color:#24303A;
overflow:hidden;
}
svg{
opacity:1;
}
</style>
</head>
<body translate="no" >
<div id="container">
<!-- Generator: Adobe Illustrator 18.1.0, SVG Export Plug-In -->
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="741px" height="450px" viewBox="0 0 741 450" enable-background="new 0 0 741 450"
xml:space="preserve">
<defs>
</defs>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="77" y1="11" x2="10" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="171" y1="11" x2="77" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="238" y1="11" x2="171" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="292" y1="11" x2="238" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="367" y1="11" x2="292" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="466" y1="11" x2="367" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="512" y1="11" x2="466" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="588" y1="11" x2="511" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="645" y1="11" x2="588" y2="11"/>
<line fill="none" stroke="#4AC900" stroke-width="4" stroke-miterlimit="10" x1="731" y1="11" x2="645" y2="11"/>
<g>
<circle fill="#FF8300" cx="10.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="77.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="171.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="238.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="292.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="367.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="466.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="510.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="588.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="645.5" cy="10.5" r="10.5"/>
<circle fill="#FF8300" cx="730.5" cy="10.5" r="10.5"/>
</g>
<path id="graph-measurement" fill="none" stroke="#741E00" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
M731,127H10 M10,127v-18 M113,127v-9.1 M731,109v18 M216,127v-9.1 M319,127v-9.1 M422,127v-9.1 M525,127v-9.1 M628,127v-9.1"/>
</svg>
</div>
<script src='js/TweenMax.min.js'></script>
<script src='js/DrawSVGPlugin.min.js'></script>
<script src='js/jquery.min.js'></script>
<script>
var container = document.getElementById('container');
var graphMeasurement = document.getElementById('graph-measurement');
var allCircles = document.getElementsByTagName('circle');
var allLines = document.getElementsByTagName('line');
//console.log(topSVGNode)
TweenMax.set(container, {
position:'absolute',
xPercent:-50,
left:'50%',
top:'50%',
yPercent:-50,
backgroundColor:'rgba(30,39,38,0.3)',
borderRadius:10,
padding:40
})
var destArray = [15,52,28,170,105,93,44, 122, 179, 170, 220];
TweenMax.set(allCircles, {attr:{fill:'#954CE9', r:5},transformOrigin:'50% 50%',scale:0})
TweenMax.set([allLines], {attr:{stroke:'#18B5DD'},drawSVG:'100% 100%',strokeWidth:2})
TweenMax.set([graphMeasurement], {attr:{stroke:'#18B5DD'},drawSVG:'100% 100%',strokeWidth:2})
TweenMax.set([allCircles, allLines], {y:'+=300'})
TweenMax.set(graphMeasurement, {y:'+=280',alpha:0.3})
TweenMax.to(graphMeasurement,3, {drawSVG:'0% 100%',ease:Power2.easeInOut})
TweenMax.set('svg', {alpha:1})
for(var i = 0; i < allCircles.length; i++){
TweenMax.to(allCircles[i], 2, {
attr:{cy:'-=' + destArray[i]},
onUpdate:moveLines,
onUpdateParams:[i],
delay:i/5,
ease:Power4.easeInOut
})
if(allLines[i]){
TweenMax.to(allLines[i], 1, {
drawSVG:'400',
delay:i/5,
ease:Power4.easeInOut
})
}
TweenMax.to(allCircles[i], 1, {
scale:1,
delay:i/5,
ease:Power4.easeInOut
})
}
function moveLines(i){
if(allLines[i]){
TweenMax.set(allLines[i], {
attr:{
'x2':allCircles[i].getAttribute('cx'), 'y2':allCircles[i].getAttribute('cy')
}
})
TweenMax.set(allLines[i], {
attr:{
'x1':allCircles[i+1].getAttribute('cx'), 'y1':allCircles[i+1].getAttribute('cy')
}
})
}
}
</script>
</body>
</html>