加载动画

48 阅读1分钟
<template>
	<view class="spinner" :style="{marginTop:top+'rpx'}">
		<view class="spinner-item rect1"></view>
		<view class="spinner-item rect2"></view>
		<view class="spinner-item rect3"></view>
		<view class="spinner-item rect4"></view>
		<view class="spinner-item rect5"></view>
	</view>
</template>

<script>
	export default {
		name:"spinner-loading",
		props:{
			top:{
				type:Number,
				default:0
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style scoped>
.spinner {
  height: 60px;
  text-align: center;
  font-size: 10px;
}
 
.spinner .spinner-item {
  background-color: #f99799;
  height: 100%;
  width: 6px;
  margin: 0 3rpx;
  display: inline-block;
   
  -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
  animation: stretchdelay 1.2s infinite ease-in-out;
}
 
.spinner .rect2 {
  -webkit-animation-delay: -1.1s;
  animation-delay: -1.1s;
}
 
.spinner .rect3 {
  -webkit-animation-delay: -1.0s;
  animation-delay: -1.0s;
}
 
.spinner .rect4 {
  -webkit-animation-delay: -0.9s;
  animation-delay: -0.9s;
}
 
.spinner .rect5 {
  -webkit-animation-delay: -0.8s;
  animation-delay: -0.8s;
}
 
@-webkit-keyframes stretchdelay {
  0%, 40%, 100% { -webkit-transform: scaleY(0.4) } 
  20% { -webkit-transform: scaleY(1.0) }
}
 
@keyframes stretchdelay {
  0%, 40%, 100% {
    transform: scaleY(0.4);
    -webkit-transform: scaleY(0.4);
  }  20% {
    transform: scaleY(1.0);
    -webkit-transform: scaleY(1.0);
	background-color: #f95659;
  }
}
</style>