波浪竖线样式的加载动画

46 篇文章 0 订阅
41 篇文章 1 订阅
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
		<style>
			* {
				margin: 0;
				padding: 0;
			}
			
			.loading {
				height: 100%;
				width: 100%;
				position: fixed;
				background: rgba(255, 255, 255, 1);
				z-index: 9999999999999999999999999999;
			}
			
			.loading>p {
				position: absolute;
				left: 54px;
				right: 0;
				bottom: 61.8%;
				margin: auto;
				height: 30px;
				width: 120px;
			}
			
			.loading>p i {
				display: block;
				float: left;
				margin: 0 5px;
				width: 5px;
				height: 30px;
				background: #000;
				transform: scaleY(0.3);
				animation: loading 1s ease infinite alternate;
			}
			
			.loading>p i:nth-child(2) {
				animation-delay: 0.1s;
			}
			
			.loading>p i:nth-child(3) {
				animation-delay: 0.2s;
			}
			
			.loading>p i:nth-child(4) {
				animation-delay: 0.3s;
			}
			
			.loading>p i:nth-child(5) {
				animation-delay: 0.4s;
			}
			
			@keyframes loading {
				40%,
				100% {
					transform: scaleY(0.3);
				}
				20% {
					transform: scaleY(1);
				}
			}
		</style>
	</head>

	<body>
		<div class="loading">
			<p>
				<i></i>
				<i></i>
				<i></i>
				<i></i>
				<i></i>
			</p>
		</div>
	</body>
	<script>
		$(window).load(function() {
			$('.loading').fadeOut();
		});
	</script>

</html>

(刚刚发现技术胖也写过。地址贴上,可以看看。技术胖loading css实现

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
js代码 [removed] var wave = (function () { var ctx; var waveImage; var canvasWidth; var canvasHeight; var needAnimate = false; function init (callback) { var wave = document.getElementById('wave'); var canvas = document.createElement('canvas'); if (!canvas.getContext) return; ctx = canvas.getContext('2d'); canvasWidth = wave.offsetWidth; canvasHeight = wave.offsetHeight; canvas.setAttribute('width', canvasWidth); canvas.setAttribute('height', canvasHeight); wave.appendChild(canvas); waveImage = new Image(); waveImage.onload = function () { waveImage.onload = null; callback(); } waveImage.src = 'images/wave.png'; } function animate () { var waveX = 0; var waveY = 0; var waveX_min = -203; var waveY_max = canvasHeight * 0.7; var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); }; function loop () { ctx.clearRect(0, 0, canvasWidth, canvasHeight); if (!needAnimate) return; if (waveY < waveY_max) waveY = 1.5; if (waveX < waveX_min) waveX = 0; else waveX -= 3; ctx.globalCompositeOperation = 'source-over'; ctx.beginPath(); ctx.arc(canvasWidth/2, canvasHeight/2, canvasHeight/2, 0, Math.PI*2, true); ctx.closePath(); ctx.fill(); ctx.globalCompositeOperation = 'source-in'; ctx.drawImage(waveImage, waveX, canvasHeight - waveY); requestAnimationFrame(loop); } loop(); } function start () { if (!ctx) return init(start); needAnimate = true; setTimeout(function () { if (needAnimate) animate(); }, 500); } function stop () { needAnimate = false; } return {start: start, stop: stop}; }()); wave.start(); [removed]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值