canvas之加载前出现加载logo的使用

canvas画布模拟加载页面出现加载logo的画面:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>页面2</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
<style type="text/css">
	.loading{
		position: fixed;
		width: 100%;
		height: 100%;
		z-index: 555555;
		background:#ddd;
	}
	a{
		display: block;
		width: 500px;
		height: 500px;
		background: blue;
		line-height: 500px;
		color: #fff;
			}
</style>
</head>
<body>
    <div style="text-align: center;">
    	
    	<div class="loading" id="isshow">
    		<canvas id="loading" style="margin-top:100px; "></canvas>
    		
    	</div>
    	<a href="page1.html">页面</a>
    </div>
</body>
<script type="text/javascript">
	var gettext=0;
	function loading(){
	var loading=document.getElementById('loading');
	var loadingcontent=loading.getContext('2d');
	var text="加载中";
	var addtext="."
	loadingcontent.font = "35px 宋体";  
    loadingcontent.fillStyle = "black"; 
	gettext+=1;
	if(gettext<=4){
		if(gettext==1){
		loadingcontent.clearRect(0,0,loading.width,loading.height); 
		loadingcontent.fillText('加载中',30,40)
		}
		if(gettext==2){
		loadingcontent.clearRect(0,0,loading.width,loading.height); 
		loadingcontent.fillText('加载中。',30,40)
		}
		if(gettext==3){
		loadingcontent.clearRect(0,0,loading.width,loading.height); 
		loadingcontent.fillText('加载中。。',30,40)
		}
		if(gettext==4){
		loadingcontent.clearRect(0,0,loading.width,loading.height); 
		loadingcontent.fillText('加载中。。。',30,40)
		}localStorage.i='0';
		
	}if(gettext==6){
		gettext=0;
		localStorage.i='1';
	}
	console.log(localStorage.i)
	}
	window.onload=function() {
		var showtime=setInterval("loading()",1000);
		var cancel=setInterval('clear()',1000);
		
	}

	function clear(){
		var ishow=document.getElementById('isshow');
		if(localStorage.i=='1'){
			ishow.style.display='none';
		}
	}
	
</script>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值