VUE写粘稠水滴模式的loading;移动端只适用于安卓

<template>
	<view class="outBox">
		<view class="box">
			<view class="loader">
				<span style="--i:1" class="span"></span>
				<span style="--i:2" class="span"></span>
				<span style="--i:3" class="span"></span>
				<span style="--i:4" class="span"></span>
				<span style="--i:5" class="span"></span>
				<span style="--i:6" class="span"></span>
				<span style="--i:7" class="span"></span>
			</view>
			<view class="loading">LOADING</view>
		</view>
		<svg class="svg">
			<filter id="gooey">
				<feGaussianBlur in="SourceGraphic" stdDeviation="10" />
				<feColorMatrix values="
							1 0 0 0 0
							0 1 0 0 0
							0 0 1 0 0
							0 0 0 20 -10
						" />
			</filter>
		</svg>
	</view>

</template>

<script>
	export default {
		name: "loading",
		data() {
			return {

			};
		}
	}
</script>

<style scoped lang="scss">
	.outBox{
		width: 100%;
		height: 100%;
		position: relative;
	}
	.box {
		position: absolute;
		top: calc(50% - 200rpx);
		left: calc(50% - 200rpx);
	}

	.svg {
		width: 0;
		height: 0;
	}

	.loader {
		position: relative;
		width: 400rpx;
		height: 400rpx;
		filter: url(#gooey);
	}

	.loader .span {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		display: block;
		animation: animate 4s ease-in-out infinite;
		animation-delay: calc(0.2s*var(--i));
	}

	.loader .span:before {
		content: '';
		position: absolute;
		top: 0;
		left: calc(50% - 40rpx);
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		box-shadow: 0 0 60rpx #03A9F4;
		background: linear-gradient(#ffffff, #03a9f4);
	}

	.loading {
		position: absolute;
		top: 0;
		left: 0;
		top: 0;
		bottom: 0;
		margin: auto;
		text-align: center;
		line-height: 400rpx;
		width: 400rpx;
		color: #03A9F4;
		font-size: 48rpx;
	}

	@keyframes animate {
		0% {
			transform: rotate(0deg);
		}

		50%,
		100% {
			transform: rotate(360deg);
		}
	}
</style>

  

posted @ 2022-10-11 11:17  奇函数  阅读(97)  评论(0)    收藏  举报