- var width = 1000
- var count = 10
svg(viewBox="0 0 1000 1000")
- var i = count
while i--
- var x= i * (width/count)
- var radius = 30
- var origin= x + "px -50px";
circle.confetti(
r=radius
cy="-50"
cx=x
style="transform-origin: " + origin)
.title confetti
View Compiled
@import 'compass';
$turns: 6;
$duration: 6s;
$count: 10;
.confetti {
animation: move $duration linear infinite, color $duration/$turns linear infinite, opacity $duration linear infinite;
@for $i from 1 through $count {
&:nth-child(#{$i}) {
$hue: 10*$i;
fill: hsl($hue, 80, 40);
animation-delay: $i * $duration * random(100) * -0.01;
--dark: #{hsl($hue, 80, 20)};
--tilt: random(100)/100
;
}
}
}
@keyframes move {
100% {
transform: translate(100px, 1000px) rotate3D(1, var(--tilt), 0.21, $turns*360deg);
}
}
@keyframes color {
50% {
fill: var(--dark);
}
}
@keyframes opacity {
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
/*Page Setup*/
@import url('https://fonts.googleapis.com/css?family=Unica+One');
svg {
width: 100vw;
height: 80vh;
}
body {
background: hsl(200, 10%, 10%);
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.title {
height: 10vh;
line-height: 10vh;
font-size: 8vh;
padding: 2.5vh;
margin: 0;
color: hsl(40, 40%, 50%);
border-top: 1px solid;
border-bottom: 1px solid;
font-family: 'Unica One', cursive;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.