-
制定画布大小由width、height元素属性符合标准,尽量不用css的方式查看全部
-
centerx: centery:查看全部
-
document.body.clientWidth ==> BODY对象宽度 document.body.clientHeight ==> BODY对象高度 document.documentElement.clientWidth ==> 可见区域宽度 document.documentElement.clientHeight ==> 可见区域高度查看全部
-
ffff查看全部
-
ffff查看全部
-
ffff查看全部
-
绘制多个弧线查看全部
-
//删除已出屏幕的小球 var cnt = 0 for( var i = 0 ; i < balls.length ; i ++ ) if( balls[i].x + RADIUS > 0 && balls[i].x -RADIUS < WINDOW_WIDTH ) balls[cnt++] = balls[i] while( balls.length > Math.min(300,cnt) ){//Math.min(300,cnt)最多300个小球 balls.pop(); }查看全部
-
function update(){ //下落 ball.x += ball.vx;//x = vx*t ball.y += ball.vy;//y = vy*t ball.vy += ball.g;//vy = g*t //下边碰撞 if(ball.y >= 768 -ball.r){ ball.y = 768 -ball.r ball.vy = -ball.vy*0.9 } //右边碰撞 if(ball.x >= 1024 -ball.r){ ball.x = 1024 -ball.r ball.vx = -ball.vx*0.9 } //左边碰撞 if(ball.x <= ball.r){ ball.x = ball.r ball.vx = -ball.vx*0.9 } }查看全部
-
function update(){ ball.x += ball.vx;//x = vx*t ball.y += ball.vy;//y = vy*t ball.vy += ball.g;//vy = g*t }查看全部
-
if( nextSeconds != curSeconds ){ curShowTimeSeconds = nextShowTimeSeconds; } 如果没有这段,动画要每秒刷新20次,这段代码可以提高性能查看全部
-
用canvas定义七巧板 首先定义一个数组 var tangram=[//数组 {p:[{x:0,y:0},{x:800,y:0},{x:400,y:400}],color:"#caff67"},//类的对象 {p:[{x:0,y:0},{x:400,y:400},{x:0,y:800}],color:"#67bcef"}, {p:[{x:800,y:0},{x:800,y:400},{x:600,y:600},{x:600,y:200}],color:"#ef3d61"}, {p:[{x:600,y:200},{x:600,y:600},{x:400,y:400}],color:"#f9f51a"}, {p:[{x:400,y:400},{x:600,y:600},{x:400,y:800},{x:200,y:600}],color:"#a594c0"}, {p:[{x:200,y:600},{x:400,y:800},{x:0,y:800}],color:"#fa8ccc"}, {p:[{x:800,y:400},{x:800,y:800},{x:400,y:800}],color:"#f6ca29"} ];查看全部
-
context。moveto() context。lineto() context。beginpath() context。closepath()查看全部
-
当不指定画布宽高时,页面的画布大小为:300px宽150px高查看全部
-
render digit formula查看全部
举报
0/150
提交
取消