Skip to content

Instantly share code, notes, and snippets.

@foo9
Last active December 15, 2015 08:29
Show Gist options
  • Save foo9/5230897 to your computer and use it in GitHub Desktop.
Save foo9/5230897 to your computer and use it in GitHub Desktop.
var elementId = "testCanvas";
var stageWidth = 300;
var stageHeight = 300;
var backgroundColor = "#abc";
var stage;
function init() {
var canvas = document.getElementById(elementId);
canvas.style.width = stageWidth + "px";
canvas.style.height = stageHeight + "px";
stage = new createjs.Stage(canvas);
var background = new createjs.Shape();
background.graphics.beginFill(backgroundColor).drawRect(0, 0, stageWidth, stageHeight).endFill();
stage.addChild(background);
if (createjs.Touch.isSupported()) {
createjs.Touch.enable();
}
createjs.Ticker.useRAF = true;
createjs.Ticker.setFPS(24);
createjs.Ticker.addEventListener("tick", handleTick);
stage.update();
}
function handleTick() {
stage.update();
}
init();
@foo9
Copy link
Author

foo9 commented Mar 24, 2013

html

<canvas id="testCanvas"></canvas>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment