-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
259 lines (227 loc) · 9.3 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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><style>@import url("styles.css");
:root {
--prespective: 1000px;
--originVertical: 0%;
--originHorizontal: 100%;
}
*,
*::before,
*::after {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #eee;
color: #333;
min-height: 100vh;
}
.centering {
margin: 20px auto;
display: flex;
justify-content: center;
align-items: center;
}
body > h2 {
display: block;
width: 275px;
padding: 10px;
text-align: center;
margin: 20px auto;
font-size: 24px;
font-weight: bold;
color: #fff;
border-radius: 10px;
background-color: hotpink;
}
a {
text-decoration: none;
}
.outer {
display: grid;
grid-template-columns: 1em 275px 1em;
grid-gap: 1em;
}
.container {
width: 275px;
height: 300px;
border: 2px solid white;
border-radius: 4px;
display: flex;
justify-content: center;
align-items: center;
pointer-events: none;
-webkit-perspective: var(--prespective);
perspective: var(--prespective);
-webkit-perspective-origin: var(--originHorizontal)
var(--originVertical);
perspective-origin: var(--originHorizontal) var(--originVertical);
}
.cube {
position: relative;
width: 200px;
height: 200px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.cube.animated {
-webkit-animation: cubeRotate 10s linear infinite;
animation: cubeRotate 10s linear infinite;
}
@-webkit-keyframes cubeRotate {
from {
-webkit-transform: rotateY(0deg) rotateX(720deg) rotateZ(0deg);
transform: rotateY(0deg) rotateX(720deg) rotateZ(0deg);
}
to {
-webkit-transform: rotateY(360deg) rotateX(0deg) rotateZ(360deg);
transform: rotateY(360deg) rotateX(0deg) rotateZ(360deg);
}
}
@keyframes cubeRotate {
from {
-webkit-transform: rotateY(0deg) rotateX(720deg) rotateZ(0deg);
transform: rotateY(0deg) rotateX(720deg) rotateZ(0deg);
}
to {
-webkit-transform: rotateY(360deg) rotateX(0deg) rotateZ(360deg);
transform: rotateY(360deg) rotateX(0deg) rotateZ(360deg);
}
}
.side {
display: flex;
font-size: 100px;
color: #fff;
font-weight: bold;
justify-content: center;
align-items: center;
position: absolute;
width: 100%;
height: 100%;
border: 2px solid white;
}
.front {
background-color: hsla(100, 100%, 50%, 0.8);
-webkit-transform: translateZ(100px);
transform: translateZ(100px);
}
.back {
background-color: blue;
opacity: 0.8;
-webkit-transform: translateZ(-100px);
transform: translateZ(-100px);
}
.left {
background-color: #04aa6d;
opacity: 0.8;
-webkit-transform: rotateY(-90deg) translateZ(100px);
transform: rotateY(-90deg) translateZ(100px);
}
.right {
background-color: hsla(220, 100%, 50%, 0.8);
-webkit-transform: rotateY(90deg) translateZ(100px);
transform: rotateY(90deg) translateZ(100px);
}
.top {
background-color: #00bfa5;
opacity: 0.5;
-webkit-transform: rotateX(90deg) translateZ(100px);
transform: rotateX(90deg) translateZ(100px);
}
.bottom {
background-color: #7d53cc !important;
opacity: 0.8;
-webkit-transform: rotateX(-90deg) translateZ(100px);
transform: rotateX(-90deg) translateZ(100px);
}
.vertical {
width: 2em;
height: 300px;
-webkit-appearance: slider-vertical;
appearance: slider-vertical;
}
.horizontal {
width: 275px;
}
.hidden {
position: fixed;
top: -10000px;
left: -10000px;
visibility: hidden;
}
.labels {
grid-column: 1 / -1;
}
label.usePerspective,
label.runAnimation {
text-align: center;
padding: 0.5em 1em;
border: 1px solid #777;
border-radius: 4px;
}
label.usePerspective + label {
margin-left: 1em;
}
.slider1 {
position: relative;
}
.slider1::after {
content: "Change shape";
width: 300px;
text-align: center;
position: absolute;
left: 0;
bottom: 50%;
font-size: 1em;
opacity: 0.25;
-webkit-transform: translateX(-50%) rotate(-90deg);
transform: translateX(-50%) rotate(-90deg);
-webkit-transform-origin: bottom;
transform-origin: bottom;
}
.slider2 {
position: relative;
}
.slider2::after {
content: "Move vertically";
width: 300px;
text-align: center;
position: absolute;
right: 0;
bottom: 50%;
font-size: 1em;
opacity: 0.25;
-webkit-transform: translateX(50%) rotate(-90deg);
transform: translateX(50%) rotate(-90deg);
-webkit-transform-origin: top;
transform-origin: top;
}
.slider3 {
grid-column: 2 / 3;
position: relative;
}
.slider3::after {
content: "Move horizontally";
width: 300px;
text-align: center;
position: absolute;
right: 0;
top: 100%;
opacity: 0.25;
font-size: 1em;
-webkit-transform-origin: bottom;
transform-origin: bottom;
}
#usePerspective:checked ~ div label.usePerspective {
background-color: greenyellow;
}
#usePerspective:checked ~ *::after {
opacity: 1;
}
#runAnimation ~ div label.runAnimation {
background-color: greenyellow;
}
#runAnimation:checked ~ div label.runAnimation {
background-color: #eee;
}</style><script defer="defer" src="/static/js/main.664f546f.js"></script><link href="/static/css/main.e6c13ad2.css" rel="stylesheet"/><script defer="defer" src="/static/js/main.664f546f.js"></script><link href="/static/css/main.e6c13ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><h2 id="first">Play With Cube</h2><div class="centering"><div class="outer"><input type="checkbox" id="usePerspective" class="hidden" onchange="setActive(this)" checked="checked"/> <input type="checkbox" id="runAnimation" class="hidden" onchange="setAnimation(this)" checked="checked"/><div class="labels"><label for="usePerspective" class="usePerspective">See in 3D</label> <label for="runAnimation" class="runAnimation">Stop motion</label></div><div class="slider1"><input type="range" class="vertical" data-var="prespective" data-unit="px" min="250" max="1550" value="900" oninput="setCssVariables(this)"/></div><div class="container"><div class="cube"><div class="side front">1</div><div class="side left">2</div><div class="side right">3</div><div class="side back">4</div><div class="side top">5</div><div class="side bottom">6</div></div></div><div class="slider2"><input type="range" class="vertical" data-var="originVertical" data-unit="%" min="-100" max="100" value="0" oninput="setCssVariables(this)"/></div><div class="slider3"><input type="range" class="horizontal" data-var="originHorizontal" data-unit="%" min="-100" max="100" value="0" oninput="setCssVariables(this)"/></div></div></div><div class="social"><a href="https://www.facebook.com/profile.php?id=100091800483034&mibextid=ZbWKwL" title="Facebook Profile" target="_blank"><div class="facebook"></div></a><a href="https://www.linkedin.com/in/farhan7reza" title="Linkedin Profile" target="_blank"><div class="linkedin"></div></a><a href="https://instagram.com/farhan7reza?igshid=ZGUzMzM3NWJiOQ==" title="Instagram Profile" target="_blank"><div class="instagram"></div></a><a href="https://twitter.com/farhan7reza?t=M5CoKx94aDt8Fzc4LEyWDA&s=09" title="Twitter Profile" target="_blank"><div class="twitter"></div></a></div><script type="text/javascript">function setCssVariables(e){document.documentElement.style.setProperty(`--${e.dataset.var}`,e.value+e.dataset.unit)}function setActive(e){document.querySelectorAll('input[type="range"]').forEach((t=>{t.disabled=!e.checked})),document.documentElement.style.setProperty("--prespective",e.checked?document.querySelector(".slider1 > input").value+"px":"none")}function setAnimation(e){e.checked?document.querySelector(".cube").classList.add("animated"):document.querySelector(".cube").classList.remove("animated")}var obj=document.getElementById("runAnimation");setAnimation(obj)</script></body></html>