• css动画


    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>animation</title>
    <style>
    .box{
    100px;
    height: 100px;
    background: aqua;
    /*改变盒子位置*/
    position: absolute;
    /*2s将这个动画执行完 3s 延迟3s在执行 linear匀速的*/
    animation: move 2s forwards 3s alternate-reverse infinite linear;

    }
    /*move动画的名称*/
    @keyframes move{
    /*0%--100%*/
    0%{
    top: 0;
    left: 0;
    }
    100%{
    top: 0;
    left: 500px;
    }
    }
    </style>
    </head>
    <body>
    <!--transition过渡动画的特点 是需要有起始和终止的样式
    如果要实现已经入到页面就出现动画效果 必须借助js脚本语言
    animation 关键帧动画
    1.要有关键帧 关键帧的定义通过@keyframes进行声明
    2.动画执行时间
    3.可选值:forwards 动画停止在最后一个关键帧的位置
    backwards 动画第一个关键帧是否立即执行
    both
    动画的速率函数
    5.可选值:reverse
    infinite 永久执行
    -->
    <div class="box"></div>
    <script type="text/javascript">
    var box = document.querySelector('.box');
    box.onclick=function(){
    box.style.animationPlayState='paused';
    if(box.style.animationPlayState==='paused'){
    box.style.animationPlayState='running';
    }else{
    box.style.animationPlayState='paused';
    }
    }
    </script>

    </body>
    </html>

    <!DOCTYPE html><html><head><meta charset="UTF-8"><title>animation</title><style>.box{ 100px;height: 100px;background: aqua;/*改变盒子位置*/position: absolute;/*2s将这个动画执行完   3s  延迟3s在执行   linear匀速的*/animation: move 2s forwards 3s alternate-reverse infinite linear;}/*move动画的名称*/@keyframes move{/*0%--100%*/0%{top: 0;left: 0;}100%{top: 0;left: 500px;}}</style></head><body><!--transition过渡动画的特点  是需要有起始和终止的样式如果要实现已经入到页面就出现动画效果  必须借助js脚本语言animation 关键帧动画1.要有关键帧  关键帧的定义通过@keyframes进行声明2.动画执行时间3.可选值:forwards 动画停止在最后一个关键帧的位置backwards 动画第一个关键帧是否立即执行both 动画的速率函数   5.可选值:reverse infinite  永久执行--><div class="box"></div><script type="text/javascript">var box = document.querySelector('.box');box.onclick=function(){box.style.animationPlayState='paused';if(box.style.animationPlayState==='paused'){box.style.animationPlayState='running';}else{box.style.animationPlayState='paused';}}</script></body></html>

  • 相关阅读:
    UEditor使用报错Cannot set property 'innerHTML' of undefined
    freemarker如何在url中传递中文参数
    freemarker字符串转换成日期和时间
    freemarker 类型转换
    内存分析工具 MAT 的使用
    Ubuntu13.04下Eclipse中文乱码解决
    自定义上下文对话框
    格局中@null的代码实现方式
    Android xml资源文件中@、@android:type、@*、?、@+含义和区别
    探讨:你真的会用Android的Dialog吗?
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/13360736.html
Copyright © 2020-2023  润新知