-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiamond.html
216 lines (210 loc) · 7.06 KB
/
diamond.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Анимированные паттерны РАЗРЕШЕНО К ПУБЛИКАЦИИ 30.11</title>
<style type="text/css">
body {
background: #0d0a15;
font-family: Arial, Helvetica, sans-serif;
}
.buttonStyle {
border-radius: 4px;
border: thin solid #F0E020;
padding: 5px;
background-color: #F8F094;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
font-weight: bold;
color: #663300;
width: 75px;
}
.buttonStyle:hover {
border: thin solid #FFCC00;
background-color: #FCF9D6;
color: #996633;
cursor: pointer;
}
.buttonStyle:active {
border: thin solid #99CC00;
background-color: #F5FFD2;
color: #669900;
cursor: pointer;
}
.style0 {
stop-color: #7b787b;
}
.style1 {
stop-color: #504a50;
stop-opacity: 0;
}
.style10 {
fill: url(#f);
}
.style11 {
fill: url(#e);
}
.style12 {
fill: url(#d);
}
.style13 {
fill: url(#c);
}
.style2 {
stop-color: #7b8085;
}
.style3 {
fill: none;
}
.style4 {
stroke: #4d4d4d;
stroke-width: 1.5;
}
.style5 {
stroke: #333;
}
.style6 {
stroke: #1a1a1a;
stroke-width: 1.5;
}
.style7 {
fill: url(#h);
}
.style8 {
fill: url(#g);
}
.animation1 {
stroke: #666;
stroke-width: 1.5;
fill: none;
stroke-dasharray: 2200;
stroke-dashoffset: 2100;
}
.animation2 {
stroke: #FFF;
stroke-width: 4;
fill: none;
stroke-dasharray: 2200;
stroke-dashoffset: 2100;
}
#masked {
mask: url(#mask1)
}
</style>
</head>
<body>
<div id="mainContent">
<p id="helloText">?</p>
<button id="clickButton1" class="buttonStyle">Slow</button>
<button id="clickButton2" class="buttonStyle">Fast</button>
</div>
<svg id="diamond" xmlns:xlink="http://www.w3.org/1999/xlink" height="605.5" viewBox="0 0 631.67859 605.5138" width="631.7" version="1.1">
<defs>
<linearGradient id="a">
<stop offset="0" class="style0" />
<stop offset="1" class="style1" />
</linearGradient>
<linearGradient id="b">
<stop offset="0" class="style2" />
<stop offset="1" class="style1" />
</linearGradient>
<radialGradient id="h" xlink:href="#b" gradientUnits="userSpaceOnUse" cy="840.1" cx="-151.2" gradientTransform="matrix(0 -.6967 1 -.00001405 -991.3 734.8)" r="213.1" />
<radialGradient id="g" xlink:href="#b" gradientUnits="userSpaceOnUse" cy="840.1" cx="-151.2" gradientTransform="matrix(0 -.6967 1 -.00001405 -1478 248.4)" r="213.1" />
<radialGradient id="f" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="200.8" cx="504.9" gradientTransform="matrix(.02477 -.5553 .9061 .04042 287 439.4)" r="136.3" />
<radialGradient id="e" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="200.8" cx="504.9" gradientTransform="matrix(.02477 -.5553 .9061 .04042 -201.5 925)" r="136.3" />
<radialGradient id="d" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="200.8" cx="504.9" gradientTransform="matrix(.01332 -.2987 .4874 .02174 575.9 311.5)" r="136.3" />
<radialGradient id="c" xlink:href="#a" gradientUnits="userSpaceOnUse" cy="200.8" cx="504.9" gradientTransform="matrix(.01332 -.2987 .4874 .02174 106.7 -171.4)" r="136.3" />
<radialGradient id="j" xlink:href="#i" gradientUnits="userSpaceOnUse" cy="538" cx="123" gradientTransform="matrix(1.6355,-1.2306,0.9848,1.3089,-577.086,-98.6548)" r="371" />
<linearGradient id="i">
<stop id="stop1" offset="0" style="stop-color:#000000;stop-opacity:1;" />
<stop id="stop2" offset="0.53" style="stop-color:#000000;stop-opacity:1" />
<stop id="stop3" offset="1" style="stop-color:#ffffff;stop-opacity:1" />
</linearGradient>
<mask id="mask1" maskUnits="userSpaceOnUse">
<rect id="animatedMask" y="-35.920086" x="-21.823843" height="665.80444" width="742.77606" style="opacity:1;fill:url(#j);fill-opacity:1;stroke:none;stroke-width:1.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</mask>
</defs>
<g id="masked">
<g transform="translate(-20.72 -243.2)">
<g class="style3">
<g class="style4">
<path d="m645.7 544.6-301.8-130.7 79.9-79.4z" />
<path d="m41.77 544.6 302.1-130.7-82-79.4z" />
<path d="m645.7 413.9-113.5-41.2 33-38.2z" />
<path d="m41.77 413.9 112.5-42.65-31.82-36.72z" />
</g>
<g class="style5">
<path d="m41.77 544.6 302.2 302.1 301.8-302.1z" />
<path d="m343.9 846.8 57.6-139.4-57.6-162.9z" />
<path d="m343.9 846.8-58-139.4 58-162.9z" />
</g>
<path d="m41.77 413.9h604v130.7h-604z" class="style6" />
</g>
<rect transform="rotate(-45)" height="426.2" width="426.2" y="415.2" x="-355" class="style7" />
</g>
<g transform="translate(-20.72 -243.2)">
<rect transform="matrix(-.7071 -.7071 -.7071 .7071 0 0)" height="426.2" width="426.2" y="-71.22" x="-841.4" class="style8" />
<path id="line1" d="m 423.75,334.62 141.4,0 -32.98,38.14 -24.84,41.6 138.4,130.3 -244.2,162.8 -57.6,139.4 -58,-139.4 -244.1,-162.8 137,-130.8 -24.57,-42.65 -31.82,-36.72 139.5,0 81.98,79.37 0,240.9 -33.82,33.84" class="animation1" />
<g>
<rect transform="rotate(44.83)" height="79.32" width="297" y="74.34" x="331.9" class="style10" />
<rect transform="matrix(-.7092 .7050 .7050 .7092 0 0)" height="79.32" width="297" y="559.9" x="-156.6" class="style11" />
<rect transform="matrix(.7130 .7012 .7012 -.7130 0 0)" height="42.67" width="159.8" y="115.1" x="600.1" class="style12" />
<rect transform="rotate(135.5)" height="42.67" width="159.8" y="-367.7" x="130.8" class="style13" />
</g>
<path id="line2" d="m 423.75,334.62 141.4,0 -32.98,38.14 -24.84,41.6 138.4,130.3 -244.2,162.8 -57.6,139.4 -58,-139.4 -244.1,-162.8 137,-130.8 -24.57,-42.65 -31.82,-36.72 139.5,0 81.98,79.37 0,240.9 -33.82,33.84" class="animation2" />
</g>
</g>
</svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.3.0/snap.svg-min.js"></script>
<script>
var diamond = Snap("#diamond");
var animation1 = diamond.select("#line1");
var animation2 = diamond.select("#line2");
var animation3 = diamond.select("#j");
var button1 = document.getElementById("clickButton1");
var button2 = document.getElementById("clickButton2");
button1.addEventListener('click', slow, false);
button2.addEventListener('click', fast, false);
function reset() {
animation1.attr('stroke-dashoffset', 2100);
animation2.attr('stroke-dashoffset', 2100);
animation3.attr({
'r': 371,
'cy': 538.0,
'cx': 123
});
}
function slow() {
reset();
animation1.animate({
'stroke-dashoffset': 0
}, 3500, mina.easein);
animation3.animate({
'r': 0,
'cy': 500.0,
'cx': 00
}, 7000, mina.easein);
setTimeout(function() {
animation2.animate({
'stroke-dashoffset': 0
}, 7000, mina.easein);
}, 2000);
}
function fast() {
reset();
animation1.animate({
'stroke-dashoffset': 0
}, 350, mina.easein);
animation3.animate({
'r': 0,
'cy': 500.0,
'cx': 00
}, 700, mina.easein);
setTimeout(function() {
animation2.animate({
'stroke-dashoffset': 0
}, 700, mina.easein);
}, 200);
}
</script>
</body>
</html>