首页 > 代码库 > Canvas画布实现自定义时钟效果

Canvas画布实现自定义时钟效果

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>标题</title>
<meta name="keywords" content="">
<meta name="description" content="">
<style>
	*{margin:0; padding:0; list-style:none;}
	.box{
		width: 420px;
		height: 420px;
		margin: 50px auto 0;
	}
	#cvs{
		background: #B1A6BE;
	}
</style>
</head>
<body>

	<div class="box">
		<canvas id="cvs" width="420" height="420"></canvas>
	</div>
	
<script>
var cvs=document.getElementById(‘cvs‘);
var ctx=cvs.getContext(‘2d‘);
clock();
setInterval(clock,1000);
function clock(){
	var img=document.createElement(‘img‘);
	img.src=http://www.mamicode.com/‘01.jpg‘;>

  

Canvas画布实现自定义时钟效果