1. Pedro Ferreira
  2. createjs_ts_definitions

Commits

Pedro Ferreira  committed 7a99483

- add readme file
- extend createjs.BitmapAnimation in the BitmapAnimation example

  • Participants
  • Parent commits a961a98
  • Branches default

Comments (0)

Files changed (3)

File easeljs-0.5.0.d.ts

View file
  • Ignore whitespace
     }
 
     
-export class MouseEvent //HERE different type, nativeEvent... 
+export class MouseEvent 
     {
     constructor( type: string, stageX: number, stageY: number, target: DisplayObject, nativeEvent: NativeMouseEvent, pointerID: number, primary: bool, rawX: number, rawY: number );
     

File examples/BitmapAnimation/BitmapAnimation.ts

View file
  • Ignore whitespace
 /// <reference path="../../easeljs-0.5.0.d.ts" />
 
+interface MyBitmapAnimation extends createjs.BitmapAnimation
+    {
+    speed: number;
+    direction: number;
+    vX: number;
+    vY: number;
+    }
+
+
 window.onload = function()
 {
 init();
 	*/
 
 	// create a BitmapAnimation instance to display and play back the sprite sheet:
-	var bmpAnim = new createjs.BitmapAnimation(spriteSheet);
-
+	var bmpAnim = <MyBitmapAnimation> new createjs.BitmapAnimation(spriteSheet);
+    
+    
 	// start playing the first sequence:
 	bmpAnim.gotoAndPlay("walkRt");		//animate
 
 
 		// rather than creating a brand new instance each time, and setting every property, we
 		// can just clone the current one and overwrite the properties we want to change:
-		if (i < l-1) { bmpAnim = bmpAnim.clone(); }
+		if (i < l-1) { bmpAnim = <MyBitmapAnimation> bmpAnim.clone(); }
 	}
 
 	// we want to do some work before we update the canvas,
 	stage.update();
 }
 
-function angleChange( bmpAnim: createjs.BitmapAnimation, animation: string ) {
+function angleChange( bmpAnim: MyBitmapAnimation, animation: string ) {
 	//after each sequence ends update the rat's heading and adjust velocities to match
 	bmpAnim.direction -= 60;
 	var angle = bmpAnim.direction * (Math.PI/180);

File readme.md

View file
  • Ignore whitespace
+Hello, here you can find the typescript definitions of createjs's libraries.
+
+This is still in its early stage, so if you find something wrong (maybe some argument that should be optional) be sure to tell.
+
+
+Typescript version: 0.8.0
+
+EaselJS: 0.5.0
+TweenJS: 0.3.0
+SoundJS: 0.3.0
+PreloadJS: 0.2.0
+
+
+Usage:
+
+Just add at the beginning of the file:
+
+/// <reference path="path/to/easeljs-0.5.0.d.ts" />
+
+etc
+
+
+Some issues:
+
+- not sure about how to inherit from a createjs class (right now, I'm having a interface extend the class -- see the BitmapAnimation example)
+- properties that can have different types
+- methods that return different types
+- it doesn't seem to recognize the Image type