猿问

照抄的代码与视频效果不同,帮我看看哪里错了5555

57c4284200017c0905000199.jpg

57c428430001033b05000123.jpg

57c42843000162cb05000103.jpg

var WINDOW_WIDTH=1024;

var WINDOW_HEIGHT=768;

var RADIUS=8;

var MARGIN_TOP=60;

var MARGIN_LEFT=30;

window.onload=function(){

var canvas=document.getElementById('Canvas');

var context=canvas.getContext("2d");

canvas.width=WINDOW_WIDTH;

canvas.height=WINDOW_HEIGHT;

rendet(context)

}

function rendet(ctx){

var hours=12;

var minutes=34;

var seconds=56;

rendetDigit(MARGIN_LEFT,MARGIN_TOP,parseInt(hours/10),ctx);

rendetDigit(MARGIN_LEFT+15*(RADIUS+1),MARGIN_TOP,parseInt(hours%10),ctx);

}

function rendetDigit(x,y,num,ctx){

ctx.fillStyle="rgb(0,102,153)";

for (var i = 0; i < digit[num].length; i++)

for (var j = 0; j < digit[num][i].length; j++)

if (digit[num][i][j]==1) {

ctx.beginPath();

ctx.arc(x+j*2*(RADIUS+1)+(RADIUS+1),x+i*2*(RADIUS+1)+(RADIUS+1),RADIUS,0,2*Math.PI);

ctx.closePath();

ctx.fill();

}


qq_西米露_03817471
浏览 1231回答 1
1回答

JustWannaHugU

function rendet(ctx)这个函数的事情吧
随时随地看视频慕课网APP

相关分类

Html5
我要回答