codepens/bouncing-bunnies-animation-.../dist/style.css

104 lines
2.8 KiB
CSS
Raw Normal View History

2023-10-06 23:12:53 +02:00
* {
box-sizing: border-box;
}
:root {
--delay: 0;
--duration: 1;
--stagger-step: 0;
--coefficient: 1;
--offset: 0;
}
body {
background: linear-gradient(-45deg, #593, #a8d194);
min-height: 100vh;
display: -webkit-box;
display: flex;
color: #fff;
-webkit-box-align: center;
align-items: center;
font-family: sans-serif;
font-size: 1.2rem;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
text-align: center;
}
pre,
code {
background: #1a1a1a;
font-weight: bold;
font-size: 1.25rem;
font-family: monospace;
}
pre {
padding: 1rem;
border-radius: 6px;
}
.bunny {
height: 50px;
width: 50px;
background-image: url("https://assets.codepen.io/605876/bunny-ready.png");
background-size: contain;
background-position: center;
background-repeat: no-repeat;
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: jump calc(var(--duration) * 1s) infinite both;
animation: jump calc(var(--duration) * 1s) infinite both;
-webkit-animation-delay: calc((((var(--delay, 0) + (var(--index) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
animation-delay: calc((((var(--delay, 0) + (var(--index) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
}
.reversed .bunny {
-webkit-animation-delay: calc((((var(--delay, 0) + ((5 - var(--index)) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
animation-delay: calc((((var(--delay, 0) + ((5 - var(--index)) * var(--stagger-step))) + var(--offset)) * var(--coefficient)) * 1s);
}
.container {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 1vmin;
margin: 4rem 0;
}
h1,
p,
pre {
display: none;
text-align: left;
}
h1 {
margin-bottom: 0.25rem;
}
p {
max-width: 550px;
}
code {
line-height: 1.75;
display: block;
}
[hidden] * {
-webkit-animation: none;
animation: none;
}
@-webkit-keyframes jump {
10%, 90% {
-webkit-transform: translate(0, 0) scaleX(1.1) scaleY(0.8);
transform: translate(0, 0) scaleX(1.1) scaleY(0.8);
}
50% {
background-image: url("https://assets.codepen.io/605876/bunny-jump.png");
-webkit-transform: translate(0, -60px) scaleX(0.9) scaleY(1.2);
transform: translate(0, -60px) scaleX(0.9) scaleY(1.2);
}
}
@keyframes jump {
10%, 90% {
-webkit-transform: translate(0, 0) scaleX(1.1) scaleY(0.8);
transform: translate(0, 0) scaleX(1.1) scaleY(0.8);
}
50% {
background-image: url("https://assets.codepen.io/605876/bunny-jump.png");
-webkit-transform: translate(0, -60px) scaleX(0.9) scaleY(1.2);
transform: translate(0, -60px) scaleX(0.9) scaleY(1.2);
}
}