uniapp 实现进度条加载效果

uniapp yekong

uniapp 页面要实现一个页面加载的动画效果,让小飞机从左侧飞到右侧的效果,将实现的方法记录一下。
uniapp 实现进度条加载效果

html

<template>
	<view>
		<div class="bg"></div>
		<div class="my">
			<div class="jindu">
				<div class="jindu2">
					<div class="jindu3" :style="'width:'+width+'%'">
						<image src="https://images.wanjunshijie.com/mini/chuban/static/loading/plane.png" mode="">
						</image>
					</div>
				</div>
				<div class="jinduInfo">
					正在加载中 <text>{{width}}</text>%
				</div>
			</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				width: 0,
				time: null
			}
		},
		onLoad() {
			this.time = setInterval(() => {
				if (this.width >= 100) {
					clearInterval(this.time);
				} else {
					this.width += 5
				}
			}, 50)

		},
		methods: {
			goback() {
				uni.navigateBack({

				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: url(https://images.wanjunshijie.com/mini/chuban/static/loading/bg.png) no-repeat;
		background-size: 100% 100%;
		z-index: 0;
	}

	.my {
		padding-bottom: 30rpx;
		position: relative;
		z-index: 1;
		width: 750rpx;
	}

	.cloud {
		width: 162rpx;
		height: 123rpx;
		position: fixed;
		top: 70rpx;
		left: 70rpx;

		image {
			width: 162rpx;
			height: 123rpx;
		}
	}

	.cloud2 {
		width: 114rpx;
		height: 84rpx;
		position: fixed;
		top: 200rpx;
		right: 100rpx;

		image {
			width: 114rpx;
			height: 84rpx;
		}
	}

	.cloud3 {
		width: 72rpx;
		height: 53rpx;
		position: fixed;
		top: 400rpx;
		right: 69rpx;

		image {
			width: 72rpx;
			height: 53rpx;
		}
	}

	.titleimg {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		align-content: flex-start;
		width: 750rpx;
		position: fixed;
		left: 0;
		top: 240rpx;

		image {
			width: 521rpx;
			height: 94rpx;
		}
	}

	.img1 {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		align-content: flex-start;
		width: 750rpx;
		position: fixed;
		left: 0;
		top: 400rpx;

		image {
			width: 413rpx;
			height: 395rpx;
		}
	}

	.jindu {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: column;
		align-content: flex-start;
		position: fixed;
		left: 0;
		top: 900rpx;
		width: 750rpx;


		.jindu2 {
			width: 630rpx;
			height: 54rpx;
			background: url(https://images.wanjunshijie.com/mini/chuban/static/loading/progress1.png) no-repeat;
			background-size: 100% 100%;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			flex-wrap: nowrap;
			flex-direction: row;
			align-content: flex-start;
		}

		.jindu3 {
			width: 0rpx;
			height: 40rpx;
			background: url(https://images.wanjunshijie.com/mini/chuban/static/loading/progress2.png) no-repeat;
			background-size: 100% 100%;
			margin-left: 10rpx;
			margin-right: 10rpx;
			position: relative;

			image {
				width: 159rpx;
				height: 60rpx;
				position: absolute;
				right: -80rpx;
				top: -15rpx;
			}
		}

		.jinduInfo {
			font-size: 30rpx;
			font-family: PingFang;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 73px;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-wrap: nowrap;
			flex-direction: row;
			align-content: flex-start;

			text {
				font-weight: bold;
				margin-left: 10rpx;
			}
		}
	}
</style>

喜欢