首页 > 代码库 > HTML——canvas1
HTML——canvas1
1 <html> 2 <head> 3 <script src="easeljs-0.7.1.min.js"></script> 4 </head> 5 <body> 6 <canvas id="canvas" width="500px" height="500px"></canvas> 7 <script> 8 var canvas; 9 var stage;10 var txt;11 var count=0;12 //window.onload 页面数据初始化之类的工作13 window.onload=function(){14 canvas=document.getElementById("canvas");15 //创建一个新舞台16 stage=new createjs.Stage(canvas);17 //创建一个新文本(文本,大小,字体,颜色)18 txt =new createjs.Text("number->","20px Arial","#ff7700"); 19 //把这个文本添加到舞台中20 stage.addChild(txt);21 //FPS 每秒中页面刷新的次数(frames per second)22 createjs.Ticker.setFPS(5);23 //添加侦听事件并处理函数24 createjs.Ticker.addEventListener("tick",tick);25 26 }27 28 function tick(e){29 count++;30 txt.text="number->"+count+"!";31 //更新舞台的数据32 stage.update();33 }34 </script>35 </body>36 </html>
HTML——canvas1
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。