css3实现音阶音频动画

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>CSS音阶动画</title>
	<style>
 .box{
	width: 100px;
	background: red;
}
 .box .main{
     margin-left: 10px;
}
@-webkit-keyframes list
 {
  0% {
    -webkit-transform: scaley(1);
            transform: scaley(1); }

  50% {
    -webkit-transform: scaley(0.4);
            transform: scaley(0.4);
      }
  100% {
    -webkit-transform: scaley(1);
            transform: scaley(1); 
            } 
      }
@keyframes list
 {
  0% {
    -webkit-transform: scaley(1);
            transform: scaley(1); }

  50% {
    -webkit-transform: scaley(0.4);
            transform: scaley(0.4); }

  100% {
    -webkit-transform: scaley(1);
            transform: scaley(1); }
    }

.list> div {
		    background-color: #fff;
		    width: 3px;
		    height: 18px;
		    border-radius: 2px;
		    -webkit-animation-fill-mode: both;
		    animation-fill-mode: both;
		    display: inline-block;
		    -webkit-animation: list 0.9s 0s infinite cubic-bezier(.85, .25, .37, .85);
		    animation: list 0.9s 0s infinite cubic-bezier(.85, .25, .37, .85);
      }
  .list> div:nth-child(1), .list> div:nth-child(2) {
            -webkit-animation-delay: 0.2s !important;
            animation-delay: 0.2s !important; 
        }
 .list> div:nth-child(3), .list> div:nth-child(4) {
           -webkit-animation-delay: 0.4s !important;
            animation-delay: 0.4s !important; 
        }

	</style>
</head>
<body>
<div class="box">
	    <div class="main">
        <div class="list">
          <div></div>
          <div></div>
          <div></div>
          <div></div>
        </div>
      </div>
	</div>		      
</body>
</html>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,以下是一个简单的示例代码,可以实现一个音频动画图: HTML代码: ```html <div class="audio-animation"> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> </div> ``` CSS代码: ```css .audio-animation { display: flex; justify-content: center; align-items: center; height: 100px; } .bar { width: 10px; height: 50px; margin: 0 5px; background-color: #ccc; animation: bar-animation 1s infinite ease-in-out; } .bar:nth-child(1) { animation-delay: 0.1s; } .bar:nth-child(2) { animation-delay: 0.2s; } .bar:nth-child(3) { animation-delay: 0.3s; } .bar:nth-child(4) { animation-delay: 0.4s; } .bar:nth-child(5) { animation-delay: 0.5s; } @keyframes bar-animation { 0% { transform: scaleY(1); } 50% { transform: scaleY(0.5); } 100% { transform: scaleY(1); } } ``` 在上面的代码中,我们使用了 CSS3动画特性来实现音频动画图。首先,我们创建了一个父元素 `.audio-animation`,并将其设置为 flex 布局,以便子元素可以水平居中和垂直居中。然后,我们创建了 5 个条形元素 `.bar`,并在父元素中水平排列。每个条形元素都设置了一个动画 `bar-animation`,它会让条形元素在 1 秒的时间内不停地缩放,从而形成动画效果。我们使用了 `animation-delay` 属性来让每个条形元素的动画开始时间有所不同,从而实现音频的波动效果。 你可以将上面的代码复制到 HTML 和 CSS 文件中并运行,查看效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

1登峰造极

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值