Skip to content

Commit

Permalink
Version 1.0.0 Milestone (#29)
Browse files Browse the repository at this point in the history
* Removes gulp, use pixify, fix dependencies

* Added the typings, PIXI getter mixin

* Adds missing playSound API
  • Loading branch information
bigtimebuddy authored Nov 28, 2016
1 parent dce740d commit e9c14dc
Show file tree
Hide file tree
Showing 22 changed files with 214 additions and 277 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
presets: [
["es2015", { "loose": true }],
]
}
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": [
"eslint:recommended"
],
"rules": {
"no-console": 0,
"no-debugger": 1
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"node": true,
"browser": true,
"es6": true
},
"globals": {
"PIXI": true
}
}
5 changes: 0 additions & 5 deletions .gitattributes

This file was deleted.

15 changes: 0 additions & 15 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ before_script:

script:
- npm run build
- xvfb-maybe npm test
- xvfb-maybe npm run coverage
- npm run docs
64 changes: 0 additions & 64 deletions gulpfile.js

This file was deleted.

148 changes: 148 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
// Typings for PixiAnimate 1.0.0, requires Pixi.js typings
declare namespace PIXI.animate {

export namespace utils {
export function hexToUint(hex:string|number):number;
export function fillFrames(timeline:boolean[], startFrame:number, duration:number);
export function deserializeKeyframes(keyframes:string):{[frame:string]:any};
export function deserializeShapes(str:string):Array<string|number>;
export function parseValue(prop:string, buffer:string): any;
export function upload(renderer:PIXI.WebGLRenderer, displayObject:PIXI.DisplayObject, done:Function): void;
export function addMovieClips(item:PIXI.DisplayObject): boolean;
}

export const sound:PIXI.utils.EventEmitter;

interface LoadOptions {
stage:any;
parent:PIXI.Container;
basePath:string;
}

type LoadCallback = (instance:MovieClip) => void;

export function load(StageRef:any, parent:PIXI.Container):PIXI.loaders.Loader;
export function load(StageRef:any, callback:LoadCallback):PIXI.loaders.Loader;
export function load(options:LoadOptions):PIXI.loaders.Loader;

type LabelMap = {[id:string]:number};

interface FrameLabel {
label:string;
position:number;
}

interface MovieClipOptions {
mode?:number;
startPosition?:number;
loop?:boolean;
labels?:LabelMap;
duration?:number;
framerate?:number;
}

export class MovieClip extends PIXI.DisplayObject {
public mode:number;
public startPosition:number;
public loop:boolean;
public selfAdvance:boolean;
public paused:boolean;
public actionsEnabled:boolean;
public autoReset:boolean;
public labels:FrameLabel[];
public labelsMap:LabelMap;
public elapsedTime:number;
public framerate:number;
public parentFramerate:number;
public totalFrames:number;
public currentFrame:number;

constructor(
options:number|MovieClipOptions,
duration?:number,
loop?:boolean,
framerate?:number,
labels?:LabelMap
);
addKeyframes(instance:PIXI.DisplayObject, keyframes:any):void;
addTimedMask(instance:PIXI.DisplayObject, keyframes:any):MovieClip;
am(instance:PIXI.DisplayObject, keyframes:any):MovieClip;
addTween(instance:PIXI.DisplayObject, properties:any, startFrame:number, duration?:number, ease?:Function):MovieClip;
tw(instance:PIXI.DisplayObject, properties:any, startFrame:number, duration?:number, ease?:Function): MovieClip;
addTimedChild(instance:PIXI.DisplayObject, startFrame:number, duration?:number, keyframes?:any):MovieClip;
at(instance:PIXI.DisplayObject, startFrame:number, duration?:number, keyframes?:any):MovieClip;
addAction(callback:Function, startFrame:number|string):MovieClip;
aa(callback:Function, startFrame:number):MovieClip;
play(): void;
stop(): void;
gotoAndPlay(positionOrLabel:string|number):void;
gotoAndStop(positionOrLabel:string|number):void;
playSound(alias:string, loop?:boolean):MovieClip;
ps(alias:string, loop?:boolean):MovieClip;
advance(time:number):void;
destroy():void;
static extend(child:Function):typeof MovieClip;
static e(child:Function):typeof MovieClip;
static INDEPENDENT:number;
static SINGLE_FRAME:number;
static SYNCED:number;
}

export class Tween {
public target:PIXI.DisplayObject;
public startProps:any;
public endProps:any;
public startFrame:number;
public duration:number;
public endFrame:number;
public ease:Function;
constructor(
target:PIXI.DisplayObject,
startProps:any,
endProps:any,
startFrame:number,
duration:number,
ease?:Function);
setPosition(currentFrame:number): void;
setToEnd(): void;
}

export class Timeline extends Array {
public target:PIXI.DisplayObject;
constructor(target:PIXI.DisplayObject);
addTween(instance:PIXI.DisplayObject, properties:any, startFrame:number, duration:number, ease?:Function):void;
getPropFromShorthand(instance:PIXI.DisplayObject, prop:string):boolean|number|PIXI.Sprite|PIXI.Graphics;
}

export class ShapesCache {
static add(id:string, draw:Array<string|number>):void;
static fromCache(id:string):void;
static removeAll():void;
static remove(id:string):void;
}

export class Animator {
static STOP_LABEL:string;
static LOOP_LABEL:string;
static play(instance:MovieClip, label:string, callback?:Function):AnimatorTimeline;
static to(instance:MovieClip, end:string|number, callback?:Function):AnimatorTimeline;
static fromTo(instance:MovieClip, start:string|number, end:string|number, loop?:boolean, callback?:Function):AnimatorTimeline;
static stop(instance:MovieClip): void;
static stopAll(): void;
}

export class AnimatorTimeline {
progress:number;
instance:MovieClip;
start:number;
end:number;
loop:boolean;
callback:Function;
stop(): void;
static create(instance:MovieClip, start:number, end:number, loop:boolean, callback?:Function): AnimatorTimeline;
}
}

declare module 'pixi-animate' {
export = PIXI.animate;
}
44 changes: 21 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,23 @@
"version": "0.7.4",
"main": "dist/pixi-animate.min.js",
"author": "Matt Karl <[email protected]>",
"dependencies": {
"loophole": "^1.1.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.6.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"chalk": "^1.1.3",
"del": "^2.2.0",
"electron-prebuilt": "^1.2.7",
"exorcist": "^0.4.0",
"eslint": "^3.10.2",
"floss": "^1.2.0",
"gh-pages": "^0.11.0",
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-header": "^1.7.1",
"gulp-jsbeautifier": "^2.0.3",
"gulp-preprocess": "^2.0.0",
"gulp-sequence": "^0.4.5",
"gulp-uglify": "^1.5.3",
"jaguarjs-jsdoc": "^1.0.0",
"js-md5": "^0.4.1",
"jsdoc": "^3.4.0",
"load-gulp-tasks": "^0.1.0",
"pixi.js": "^4.2.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
"pixify": "^1.7.0",
"rimraf": "^2.5.4"
},
"peerDependencies": {
"pixi.js": "^4.2.2"
},
"typings": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/jiborobot/pixi-animate"
Expand All @@ -41,20 +30,29 @@
},
"homepage": "https://github.com/jiborobot/pixi-animate",
"scripts": {
"build": "gulp",
"test": "gulp test",
"coverage": "npm test -- --coverage",
"clean": "rimraf docs coverage dist .publish",
"lint": "eslint src tests",
"prebuild": "npm run lint",
"build": "pixify --name pixi-animate -d dist -t babelify",
"test": "floss --path tests/index.js",
"coverage": "npm test -- -c dist/pixi-animate.js -s -h",
"test:debug": "npm test -- --debug",
"docs": "jsdoc -c jsdoc.conf.json -R README.md",
"start": "gulp watch",
"start": "npm run build -- --watch",
"predocs-live": "npm run docs",
"docs-live": "gh-pages -d docs",
"postversion": "gulp && npm test",
"postversion": "npm run build && npm test",
"publish:patch": "npm version patch && npm publish",
"publish:minor": "npm version minor && npm publish",
"publish:major": "npm version major && npm publish",
"postpublish": "git push && git push --tags && npm run docs-live"
},
"files": [
"dist/",
"LICENSE",
"package.json",
"README.md"
],
"keywords": [
"webgl",
"pixi",
Expand Down
7 changes: 5 additions & 2 deletions src/animate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import Tween from './Tween';
import Animator from './Animator';
import AnimatorTimeline from './AnimatorTimeline';

const VERSION = '/* @echo VERSION */';

/**
* @namespace PIXI.animate
*/
export default {
export {
Animator,
AnimatorTimeline,
load,
Expand All @@ -22,5 +24,6 @@ export default {
ShapesCache,
SymbolLoader,
Timeline,
Tween
Tween,
VERSION
};
Loading

0 comments on commit e9c14dc

Please sign in to comment.