Skip to content

Commit

Permalink
Version 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ted Patrick committed Nov 11, 2014
1 parent 7c26119 commit dac5522
Show file tree
Hide file tree
Showing 124 changed files with 59,419 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
npm-debug.log
node_modules/
!/node_modules/
!src/node_modules/
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
txt
===

A <canvas> font and typesetting engine for @CreateJS.
A <canvas> font and typesetting engine for @CreateJS.

Site at http://txtjs.com.
102 changes: 102 additions & 0 deletions definitions/createjs/createjs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1
// Project: http://www.createjs.com/#!/EaselJS
// Definitions by: Pedro Ferreira <https://bitbucket.org/drk4>, Chris Smith <https://github.com/evilangelist>, Satoru Kimura <https://github.com/gyohk>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/*
Copyright (c) 2012 Pedro Ferreira
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Common class and methods for CreateJS.
// Library documentation : http://www.createjs.com/Docs/EaselJS/modules/EaselJS.html
// Library documentation : http://www.createjs.com/Docs/PreloadJS/modules/PreloadJS.html
// Library documentation : http://www.createjs.com/Docs/SoundJS/modules/SoundJS.html
// Library documentation : http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html


declare module createjs {
export class Event {
constructor(type: string, bubbles: boolean, cancelable: boolean);

// properties
bubbles: boolean;
cancelable: boolean;
currentTarget: any; // It is 'Object' type officially, but 'any' is easier to use.
defaultPrevented: boolean;
eventPhase: number;
immediatePropagationStopped: boolean;
propagationStopped: boolean;
removed: boolean;
target: any; // It is 'Object' type officially, but 'any' is easier to use.
timeStamp: number;
type: string;

// other event payloads
data: any;
delta: number;
error: string;
id: string;
item: any;
loaded: number;
name: string;
next: string;
params: any;
paused: boolean;
progress: number;
rawResult: any;
result: any;
runTime: number;
src: string;
time: number;
total: number;

// methods
clone(): Event;
preventDefault(): void;
remove(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
toString(): string;
}

export class EventDispatcher {
constructor();

// methods
addEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): Function;
addEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): Function;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): Object;
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): Object;
dispatchEvent(eventObj: Object, target?: Object): boolean;
dispatchEvent(eventObj: string, target?: Object): boolean;
dispatchEvent(eventObj: Event, target?: Object): boolean;
hasEventListener(type: string): boolean;
static initialize(target: Object): void;
off(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
off(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
off(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
off(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
on(type: string, listener: (eventObj: Object) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: (eventObj: Object) => void, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function;
on(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
on(type: string, listener: { handleEvent: (eventObj: Object) => void; }, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Object;
removeAllEventListeners(type?: string): void;
removeEventListener(type: string, listener: (eventObj: Object) => boolean, useCapture?: boolean): void;
removeEventListener(type: string, listener: (eventObj: Object) => void, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => boolean; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }, useCapture?: boolean): void;
removeEventListener(type: string, listener: Function, useCapture?: boolean): void; // It is necessary for "arguments.callee"
toString(): string;
willTrigger(type: string): boolean;
}

export function indexOf(array: any[], searchElement: Object): number;

export function proxy(method: (eventObj: Object) => boolean, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: (eventObj: Object) => void, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => boolean; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
export function proxy(method: { handleEvent: (eventObj: Object) => void; }, scope: Object, ...arg: any[]): (eventObj: Object) => any;
}
68 changes: 68 additions & 0 deletions definitions/easeljs/easeljs-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/// <reference path="easeljs.d.ts" />

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();
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({
"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").speed = 2;
ss.getAnimation("run").next = "jump";
ss.getAnimation("jump").next = "run";

var sprite = new createjs.Sprite(ss);
sprite.scaleY = sprite.scaleX = .4;

sprite.gotoAndPlay("run");

createjs.Ticker.setFPS(60);
createjs.Ticker.addEventListener('tick', stage);
stage.addChild(sprite);
}

function test_graphics() {
var g = 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);
s.x = 100;
s.y = 100;
stage.addChild(s);
stage.update();

var myGraphics: createjs.Graphics;
myGraphics.beginStroke("#F00").beginFill("#00F").drawRect(20, 20, 100, 50).draw(myContext2D);
}

function colorMatrixTest() {
var shape = new createjs.Shape().set({ x: 100, y: 100 });
shape.graphics.beginFill("#ff0000").drawCircle(0, 0, 50);

var matrix = new createjs.ColorMatrix().adjustHue(180).adjustSaturation(100);
shape.filters = [
new createjs.ColorMatrixFilter(matrix)
];

shape.cache(-50, -50, 100, 100);
}
Loading

0 comments on commit dac5522

Please sign in to comment.