-
Notifications
You must be signed in to change notification settings - Fork 0
/
3dcard.htm
152 lines (121 loc) · 3.28 KB
/
3dcard.htm
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script>
let root = document.documentElement
let height = window.innerHeight
let width = window.innerWidth
ratio = width / height
root.style.setProperty('--ratio',ratio)
window.addEventListener('resize', handleResize)
function handleResize(){
window.location.reload()
}
</script>
<style>
:root {
--width: 90vw;
--height:90vh;
}
body{
height: 100vh;
border:2px solid red
}
.scene{
margin:50px auto;
width: var(--width);
height: var(--height);
perspective: 500vw;
/* perspective-origin: 100% 100; */
}
.showcase{
height: 100%;
position: relative;
transform-style: preserve-3d;
animation-name: frappeCubeAnimation;
animation-duration: 15s;
animation-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1);
animation-iteration-count: infinite;
}
.showcase div{
position: absolute;
height: var(--height);
width:var(--width);
}
.showcase div:nth-child(1){
background-color: red;
transform:translateZ( calc(var(--width) / 2) );
}
.showcase div:nth-child(2){
background-color: royalblue;
transform:rotateY(90deg) translateZ( calc(var(--width) / 2))
}
.showcase div:nth-child(3){
background-image: url('1.JPG');
background-position:top;
background-size: cover;
background-repeat: no-repeat;
transform:rotateY(-90deg) translateZ( calc(var(--width) / 2))
}
.showcase div:nth-child(4){
background-color: rgb(168, 54, 73) ;
transform:rotateY(180deg) translateZ( calc(var(--width) / 2))
}
.showcase div:nth-child(5){
background-color: rgb(159, 197, 202) ;
transform:rotateX(90deg) translateZ(calc( var(--height) / 2)) scaleY( var(--ratio));
}
.showcase div:nth-child(6){
background-color: rgb(3, 21, 24) ;
transform:rotateX(-90deg) translateZ(calc( var(--height) / 2)) scaleY( var(--ratio));
}
@keyframes frappeCubeAnimation {
0%{
transform: rotate(0);
}
15%{
transform: rotateY(-90deg) translateX( calc(-1 * var(--width) / 2 ));
}
30%{
transform: rotateY(180deg);
}
45%{
transform: rotateY(90deg);
}
60%{
transform: rotateX(90deg);
}
90%{
transform:rotateX(-90deg);
}
}
.show-right{
animation:show-right 3s linear ;
animation-fill-mode: forwards
}
@keyframes show-right {
from{
transform: rotate(0);
}
to{
transform: rotateY(-90deg);
}
}
</style>
<body>
<div class = "scene">
<div class="showcase">
<div class="front"></div>
<div class="right"></div>
<div class="left"></div>
<div class="back"></div>
<div class="top"></div>
<div class="bottom"></div>
</div>
</div>
</body>
</html>