- 注册时间
- 2010-7-26
- 最后登录
- 2012-4-24
- 阅读权限
- 200
- 积分
- 1415
- 精华
- 6
- 帖子
- 542
     
|
发表于 2010-10-15 23:03:27
|显示全部楼层
[在线演示]HTML5 Canvas clock 示例(三种效果)
演示地址:http://www.html51.com/topic-demo-html5-clock.html
主要代码:
- function Clock (id)
- {
- this.id = id;
- this.canvas = document.getElementById(id);
- this.context = this.canvas.getContext('2d');
- this.canvas.__object__ = this;
-
- this.centerx = this.canvas.width / 2;
- this.centery = this.canvas.height / 2;
-
- this.properties = [];
- this.properties['clock.strokestyle'] = 'black';
- this.properties['clock.gutter'] = 25;
- this.properties['clock.shadow'] = true;
- this.properties['clock.numbers'] = true;
- this.properties['clock.background'] = true;
- this.properties['clock.digital'] = true;
- this.properties['clock.text.size'] = 12;
- this.properties['clock.numbers.style'] = 'numbers';
- this.properties['clock.centerpin'] = true;
- this.properties['clock.hands.tails'] = true;
- this.properties['clock.numbers.style.lines.linewidth'] = 13;
- this.radius = Math.min(this.canvas.width / 2, this.canvas.height / 2) - this.Get('clock.gutter');
- }
复制代码
可惜的是Chrome6不支持,html5还要再进化。
|
|