1. createjs.com 下载 EaselJS.zip
2. 简单的数字增加例子
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Canvas</title> <script src="easeljs-0.8.0.combined.js"></script> </head> <body> <script src="myjavascript.js"></script> </body> </html>
var canvas; var CANVAS_WIDTH = 500; var CANVAS_HEIGHT = 500; var stage; var txt; var count = 0; window.onload = function () { createCanvas(); stage = new createjs.Stage(canvas); txt = new createjs.Text("Hello World","20px Arial","#ff7700"); stage.addChild(txt); createjs.Ticker.addEventListener("tick",handleTick); createjs.Ticker.setFPS(30); } function createCanvas(){ document.body.innerHTML = "<canvas id=\"mycanvas\" width=\"" + CANVAS_WIDTH + "\" height=\"" + CANVAS_HEIGHT + "\" ></canvas>"; canvas = document.getElementById("mycanvas"); } function handleTick(){ count++; txt.text = count; stage.update(); }
增加中....
时间: 2024-11-05 14:36:58