<div id="confetti-wrapper">
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
<div class="confetti"></div>
</div>
body {
background-color: #111827;
}
#confetti-wrapper {
overflow: hidden;
position: absolute;
height: 100%;
width: 100%;
}
.confetti {
width: 15px;
height: 15px;
background-color: #f2d74e;
position: absolute;
left: 50%;
animation: confetti 5s ease-in-out -2s infinite;
transform-origin: left top;
}
.confetti:nth-child(1) {
background-color: #FCF6B0;
left: 10%;
animation-delay: 0;
}
.confetti:nth-child(2) {
background-color: #78531E;
left: 20%;
animation-delay: -5s;
}
.confetti:nth-child(3) {
background-color: #E3C47A;
left: 30%;
animation-delay: -3s;
}
.confetti:nth-child(4) {
background-color: #896C41;
left: 40%;
animation-delay: -2.5s;
}
.confetti:nth-child(5) {
background-color: #9A5F22;
left: 50%;
animation-delay: -4s;
}
.confetti:nth-child(6) {
background-color: #DDC571;
left: 60%;
animation-delay: -6s;
}
.confetti:nth-child(7) {
background-color: #8A5E25;
left: 70%;
animation-delay: -1.5s;
}
.confetti:nth-child(8) {
background-color: #FCDF73;
left: 80%;
animation-delay: -2s;
}
.confetti:nth-child(9) {
background-color: #4F3A20;
left: 90%;
animation-delay: -3.5s;
}
.confetti:nth-child(10) {
background-color: #F0E9A0;
left: 100%;
animation-delay: -2.5s;
}
.confetti:nth-child(11) {
background-color: #F0E9A3;
left: 72%;
animation-delay: -5.5s;
}
.confetti:nth-child(12) {
background-color: #F0E4A0;
left: 34%;
animation-delay: -2.8s;
}
.confetti:nth-child(13) {
background-color: #F0C9A0;
left: 100%;
animation-delay: -7.5s;
}
.confetti:nth-child(14) {
background-color: #F0B9A0;
left: 16%;
animation-delay: -8.5s;
}
@keyframes confetti {
0% {
transform: rotateZ(15deg) rotateY(0deg) translate(0, 0);
}
25% {
transform: rotateZ(5deg) rotateY(360deg) translate(-5vw, 20vh);
}
50% {
transform: rotateZ(15deg) rotateY(720deg) translate(5vw, 60vh);
}
75% {
transform: rotateZ(5deg) rotateY(1080deg) translate(-10vw, 80vh);
}
100% {
transform: rotateZ(15deg) rotateY(1440deg) translate(10vw, 110vh);
}
}
// -
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.