-
Notifications
You must be signed in to change notification settings - Fork 0
/
logo.scss
95 lines (80 loc) · 1.67 KB
/
logo.scss
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
$size: 4px;
$width: 5 * $size;
$colors: #ddd, #bbb, #ddd, #fff, #bbb, #fff;
@function pow($number, $exponent) {
$value: 1;
@if $exponent > 0 {
@for $i from 1 through $exponent {
$value: $value * $number;
}
} @else if $exponent < 0 {
@for $i from 1 through -$exponent {
$value: $value / $number;
}
}
@return $value;
}
.logo-container {
height: 180px;
width: 180px;
perspective: 5000px;
& * {
position: absolute;
top: 50%;
left: 50%;
transform-style: preserve-3d;
}
&:hover .rotate {
transform: rotateY(325deg);
}
}
@mixin box($width, $height) {
.face {
position: absolute;
margin: (-0.5 * $height) (-0.5 * $width);
width: $width;
height: $height;
}
.face:nth-child(n + 5) {
margin-top: -0.5 * $width;
height: $width;
}
@for $i from 0 to 6 {
.face:nth-child(#{$i + 1}) {
transform: if($i < 4, rotateY($i * 90deg), rotateX(pow(-1, $i) * 90deg))
translateZ(0.5 * if($i < 4, $width, $height));
background: nth($colors, $i + 1);
}
}
}
@keyframes rotate {
0% {
transform: rotateY(90deg);
}
100% {
transform: rotateY(0deg);
}
}
.logo {
transform: rotateZ(45deg);
}
.rotate {
animation: rotate 1s ease-out;
transition: transform 800ms ease;
}
.top {
transform: rotateZ(90deg) translate(-10 * $size, 5 * $size);
@include box($width, 12 * $size);
}
.bottom {
transform: rotateZ(90deg) translate3d(10 * $size, -5 * $size, 0);
@include box($width, 12 * $size);
}
.middle {
transform: rotateZ(90deg);
@include box($width, 22 * $size);
}
.side {
transform: translate3d(8.5 * $size, 5 * $size, 0);
@include box($width, 6 * $size);
}