HTML5,CSS3,前端技术教程分享

 找回密码
 成为会员

QQ登录

只需一步,快速开始

查看: 1151|回复: 1

[HTML5 Canvas] [在线演示]HTML5 Canvas clock 示例(三种效果) [复制链接]

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

[在线演示]HTML5 Canvas clock 示例(三种效果)
演示地址:http://www.html51.com/topic-demo-html5-clock.html


主要代码:
  1. function Clock (id)
  2. {
  3.     this.id      = id;
  4.     this.canvas  = document.getElementById(id);
  5.     this.context = this.canvas.getContext('2d');
  6.     this.canvas.__object__ = this;
  7.    
  8.     this.centerx = this.canvas.width / 2;
  9.     this.centery = this.canvas.height / 2;
  10.    
  11.     this.properties = [];
  12.     this.properties['clock.strokestyle']   = 'black';
  13.     this.properties['clock.gutter']        = 25;
  14.     this.properties['clock.shadow']        = true;
  15.     this.properties['clock.numbers']       = true;
  16.     this.properties['clock.background']    = true;
  17.     this.properties['clock.digital']       = true;
  18.     this.properties['clock.text.size']     = 12;
  19.     this.properties['clock.numbers.style'] = 'numbers';
  20.     this.properties['clock.centerpin']     = true;
  21.     this.properties['clock.hands.tails']   = true;
  22.     this.properties['clock.numbers.style.lines.linewidth'] = 13;

  23.     this.radius  = Math.min(this.canvas.width / 2, this.canvas.height / 2) - this.Get('clock.gutter');
  24. }
复制代码


可惜的是Chrome6不支持,html5还要再进化。
附件: 你需要登录才可以下载或查看附件。没有帐号?成为会员

使用道具 举报

Rank: 2Rank: 2

升级 
 
73.33%
发表于 2010-11-30 23:22:52 |显示全部楼层
Firefox下效果不错!
我爱html51.com,再也不用看英文资料了

使用道具 举报

您需要登录后才可以回帖 登录 | 成为会员

兼容HTML5的浏览器

手机版|HTML5|HTML5手机论坛|加速HTML5在中国的普及,HTML51.COM ( 苏ICP备08015043号 )  

GMT+8, 2012-5-20 03:39 , Processed in 0.094331 second(s), 18 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部