<div class="container">
<div class="bunny-wrapper">
<div class="bunny-ear"></div>
<div class="bunny"></div>
</div>
<div class="kpop"></div>
<div class="ninja"></div>
<div class="textWrapper">
<p class="text">intro to CSS animations</p>
</div>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 100%;
height: 100vh;
}
.kpop, .bunny, .ninja, .bunny-ear {
width: 200px;
height: 200px;
background-repeat: no-repeat;
background-size: contain;
background-position-x: center;
}
.ninja {
background-image: url("https://ljc-dev.github.io/fluffy-octo-adventure/nin.png");
position: fixed;
left: 0px;
top: 150px;
transform: translateX(-75%);
animation: slideLeft 1s infinite alternate;
}
@keyframes slideLeft {
0% {
transform: translateX(-75%);
}
100% {
transform: translateX(0%);
}
}
/*
.ninja:hover {
transform: translateX(0%);
} */
.kpop {
background-image: url("https://ljc-dev.github.io/fluffy-octo-adventure/kpop.png");
position: fixed;
bottom: 0;
left: 500px;
transform: translateY(75%);
/* transition: transform 0.5s; */
animation: slideUp 3s infinite alternate;
}
/*
.kpop:hover {
transform: translateY(0%);
} */
@keyframes slideUp {
0%, 100% {
transform: translateY(75%);
}
20%, 70% {
transform: translateY(75%);
}
30%, 60% {
transform: translateY(0%);
}
}
.bunny-wrapper {
position: relative;
top: 100px;
left: 200px;
width: 200px;
height: 200px;
transform: translateY(-160deg);
}
.bunny {
position: absolute;
background-image: url("https://ljc-dev.github.io/fluffy-octo-adventure/bunny.png");
}
.bunny-ear {
background-image: url("https://ljc-dev.github.io/fluffy-octo-adventure/ear-2.png");
position: absolute;
top: -75px;
left: 25px;
width: 50px;
height: 100px;
transform-origin: center 95%;
transform: rotate(-160deg);
/* transition: transform 0.5s; */
animation: rotateEar 3s infinite;
}
/* .bunny-wrapper:hover .bunny-ear {
transform: rotate(-5deg);
} */
@keyframes rotateEar {
0%, 100% {
transform: rotate(-160deg);
}
40%, 80% {
transform: rotate(-160deg);
}
50%, 65% {
transform: rotate(-5deg);
}
}
.textWrapper {
position: fixed;
top: 50px;
left: 0;
right: 0;
padding: 1rem;
font-size: xx-large;
background: rgba(255, 240, 240, 0.884);
}
.text {
color: rgb(98, 98, 98);
text-transform: uppercase;
font-family: Verdana, Geneva, Tahoma, sans-serif;
letter-spacing: 0.1rem;
font-weight: bold;
animation: translateText 3s linear infinite;
}
@keyframes translateText {
0% {
transform: translateX(100%);
}
20% {
transform: translateX(0%);
}
25% {
transform: translateX(10%);
}
80% {
transform: translateX(10%);
}
85% {
transform: translateX(20%);
}
100% {
transform: translateX(-100%);
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.