<div class="container shadow start">
<div class="jump">x</div>
<div>o</div>
<div class="jump">x</div>
<div>o</div>
</div>
<div class="container shadow end">
<div>o</div>
<div class="jump">x</div>
<div class="jump">x</div>
<div>o</div>
</div>
<div class="container">
<div class="item">jump-start</div>
<div class="item">jump-end</div>
<div class="item">jump-both</div>
<div class="item">jump-none</div>
</div>
// Init~ Don't touch here!
$color: #121212;
body {
padding: 20px;
background-color: #121212;
font-family: 'NanumSquareRound',sans-serif;
color: $color;
}
.container {
// border: 10px solid rgba(black, .1);
border-radius: 10px;
display: grid;
gap: 10px;
}
.item {
width: 200px;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
padding: 0 20px;
box-sizing: border-box;
position: relative;
font-size: 16px;
color: $color;
font-weight: 900;
text-shadow: 3px 0 0 rgba(white, .3);
cursor: pointer;
&:hover {
filter: brightness(130%);
}
&::before {
content: "";
position: absolute;
top: 5px;
left: 5px;
border: 4px solid $color;
border-radius: 10px;
box-sizing: border-box;
width: calc(100% - 10px);
height: calc(100% - 10px);
z-index: -1;
}
$colors: (tomato, orange, limegreen, dodgerblue, hotpink, darkgray, crimson, orangered, lawngreen, aqua, royalblue, wheat, brown, gray, salmon, deeppink, gold, springgreen, slateblue, darkslategray);
@each $color in $colors {
$index: index($colors, $color);
&:nth-child(#{$index})::before {
background-color: rgba($color, .8);
}
}
&::after {
content: "";
width: 10px;
height: 50%;
background: white;
position: absolute;
top: 16px;
left: 16px;
border-radius: 100px;
opacity: .3;
z-index: -1;
}
}
$distance: 500px;
.container.shadow {
grid-template-columns: 150px;
grid-template-rows: repeat(4, 60px);
position: absolute;
div {
border: 4px solid #333;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
font-size: 20px;
font-weight: 700;
color: #555;
&.jump {
opacity: .3;
}
}
}
.container.shadow.end {
transform: translateX($distance);
}
// Test here!
.container {}
.item {
width: 150px;
animation-name: heropy;
animation-duration: 3s;
animation-iteration-count: infinite;
}
.item:nth-child(1) { animation-timing-function: steps(5, jump-start); }
.item:nth-child(2) { animation-timing-function: steps(5, jump-end); }
.item:nth-child(3) { animation-timing-function: steps(5, jump-both); }
.item:nth-child(4) { animation-timing-function: steps(5, jump-none); }
@keyframes heropy {
0% { transform: translateX(0px); }
100% { transform: translateX($distance); }
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.