如上图,边框是长方形有圆角。4个蓝色的点围绕边框转动,这个效果用js或者css该怎么做?主要是转角的时候该怎么掰弯它?有轮子最好。。。
用css3的动画可以实现我有类似的效果 你看着修改一下,兼容问题自己解决
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>h5</title>
<style type="text/css">
*{margin: 0;padding: 0;}
body{background: black;}
.loading{ width: 30px;height: 30px;position: absolute; left: 50%;
margin-left: -15px; top: 50%;}
.content1,.content2{width: 100%;height: 100%;position: absolute;}
.content1 div,.content2 div{width: 8px;height: 8px;background: white;border-radius: 50%; position: absolute;
animation: 1.5s linear infinite loadingmove;}
.cir2{right: 0;top: 0;}
.cir3{left: 0;bottom: 0;}
.cir4{right: 0; bottom: 0;}
.content2 {transform: rotate(45deg);}
@keyframes loadingmove{
0%{transform: scale(1);}
50%{transform: scale(0);}
100%{transform: scale(1);}
}
.content1 .cir1{animation-delay: -0.1s;}
.content2 .cir1{animation-delay: -0.3s;}
.content1 .cir2{animation-delay: -0.5s;}
.content2 .cir2{animation-delay: -0.7s;}
.content1 .cir3{animation-delay: -0.9s;}
.content2 .cir3{animation-delay: -1.1s;}
.content1 .cir4{animation-delay: -1.3s;}
.content2 .cir4{animation-delay: -1.5s;}
</style>
</head>
<body>
<div class="loading">
<div class="content1">
<div class="cir1"></div>
<div class="cir2"></div>
<div class="cir3"></div>
<div class="cir4"></div>
</div>
<div class="content2">
<div class="cir1"></div>
<div class="cir2"></div>
<div class="cir3"></div>
<div class="cir4"></div>
</div>
</div>
</body>
</html>
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
3 回答5.1k 阅读✓ 已解决
5 回答1.9k 阅读
效果不好做。还不如你自己使用gif