微信小程序自定义loading加载动画(1)
1.实现效果2.实现代码<view class="ring"><view>sss</view><view class="line"></view></view>.ring {position: relative;margin: 40rpx auto;width: 80px;height: 80px;text-align: ce
·
1.实现效果
2.实现代码
<view class="ring">
<view>sss</view>
<view class="line"></view>
</view>
.ring {
position: relative;
margin: 40rpx auto;
width: 80px;
height: 80px;
text-align: center;
line-height: 80px;
font-size: 20px;
letter-spacing: 4px;
background: transparent;
border: 2px solid #3c3c3c;
border-radius: 50%;
box-shadow: 0 0 20 rgba(0, 0, 0, .5);
}
.ring::before {
content: '';
position: absolute;
z-index: 99;
top: -3px;
left: -3px;
width: 100%;
height: 100%;
border: 3px solid transparent;
border-top: 3px solid #b3205d;
border-right: 3px solid #b3205d;
border-radius: 50%;
animation: animateCircle 2s linear infinite; /* 动画:名称 时间 速率 重复 */
}
.line{
display: block;
position: absolute;
top: calc(50% - 2px);
left: 50%;
width: 50%;
height: 4px;
background: transparent;
transform-origin: left; /* 动画开始位置 */
animation: animate 2s linear infinite;
transform: rotate(45deg);
}
.line::before {
content: '';
position: absolute;
width: 8px;
height: 8px;
border-radius: 50%;
background: #b3205d;
top: -4px;
right: -4px;
box-shadow: 0 0 20px #b3205d;
}
@keyframes animate {
100% {
transform: rotate(405deg);
}
}
@keyframes animateCircle {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
3.更多loading加载动画
更多推荐
已为社区贡献1条内容
所有评论(0)