html5:<canvas>标签实现动态效果
来源:互联网 发布:wap游戏源码 编辑:程序博客网 时间:2024/04/28 15:53
<!DOCTYPE html >
<html>
<head>
<title> new document </title>
<meta charset="utf-8"/>
<link href="" type="text/css" rel="stylesheet"/>
</head>
<body>
<canvas id='canvas' width='600px'height='600px'style='background:orange'></canvas>
<script>
var canvas =document.getElementById('canvas');
var context=canvas.getContext('2d');
var x=-300;
//八卦
context.translate(canvas.width/2,canvas.height/2);
setInterval(function(){
context.rotate(Math.PI/180*1);
context.clearRect(-canvas.width/2,-canvas.height/2,canvas.width,canvas.height);
context.beginPath();
context.arc(300+x,300+x,100,Math.PI/2,Math.PI*3/2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,350+x,50,0,Math.PI*2);
context.fillStyle='#fff';
context.fill();
context.beginPath();
context.arc(300+x,300+x,100,Math.PI/2,Math.PI*3/2,true);
context.fill();
context.beginPath();
context.arc(300+x,250+x,50,0,Math.PI*2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,350+x,20,0,Math.PI*2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,250+x,20,0,Math.PI*2);
context.fillStyle='#fff';
context.fill();
},1);
</script>
</body>
</html>
<html>
<head>
<title> new document </title>
<meta charset="utf-8"/>
<link href="" type="text/css" rel="stylesheet"/>
</head>
<body>
<canvas id='canvas' width='600px'height='600px'style='background:orange'></canvas>
<script>
var canvas =document.getElementById('canvas');
var context=canvas.getContext('2d');
var x=-300;
//八卦
context.translate(canvas.width/2,canvas.height/2);
setInterval(function(){
context.rotate(Math.PI/180*1);
context.clearRect(-canvas.width/2,-canvas.height/2,canvas.width,canvas.height);
context.beginPath();
context.arc(300+x,300+x,100,Math.PI/2,Math.PI*3/2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,350+x,50,0,Math.PI*2);
context.fillStyle='#fff';
context.fill();
context.beginPath();
context.arc(300+x,300+x,100,Math.PI/2,Math.PI*3/2,true);
context.fill();
context.beginPath();
context.arc(300+x,250+x,50,0,Math.PI*2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,350+x,20,0,Math.PI*2);
context.fillStyle='#000';
context.fill();
context.beginPath();
context.arc(300+x,250+x,20,0,Math.PI*2);
context.fillStyle='#fff';
context.fill();
},1);
</script>
</body>
</html>
0 0
- html5:<canvas>标签实现动态效果
- HTML5 中的 canvas 标签 实现动画效果
- HTML5 Canvas实现透明效果
- 【HTML5】Canvas 实现放大镜效果
- html5 canvas实现刮刮卡效果
- HTML5 Canvas 六角光阑动态效果
- HTML5 Canvas 六角光阑动态效果
- HTML5 Canvas 六角光阑动态效果
- canvas标签实现动态小球
- HTML5 vedio标签与canvas的结合实现视频同步模糊效果
- [HTML5-Canvas] HTML5 <canvas> 标签
- Html5 canvas标签实现简易画图板
- HTML5 Canvas动画效果实现原理
- HTML5 Canvas动画效果实现原理
- html5 canvas 实现刮奖效果
- HTML5 Canvas动画效果实现原理
- HTML5 Canvas 实现的Loading效果
- HTML5 Canvas实现图片擦除效果
- 【CodeChef】Enormous Input Test
- C++中将数组作为形参时防止访问越界的几种方法
- 解析解、闭合解和数值解
- 绘制几何图形的软件
- Ilya and Sticks
- html5:<canvas>标签实现动态效果
- 内核线程与用户线程的区别 http://blog.csdn.net/wangkechuang/article/details/7883170
- Vitaliy and Pie
- java基础-显示代码,构造代码块 , 构造函数的初始化顺序
- Java 接口和抽象类区别
- 面试准备之内存对齐
- ssl协议的身份认证和数据传输
- h264解码时的AVCDecoderConfigurationRecord 与 CodecPrivateData
- try-catch-finally-return的执行顺序