css写的小程序加载动画

4 篇文章 0 订阅
4 篇文章 0 订阅

先来效果图


wxml部分

<view class="line-spin-fade-loader">
  <view wx:for="{{[1,2,3,4,5,6,7,8,9,10,11,12]}}"></view>
</view>

wxss部分

@-webkit-keyframes line-spin-fade-loader {
  50% {
    opacity: 0.3;
  }

  100% {
    opacity: 1;
  }
}

@keyframes line-spin-fade-loader {
  50% {
    opacity: 0.3;
  }

  100% {
    opacity: 1;
  }
}

.line-spin-fade-loader {
  position: relative;
  top: 250rpx;
  left: 50%; 
  transform: scale(4,4);
}

.line-spin-fade-loader > view:nth-child(1) {
top:25rpx;
left:0;
-webkit-animation:line-spin-fade-loader 1.8s -1.32s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -1.32s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(2) {
top:21.6506rpx;
left:12.5rpx;
-webkit-transform:rotate(-30deg);
transform:rotate(-30deg);
-webkit-animation:line-spin-fade-loader 1.8s -1.2s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -1.2s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(3) {
top:12.5rpx;
left:21.6506rpx;
-webkit-transform:rotate(-60deg);
transform:rotate(-60deg);
-webkit-animation:line-spin-fade-loader 1.8s -1.08s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -1.08s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(4) {
top:0;
left:25rpx;
-webkit-transform:rotate(90deg);
transform:rotate(90deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.96s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.96s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(5) {
top:-12.5rpx;
left:21.6506rpx;
-webkit-transform:rotate(60deg);
transform:rotate(60deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.84s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.84s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(6) {
top:-21.6506rpx;
left:12.5rpx;
-webkit-transform:rotate(30deg);
transform:rotate(30deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.72s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.72s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(7) {
  top:-25rpx;
  left:0;
  -webkit-animation:line-spin-fade-loader 1.8s -0.6s infinite ease-in-out;
  animation:line-spin-fade-loader 1.8s -0.6s infinite ease-in-out;
}

.line-spin-fade-loader > view:nth-child(8) {
top:-21.6506rpx;
left:-12.5rpx;
-webkit-transform:rotate(-30deg);
transform:rotate(-30deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.48s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.48s infinite ease-in-out;
}

.line-spin-fade-loader > view:nth-child(9) {
top:-12.5rpx;
left:-21.6506rpx;
-webkit-transform:rotate(-60deg);
transform:rotate(-60deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.36s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.36s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(10) {
top:0;
left:-25rpx;
-webkit-transform:rotate(90deg);
transform:rotate(90deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.24s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.24s infinite ease-in-out;

}

.line-spin-fade-loader > view:nth-child(11) {
top:12.5rpx;
left:-21.6506rpx;
-webkit-transform:rotate(60deg);
transform:rotate(60deg);
-webkit-animation:line-spin-fade-loader 1.8s -0.12s infinite ease-in-out;
animation:line-spin-fade-loader 1.8s -0.12s infinite ease-in-out;
}

.line-spin-fade-loader > view:nth-child(12) {
  top:21.6506rpx;
  left:-12.5rpx;
  -webkit-transform:rotate(30deg);
  transform:rotate(30deg);
  -webkit-animation:line-spin-fade-loader 1.8s 0s infinite ease-in-out;
  animation:line-spin-fade-loader 1.8s 0s infinite ease-in-out;
}

.line-spin-fade-loader > view {
  background-color: #fff;
  border-radius: 2rpx;
  margin: 2rpx;
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  position: absolute;
  width: 5rpx;
  height: 15rpx; 
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值