mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add initial EaselJS definitions and tests
This commit is contained in:
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
// Type definitions for EaselJS 0.5
|
||||
// Project: http://www.createjs.com/#!/EaselJS
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
interface AlphaMapFilter {
|
||||
alphaMap;
|
||||
constructor (alphaMap);
|
||||
applyFilter(ctx: any, x: any, y: any, width, height, targetCtx, targetX, targetY): void;
|
||||
clone();
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface AlphaMaskFilter {
|
||||
}
|
||||
|
||||
interface Bitmap extends DisplayObject {
|
||||
}
|
||||
|
||||
interface BitmapAnimation extends DisplayObject {
|
||||
}
|
||||
|
||||
interface BoxBlurFilter {
|
||||
}
|
||||
|
||||
interface ColorFilter {
|
||||
}
|
||||
|
||||
interface ColorMatrix {
|
||||
}
|
||||
|
||||
interface ColorMatrixFilter {
|
||||
}
|
||||
|
||||
interface Command {
|
||||
}
|
||||
|
||||
interface Container extends DisplayObject {
|
||||
}
|
||||
|
||||
interface DisplayObject {
|
||||
}
|
||||
|
||||
interface DOMElement extends DisplayObject {
|
||||
}
|
||||
|
||||
interface Graphics {
|
||||
}
|
||||
|
||||
interface Matrix2D {
|
||||
}
|
||||
|
||||
interface MouseEvent {
|
||||
}
|
||||
|
||||
interface MovieClip extends Container {
|
||||
}
|
||||
|
||||
interface Point {
|
||||
}
|
||||
|
||||
interface Rectangle {
|
||||
}
|
||||
|
||||
interface Shadow {
|
||||
}
|
||||
|
||||
interface Shape extends DisplayObject {
|
||||
}
|
||||
|
||||
interface SpriteSheet {
|
||||
}
|
||||
|
||||
interface SpriteSheetBuilder {
|
||||
}
|
||||
|
||||
interface SpriteSheetUtils {
|
||||
}
|
||||
|
||||
interface Stage extends Container {
|
||||
}
|
||||
|
||||
interface Text extends DisplayObject {
|
||||
}
|
||||
|
||||
interface Ticker {
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
}
|
||||
|
||||
interface UID {
|
||||
get(): number;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="../Definitions/easeljs-0.5.d.ts" />
|
||||
|
||||
function test_simple() {
|
||||
var canvas = document.getElementById('canvas');
|
||||
var stage = new Stage(canvas);
|
||||
var shape = new 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 SpriteSheet({
|
||||
"frames": {
|
||||
"width": 200,
|
||||
"numFrames": 64,
|
||||
"regX": 2,
|
||||
"regY": 2,
|
||||
"height": 361
|
||||
},
|
||||
"animations": { "jump": [26, 63], "run": [0, 25] },
|
||||
"images": ["./assets/runningGrant.png"]
|
||||
});
|
||||
|
||||
ss.getAnimation("run").frequency = 2;
|
||||
ss.getAnimation("run").next = "jump";
|
||||
ss.getAnimation("jump").next = "run";
|
||||
|
||||
var bitmapAnimation = new BitmapAnimation(ss);
|
||||
bitmapAnimation.scaleY = bitmapAnimation.scaleX = .4;
|
||||
|
||||
bitmapAnimation.gotoAndPlay("run");
|
||||
|
||||
Ticker.setFPS(60);
|
||||
Ticker.addListener(stage);
|
||||
stage.addChild(bitmapAnimation);
|
||||
}
|
||||
Reference in New Issue
Block a user