zoukankan      html  css  js  c++  java
  • css 动画 码农

    1. animation: 動畫名稱 持續時間
    @keyframe 動畫名稱 {
        from {
            CSS 屬性: 值
        }
        to {
            CSS 屬性: 值
        }
    }
        @keyframes active {
            0% {
                opacity: 0;
                transform: scale(0);
            }
    
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }
    

      2. transition: CSS屬性 持續時間;

    	div{
    		     200px;
    		    height: 200px;
    		    margin: 100px auto;
    		    background-color: #336699;
    		    
    		    /*transition:width 1s;*/
    		    transition:all 1s;
    		    /*transition: height 1s;*/
    		}
    		div:hover{
    		     300px;
    		    height: 400px;
            }

    3.html简代demo
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <style>
        .box1 {
            border: 1px solid blue;
            width: 100px;
            height: 40px;
            animation: active 1s linear 1;
        }
    
        @keyframes active {
            0% {
                opacity: 0;
                transform: scale(0);
            }
    
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }
    
    
        #c1:checked~.box2 {
            margin-left: 50px;
            display: block;
            visibility: hidden;
            opacity: 0;
        }
    
        .box2 {
            margin-left: 0px;
            height: 100px;
            width: 100px;
            background-color: #0a0;
            transition: 1s -.3s linear;
            visibility: visible;
            opacity: 1;
        }
    </style>
    
    <body>
        <button onclick='toggle()'>change</button>
        <div class="box1"></div>
    
        <br />
        <input id="c1" type="checkbox">
        <br />
        <br />
        <div class="box2"></div>
    </body>
    
    </html>
    
    <script>
        function toggle() {
            curr = document.querySelector('div').style.display
            if (curr == 'display' || curr == '') {
                document.querySelector('div').style.display = 'none'
            } else {
                document.querySelector('div').style.display = ''
            }
        }
    </script>

     

    1:animation: 動畫名稱 持續時間@keyframe 動畫名稱 {    from {        CSS 屬性: 值    }    to {        CSS 屬性: 值    }}    @keyframes active {        0% {            opacity: 0;            transform: scale(0);        }
            100% {            opacity: 1;            transform: scale(1);        }    }

    2:transition: CSS屬性 持續時間;div{    200px;    height: 200px;    margin: 100px auto;    background-color: #336699;        /*transition:width 1s;*/    transition:all 1s;    /*transition: height 1s;*/}div:hover{    300px;    height: 400px;        }

    本店所有软件都可以修改定制,详情请咨询店家

    人生旅途,边走边看...
  • 相关阅读:
    poj 3122 Pie (二分)
    poj 1905 Expanding Rods(二分)
    poj 3258 River Hopscotch (二分)
    poj 3273 Monthly Expense(二分穷举)
    最小最大堆
    最小—最大堆
    zend studio 9 字体,颜色,快捷键等相关设置
    javascript onbeforeunload
    php DOMDocument 不能解析引用外部DTD的XML
    phpdoc 注释关键字含义
  • 原文地址:https://www.cnblogs.com/dming4/p/15245651.html
Copyright © 2011-2022 走看看