zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    php 解析json
    TP学习笔记一(tp的目录结构 , tp的输出方式)
    linux android真机测试
    SharedPreferences保存数据
    Volley用法
    android获得图片
    android 一条线
    android 获取时间
    Android_Spinner_Listener
    Android_Spinner_SimpleAdapter
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/13360736.html
Copyright © 2011-2022 走看看