zoukankan      html  css  js  c++  java
  • css3动画和音频

    @keyframes music {
    0% {
    transform: rotate(0deg);
    -ms-transform: rotate(0deg); /* IE 9 */
    -webkit-transform: rotate(0deg); /* Safari and Chrome */
    }
     
    100% {
    transform: rotate(360deg);
    -ms-transform: rotate(360deg); /* IE 9 */
    -webkit-transform: rotate(360deg); /* Safari and Chrome */
    }
     
    }
     
    .music_tool{
    animation-name:music;
    animation-duration:3s;   //执行一次动画需要的时间
    -webkit-animation-name:music;
    -webkit-animation-duration:3s;
    animation-iteration-count:infinite;   //动画执行次数
    -webkit-animation-iteration-count:infinite;
    animation-timing-function:linear;   //动画效果曲线
    -webkit-animation-timing-function:linear; /* Safari and Chrome */
    }
     
    // document.getElementById("music-tool").classList.add('music_tool');  //添加动画
    // document.getElementById("music-tool").classList.remove('music_tool'); //移除动画
     
     
    document.getElementById("music-tool").style.animationPlayState = "running";  //设置动画状态
    document.getElementById("music-tool").style.WebkitAnimationPlayState = "running"; // 针对 Chrome 和 Safari 的代
    document.getElementById("music-tool").style.animationPlayState = "paused"; //设置动画状态
    document.getElementById("music-tool").style.WebkitAnimationPlayState = "paused"; // 针对 Chrome 和 Safari 的代
     
    jquery:
    $('xxx').stop() 或者 $('xxx').stop().animate();
    或者
    $(this).css({
    "animation-play-state":"paused"
    })
     
    // autoplay 自动播放  loop 循环播放  preload 则音频在页面加载时进行加载,并预备播放。controls  如果出现该属性,则向用户显示控件,比如播放按钮。
    <audio id="music" autoplay loop preload="auto">   
    <source src="music.mp3" >
    </audio>
     
    //检测播放是否已暂停.audio.paused 在播放器播放时返回false.
    // alert(audio.paused);
    //音频时长 s
    // alert(audio.duration);
    audio.play();//audio.play();// 这个就是播放
    audio.pause();// 这个就是暂停
       var audio=document.getElementById("audio");
    audio.duration//播放时间
    audio.currentTime//播放进度
    audio.ontimeupdate=function(){}//播放时间更新事件
  • 相关阅读:
    nodejs+express安装
    C++操作MySQL大量数据插入效率低下的解决方法
    代码中出现一个类似空格的东西---不间断空格
    java使用compareTo报Comparison method violates its general contract 异常
    实现dev双柱图
    DB2登录示例数据库
    DB2 报错:CLI0111E 数值超出范围。 SQLSTATE=22003
    解决Android应用进入桌面后,再次点击APP抛异常的问题
    android studio 3.0 修改release生成的apk名称
    winfrom打包好的程序,安装错误代码1603
  • 原文地址:https://www.cnblogs.com/BlingSun/p/8949494.html
Copyright © 2011-2022 走看看