Last active
December 15, 2015 08:29
-
-
Save foo9/5230897 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
html