CSS效果之音频播放效果
代码来自互联网改造而来
<!-- run -->
<style>
:root {
--h: 30px;
}
.container {
display: flex;
align-items: flex-end;
justify-content: flex-start;
position: relative;
height: var(--h);
}
.container span {
background: linear-gradient(to top, #f37d39 0%, #fff 100%);
width: 4px;
height: 50%;
border-radius: calc(var(--h) * 0.2 * 0.5);
margin-right: 4px;
animation: loading 0.5s infinite linear;
animation-delay: calc(0.1s * var(--d));
}
.container span:last-child {
margin-right: 0px;
}
@keyframes loading {
0% {
background-image: linear-gradient(to right,#FF5E00 0%, #fca572 100%);
height: 20%;
border-radius: calc(var(--h) * 0.2 * 0.5);
}
50% {
background-image: linear-gradient(to top,#FF5E00 0%, #f9f1ec 100%);
height: 80%;
border-radius: calc(var(--h) * 0.8 * 0.5);
}
100% {
background-image: linear-gradient(to top, #f48d51 0%, #fb8540 100%);
height: 20%;
border-radius: calc(var(--h) * 0.2 * 0.5);
}
}
</style>
<div class="container">
<span style="--d: 0"></span>
<span style="--d: 1"></span>
<span style="--d: 2"></span>
<span style="--d: 3"></span>
<span style="--d: 4"></span>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS 实现音频loding动画</title>
</head>
<style>
:root {
--h: 30px;
}
.container {
display: flex;
align-items: flex-end;
justify-content: flex-start;
position: relative;
height: var(--h);
}
.container span {
background: linear-gradient(to top, #f37d39 0%, #fff 100%);
width: 4px;
height: 50%;
border-radius: calc(var(--h) * 0.2 * 0.5);
margin-right: 4px;
animation: loading 0.5s infinite linear;
animation-delay: calc(0.1s * var(--d));
}
.container span:last-child {
margin-right: 0px;
}
@keyframes loading {
0% {
background-image: linear-gradient(to right,#FF5E00 0%, #fca572 100%);
height: 20%;
border-radius: calc(var(--h) * 0.2 * 0.5);
}
50% {
background-image: linear-gradient(to top,#FF5E00 0%, #f9f1ec 100%);
height: 80%;
border-radius: calc(var(--h) * 0.8 * 0.5);
}
100% {
background-image: linear-gradient(to top, #f48d51 0%, #fb8540 100%);
height: 20%;
border-radius: calc(var(--h) * 0.2 * 0.5);
}
}
</style>
<body>
<div class="container">
<span style="--d: 0"></span>
<span style="--d: 1"></span>
<span style="--d: 2"></span>
<span style="--d: 3"></span>
<span style="--d: 4"></span>
</div>
</body>
</html>
未经作者授权,禁止转载
本文来自博客园,作者:CoderWGB,转载请注明原文链接:https://www.cnblogs.com/wgb1234/articles/17904195.html
THE END