HTML5技术

canvas-8searchLight2.html - Cynthia娆墨旧染

字号+ 作者:H5之家 来源:H5之家 2015-11-23 15:17 我要评论( )

Document The current browser does not support Canvas, can replace the browser a try! {x : 400 ,y : 400 ,radius : 150 ,vx : Math.random() ,vy : Math.random() }window.onload = function (){ );canvas.width = 1024 ;canvas.height = 768 ; )){ );s

Document The current browser does not support Canvas, can replace the browser a try! { x : 400, y : 400, radius : 150, vx : Math.random() , vy : Math.random() } window.onload = function(){ ); canvas.width = 1024; canvas.height = 768; )){ ); setInterval(function(){ draw(context); update(canvas.width,canvas.height); },40); }else{ alert(); } } function draw(cxt){ cxt.canvas; cxt.clearRect(,canvas.width,canvas.height); cxt.save(); cxt.beginPath(); cxt.fillStyle ; cxt.fillRect(,canvas.width,canvas.height) cxt.closePath(); cxt.beginPath(); cxt.arc(searchLight.x,searchLight.y,searchLight.radius,); cxt.fillStyle ; cxt.fill(); cxt.clip(); cxt.closePath(); cxt.font ; cxt.textAlign ; cxt.textBaseline ; cxt.fillStyle ; cxt.fillText(); cxt.fillText(); cxt.fillText(); cxt.restore(); } function update(canvasWidth,canvasHeight){ searchLight.x += searchLight.vx; searchLight.y += searchLight.vy; ){ searchLight.vx = -searchLight.vx; searchLight.x = searchLight.radius; } canvasWidth){ searchLight.vx = -searchLight.vx; searchLight.x searchLight.radius; } ){ searchLight.vy = -searchLight.vy; searchLight.y = searchLight.radius; } canvasHeight){ searchLight.vy = -searchLight.vy; searchLight.y searchLight.radius; } }

 

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • canvas-a13prototype.html - Cynthia娆墨旧染

    canvas-a13prototype.html - Cynthia娆墨旧染

    2015-11-24 12:17

  • canvas-a10isPointPath.html - Cynthia娆墨旧染

    canvas-a10isPointPath.html - Cynthia娆墨旧染

    2015-11-23 17:51

  • canvas-star6-drawMoon.html - CynthiaWU

    canvas-star6-drawMoon.html - CynthiaWU

    2015-11-20 17:57

  • canvas-arc.html - CynthiaWU

    canvas-arc.html - CynthiaWU

    2015-11-19 17:35

网友点评