-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.scss
More file actions
100 lines (87 loc) · 1.87 KB
/
styles.scss
File metadata and controls
100 lines (87 loc) · 1.87 KB
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
.chess {
$parentRef: &;
// default values, overridden by react component
--box-size: 60px;
--x-size: 6;
--y-size: 6;
--knight-x: 3;
--knight-y: 3;
--step-at: 0.2s;
display: flex;
flex-shrink: 0;
width: calc(var(--box-size) * var(--x-size));
height: calc(var(--box-size) * var(--y-size));
@mixin isMoving {
#{$parentRef}.s--moving & {
@content;
}
}
@keyframes fadeInKnight {
to {
opacity: 0.5;
}
}
&__knight {
position: absolute;
left: 0;
top: 0;
width: var(--box-size);
height: var(--box-size);
will-change: transform, opacity;
transition: transform var(--step-at), opacity 0.3s;
transform: translate(
calc(var(--knight-x) * var(--box-size)),
calc(var(--knight-y) * var(--box-size))
);
opacity: 0;
animation: fadeInKnight 1s 0.5s forwards;
@include isMoving {
opacity: 1;
}
}
&__box {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: var(--box-size);
height: var(--box-size);
// border: 1px solid #333;
font-size: 20px;
@keyframes fadeIn {
to {
opacity: 1;
}
}
p {
opacity: 0;
will-change: opacity;
animation: fadeIn var(--step-at) calc(var(--step-at) * calc(var(--move-index) + 1)) forwards;
}
}
@keyframes animateBorder {
to {
transform: scale(1, 1);
}
}
&__line {
position: absolute;
background: #333;
will-change: transform;
animation: animateBorder 1s calc(0.2s + var(--delay, 0) * 0.2s) forwards;
&--x {
left: 0;
top: calc(var(--y, 0) * var(--box-size));
width: 100%;
height: 1px;
transform: scale(0, 1);
}
&--y {
left: calc(var(--x, 0) * var(--box-size));
top: 0;
width: 1px;
height: 100%;
transform: scale(1, 0);
}
}
}