4.3 createjs

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();
}

  技术分享增加中....

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。