zoukankan      html  css  js  c++  java
  • HTML之盒子变形动画

    4个圆形球作圆周运动

    代码:

    1 <div class="box">
    2         <div class="box1"></div>
    3         <div class="box2"></div>
    4         <div class="box3"></div>
    5         <div class="box4"></div>
    6     </div>
    *{
        margin: 0;
        padding: 0;
    }
    body{
        margin: auto;
        padding-top: 200px;
        padding-left: 600px;
    }
    .box{
         400px;
        height: 400px;
        border-radius: 50%;
        background-color: blue;
        position: relative;
    }
    .box div{
         200px;
        height: 200px;
        border-radius: 50%;
        background-color: red;
    }
    .box1{
        position: absolute;
        left: 100px;
        top: -200px;
        animation-name: div1;
        animation-duration: 2s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
    }
    .box2{
        position: absolute;
        left: -200px;
        top: 100px;
        animation-name: div2;
        animation-duration: 2s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
    }
    .box3{
        position: absolute;
        left: 100px;
        bottom: -200px;
        animation-name: div3;
        animation-duration: 2s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
    }
    .box4{
        position: absolute;
        top: 100px;
        left: 400px;
        animation-name: div4;
        animation-duration: 2s;
        animation-iteration-count: infinite;
        animation-timing-function: linear;
    }
    @keyframes div1{
        from{transform:translate(0,0)}
        50%{transform:translate(150,150)}
        to{transform: translate(300px,300px)};
    }
    @keyframes div2{
        from{transform: translate(0,0)}
        50%{transform: translate(150,-150px)}
        to{transform: translate(300px,-300px)}
    }
    @keyframes div3{
        form{transform: translate(0,0)}
        50%{transform: translate(-150px,-150px)}
        to{transform: translate(-300px,-300px)}
    }
    @keyframes div4{
        from{transform: translate(0,0)}
        50%{transform: translate(-150px,150px)}
        to{transform: translate(-300px,300px)}
    }

    完成图形:

  • 相关阅读:
    母函数详解
    java中为什么要实现序列化,什么时候实现序列化?
    cocos2dx&cocosbuilder折腾记
    Unity3D系列教程–使用免费工具在Unity3D中开发2D游戏 第二节(下)
    分頁查詢
    獲取CPU,硬盤序列號
    spcomm
    dbgrideh的導入和導出
    程序窗体及控件自适应分辨率
    組合的藝術
  • 原文地址:https://www.cnblogs.com/CccK-html/p/11295246.html
Copyright © 2011-2022 走看看