zoukankan      html  css  js  c++  java
  • 714 transform、transition:translate,scale,rotate,skew,transform-origin

    transform


    位移 - translate


    缩放 - scale


    transform-origin


    缩放 - rotate


    倾斜 - skew


    过渡动画 - transition


    01_transform_translate.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             180px;
            height: 100px;
            background-color: #f66;
          }
    
          .box:hover {
            /* transform: translate(30px); */
            /* 90px */
            transform: translate(50%);
          }
    
          .box1 {
            transform: translate(90px);
          }
        </style>
      </head>
      <body>
        <div class="box"></div>
        <div class="box box1"></div>
      </body>
    </html>
    

    02_transform_scale.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             100px;
            height: 100px;
            background-color: #f66;
    
            margin: 100px auto 0;
          }
    
          .box:hover {
            transform: scale(2);
          }
        </style>
      </head>
      <body>
        <div class="box"></div>
      </body>
    </html>
    

    03_transform-origin.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             100px;
            height: 100px;
            background-color: #f66;
    
            margin: 100px auto 0;
            transform-origin: 10px top;
          }
    
          .box:hover {
            transform: scale(2);
          }
        </style>
      </head>
      <body>
        <div class="box"></div>
      </body>
    </html>
    

    04_transform_rotate.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             100px;
            height: 100px;
            background-color: #f66;
    
            margin: 100px auto 0;
          }
    
          .box:hover {
            /* deg: degree */
            transform: rotate(-90deg);
          }
        </style>
      </head>
      <body>
        <div class="box">哈哈哈</div>
      </body>
    </html>
    

    05_transform_skew.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             100px;
            height: 100px;
            background-color: #f66;
    
            margin: 100px auto 0;
          }
    
          .box:hover {
            transform: skew(50deg, 50deg);
          }
        </style>
      </head>
      <body>
        <div class="box">哈哈哈</div>
      </body>
    </html>
    

    06_transition的过渡动画.html

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
    
        <style>
          .box {
             100px;
            height: 100px;
            background-color: #f66;
    
            margin: 100px auto 0;
    
            /* transition: 值1 transition-property:transform/width/height/all 
                            值2 transition-duration: 100ms(毫秒)/1s(秒)
                            值3 transition-timing-function: 动画的变化速度: ease/ease-in
                            值4 transition-delay: 延迟/等待多久再执行这个动画; */
            transition: all 300ms linear;
          }
    
          .box:hover {
            /*  200px;
                height: 200px; */
            /* transform: scale(2) */
            transform: rotate(180deg);
          }
        </style>
      </head>
      <body>
        <div class="box"></div>
      </body>
    </html>
    

  • 相关阅读:
    设计模式之-工厂方法模式
    设计模式之-简单工厂模式
    设计模式之-单例模式
    Ubuntu-18.04 下使用Nginx搭建高可用,高并发的asp.net core集群
    Ubuntu-18.04 下修改root用户密码,安装SSH服务,允许root用户远程登录,安装vsftp服务器
    ASP.NET Core 系列[1]:ASP.NET Core 初识
    .net core系列之《将.net core应用部署到Ubuntu》
    动态内存分配函数
    C++ sort()对结构体排序
    STL
  • 原文地址:https://www.cnblogs.com/jianjie/p/15149706.html
Copyright © 2011-2022 走看看