Created
April 26, 2013 01:25
-
-
Save joshtynjala/5464522 to your computer and use it in GitHub Desktop.
My First TypeScript
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
/// <reference path="libs/easeljs/easeljs.d.ts" /> | |
/// <reference path="libs/underscore/underscore.d.ts" /> | |
class Main extends createjs.Stage | |
{ | |
constructor(canvas: HTMLCanvasElement) | |
{ | |
super(canvas); | |
_.bindAll(this); | |
createjs.Ticker.setFPS(60); | |
var circle = new createjs.Shape(); | |
circle.graphics.beginFill("red").drawCircle(0, 0, 40); | |
circle.x = circle.y = 50; | |
this.addChild(circle); | |
createjs.Tween.get(circle).to({ x: 100 }, 1000); | |
} | |
start() | |
{ | |
createjs.Ticker.addEventListener("tick", this.tickListener); | |
} | |
stop() | |
{ | |
createjs.Ticker.removeEventListener("tick", this.tickListener); | |
} | |
private tickListener(event: Object) | |
{ | |
this.update(); | |
} | |
} | |
window.onload = () => | |
{ | |
var el:HTMLCanvasElement = <HTMLCanvasElement>document.getElementById("content"); | |
var main = new Main(el); | |
main.start(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment