👏实现一个音频loading动画还蛮有趣的,速速来Get吧~
🥇文末分享源代码。记得点赞+关注+收藏!
:root {--h: 80px;}
//...共15个
.container {display: flex;align-items: center;position: relative;height: var(--h);
}
.container span {background: linear-gradient(to top, #d299c2 0%, #fef9d7 100%);width: 4px;height: 20%;border-radius: calc(var(--h) * 0.2 * 0.5);margin-right: 4px;
}
.container span:last-child {margin-right: 0px;}
@keyframes loading {0% {background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%);height: 20%;border-radius: calc(var(--h) * 0.2 * 0.5);}50% {background-image: linear-gradient(to top, #d299c2 0%, #fef9d7 100%);height: 100%;border-radius: calc(var(--h) * 1 * 0.5);}100% {background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%);height: 20%;border-radius: calc(var(--h) * 0.2 * 0.5);}
}
//...,6,5,4,3,2,//...,2,3,4,5,6,
.container span {+ animation-delay: calc(0.2s * var(--d));
}
CSS 实现音频loding动画