圆形进度条和浮光掠影
圆形进度条:
思路: 在网上看到的思路,设计两个半圆分别放在两个盒子里面,初始时,在透明处,然后旋转,控制两边旋转时的时间就以了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> body { position: relative; } .content { position: absolute; top: 200px; left: 600px;
width: 200px; height: 200px; } .content .box1 { position: absolute; width: 100px; height: 200px; overflow: hidden; } .content .box1 .left { height: 160px; width: 160px; border:15px solid transparent; border-radius: 50%; border-bottom: 15px solid red; border-left: 15px solid red; transform: rotate(-135deg); position: absolute; top: 5px; left: 5px; animation: left_circle 8s linear infinite; } @keyframes left_circle { 0%,50% { transform: rotate(-135deg); } 100% { transform: rotate(45deg); } } .content .box2 { position: absolute; left: 100px; width: 100px; height: 200px; overflow: hidden; }
.content .box2 .right { height: 160px; width: 160px; border:15px solid transparent; border-radius: 50%; border-top: 15px solid red; border-right: 15px solid red; transform: rotate(-135deg); position: absolute; top: 5px; right: 5px; animation: rifht_circle 8s linear infinite; } @keyframes rifht_circle { 0% { transform: rotate(-135deg); } 50%,100% { transform: rotate(45deg); } } </style> </head> <body> <!-- 借鉴思路: 两个半圆环 --> <div class="content"> <!-- 里面放两个盒子,盒子里面放圆环 --> <div class="box1"> <!-- 放左边的半圆 --> <div class="left"></div> </div> <div class="box2"> <!-- 放右边的半圆 --> <div class="right"></div> </div> </div> </body> </html>
|