mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
added type information in the test code.
This commit is contained in:
@@ -4,17 +4,16 @@ var stage: any;
|
||||
var myContext2D: any;
|
||||
|
||||
function test_simple() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas');
|
||||
var stage = new createjs.Stage(canvas);
|
||||
var shape = new createjs.Shape();
|
||||
var canvas: HTMLCanvasElement = <HTMLCanvasElement>document.getElementById('canvas');
|
||||
var stage: createjs.Stage = new createjs.Stage(canvas);
|
||||
var shape: createjs.Shape = new createjs.Shape();
|
||||
shape.graphics.beginFill('rgba(255,0,0,1)').drawRoundRect(0, 0, 120, 120, 10);
|
||||
stage.addChild(shape);
|
||||
stage.update();
|
||||
|
||||
}
|
||||
|
||||
function test_animation() {
|
||||
var ss = new createjs.SpriteSheet({
|
||||
var ss: createjs.SpriteSheet = new createjs.SpriteSheet({
|
||||
"frames": {
|
||||
"width": 200,
|
||||
"numFrames": 64,
|
||||
@@ -30,7 +29,7 @@ function test_animation() {
|
||||
ss.getAnimation("run").next = "jump";
|
||||
ss.getAnimation("jump").next = "run";
|
||||
|
||||
var sprite:createjs.Sprite = new createjs.Sprite(ss);
|
||||
var sprite: createjs.Sprite = new createjs.Sprite(ss);
|
||||
sprite.scaleY = sprite.scaleX = .4;
|
||||
|
||||
sprite.gotoAndPlay("run");
|
||||
@@ -41,12 +40,12 @@ function test_animation() {
|
||||
}
|
||||
|
||||
function test_graphics() {
|
||||
var g = new createjs.Graphics();
|
||||
var g: createjs.Graphics = new createjs.Graphics();
|
||||
g.setStrokeStyle(1);
|
||||
g.beginStroke(createjs.Graphics.getRGB(0, 0, 0));
|
||||
g.beginFill(createjs.Graphics.getRGB(255, 0, 0));
|
||||
g.drawCircle(0, 0, 3);
|
||||
var s = new createjs.Shape(g);
|
||||
var s: createjs.Shape = new createjs.Shape(g);
|
||||
s.x = 100;
|
||||
s.y = 100;
|
||||
stage.addChild(s);
|
||||
|
||||
@@ -7,7 +7,7 @@ createjs.Sound.addEventListener("fileload", createjs.proxy(this.loadHandler, thi
|
||||
createjs.Sound.registerSound("path/to/mySound.mp3|path/to/mySound.ogg", "sound");
|
||||
function loadHandler(event):void {
|
||||
// This is fired for each sound that is registered.
|
||||
var instance = createjs.Sound.play("sound"); // play using id. Could also use full sourcepath or event.src.
|
||||
var instance: createjs.SoundInstance = createjs.Sound.play("sound"); // play using id. Could also use full sourcepath or event.src.
|
||||
instance.addEventListener("complete", createjs.proxy(this.handleComplete, this));
|
||||
instance.setVolume(0.5);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
///<reference path="../easeljs/easeljs.d.ts"/>
|
||||
|
||||
var target: createjs.DisplayObject = new createjs.DisplayObject();
|
||||
var Tween = createjs.Tween;
|
||||
var Tween: createjs.Tween = createjs.Tween;
|
||||
|
||||
// source : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html
|
||||
// Chainable modules :
|
||||
|
||||
Reference in New Issue
Block a user