js绘制时钟
var canvas;
function clock()
{
canvas = document.createElement('canvas');
canvas.width=200;
canvas.height=200;
var ctx = canvas.getContext('2d');
if(ctx){
var timerId;
var frameRate = 60;
function canvObject(){
this.x = 0;
this.y = 0;
this.rotation = 0;
this.borderWidth = 2;
this.borderColor = '#000000';
this.fill = false;
this.fillColor = '#ff0000';
this.update = function(){
if(!this.ctx)throw new Error('你没有指定ctx对象。');
var ctx = this.ctx
ctx.save();
ctx.lineWidth = this.borderWidth;
ctx.strokeStyle = this.borderColor;
ctx.fillStyle = this.fillColor;