I'm trying to create an animation like below
Description of the animation.
- Red bar's height increases to 50px.
- While the red bar remains at its height, set by step 1, the yellow bar height increases to 100px.
- While the yellow bar remains at its height, set by step 2, the green bar height increases to 75px.
- While the green bar remains at its height, set by step 3, the next and final green bar height increases to 75px.
The problem is I can't get the bar to stay at its height. So I have made another animation which is somewhat the same, but not 100%. It's below.
.equilizer {
height: 100px;
width: 100px;
transform: rotate(180deg);
}
.bar {
width: 18px;
}
.bar-1 {
animation: equalize4 1.5s 0s infinite;
}
.bar-2 {
animation: equalize3 1.5s 0s infinite;
}
.bar-3 {
animation: equalize2 1.5s 0s infinite;
}
.bar-4 {
animation: equalize1 1.5s 0s infinite;
}
@keyframes equalize1 {
0% {
height: 0%;
}
100% {
height: 25%;
}
}
@keyframes equalize2 {
0% {
height: 0%;
}
100% {
height: 50%;
}
}
@keyframes equalize3 {
0% {
height: 0%;
}
100% {
height: 37.5%;
}
}
@keyframes equalize4 {
0% {
height: 0%;
}
100% {
height: 37.5%;
}
}
<svg xmlns="http://www.w3.org/2000/svg" class="equilizer" viewBox="0 0 128 128">
<g>
<title>Audio Equilizer</title>
<rect class="bar bar-1" transform="translate(0,0)" y="15" rx="10" fill="#416031"></rect>
<rect class="bar bar-2" transform="translate(25,0)" y="15" rx="10" fill="#416031"></rect>
<rect class="bar bar-3" transform="translate(50,0)" y="15" rx="10" fill="#e5a32b"></rect>
<rect class="bar bar-4" transform="translate(75,0)" y="15" rx="10" fill="#ad1e23"></rect>
</g>
</svg>
How can I achieve the above (Image 1) result?