feat: Add Be and tbd skill, also added Roadmap file

This commit is contained in:
2026-05-10 16:32:12 -04:00
parent 3500ade13f
commit 0bb8885802
29587 changed files with 10611695 additions and 0 deletions

View File

@@ -0,0 +1,229 @@
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _AnimatorTimeline = require("./AnimatorTimeline");
var _AnimatorTimeline2 = _interopRequireDefault(_AnimatorTimeline);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// Static collection of timelines
var timelines = [];
/**
* Play animation via start/stop frame labels
* @class Animator
* @memberof PIXI.animate
*/
var Animator = function () {
function Animator() {
_classCallCheck(this, Animator);
}
/**
* Play an animation by frame labels. For instance, play animation sequence from
* "idle" to "idle_stop" or "idle_loop". If no event label is provided, will
* play the entire duration of the MovieClip.
* @method PIXI.animate.Animator#play
* @static
* @param {PIXI.animate.MovieClip} instance Movie clip to play.
* @param {String|Function} [label] The frame label event to call, if no event is provided
* will use the entire length of the MovieClip. Can also be the callback.
* @param {Function} [callback] Optional callback when complete
* @return {PIXI.animate.AnimatorTimeline} Timeline object for stopping or getting progress.
*/
Animator.play = function play(instance, label, callback) {
var loop = false;
var start = void 0,
end = void 0;
var labelIsFunction = typeof label === "function";
if (label === undefined || labelIsFunction) {
start = 0;
end = instance.totalFrames - 1;
if (labelIsFunction) {
callback = label;
}
} else {
start = instance.labelsMap[label];
end = instance.labelsMap[label + this.STOP_LABEL];
if (end === undefined) {
end = instance.labelsMap[label + this.LOOP_LABEL];
loop = true;
}
if (start === undefined) {
throw new Error("No start label matching '" + label + "'");
} else if (end === undefined) {
throw new Error("No end label matching '" + label + "'");
}
}
return this.fromTo(instance, start, end, loop, callback);
};
/**
* Play an animation from the current frame to an end frame or label.
* @method PIXI.animate.Animator#to
* @static
* @param {PIXI.animate.MovieClip} instance Movie clip to play.
* @param {String|Number} end The end frame or label.
* @param {Function} [callback] Optional callback when complete
* @return {PIXI.animate.AnimatorTimeline} Timeline object for stopping or getting progress.
*/
Animator.to = function to(instance, end, callback) {
return this.fromTo(instance, instance.currentFrame, end, false, callback);
};
/**
* Play a MovieClip from a start to end frame.
* @method PIXI.animate.Animator#fromTo
* @static
* @param {PIXI.animate.MovieClip} instance Movie clip to play.
* @param {Number|String} start The starting frame index or label.
* @param {Number|String} end The ending frame index or label.
* @param {Boolean} [loop=false] If the animation should loop.
* @param {Function} [callback] Optional callback when complete
* @return {PIXI.animate.AnimatorTimeline} Timeline object for stopping or getting progress.
*/
Animator.fromTo = function fromTo(instance, start, end, loop, callback) {
if (typeof start === "string") {
var startLabel = start;
start = instance.labelsMap[startLabel];
if (start === undefined) {
throw new Error("No start label matching '" + startLabel + "'");
}
}
if (typeof end === "string") {
var endLabel = end;
end = instance.labelsMap[endLabel];
if (end === undefined) {
throw new Error("No end label matching '" + endLabel + "'");
}
}
if (start < 0) {
throw new Error('Start frame is out of bounds');
}
if (end >= instance.totalFrames) {
throw new Error('End frame is out of bounds');
}
if (start >= end) {
throw new Error('End frame is before start frame');
}
// Stop any animation that's playing
this.stop(instance);
loop = !!loop;
// Add a new timeline
var timeline = _AnimatorTimeline2.default.create(instance, start, end, loop, callback);
this._timelines.push(timeline);
// Set the current frame
if (instance.currentFrame !== start) {
instance.gotoAndPlay(start);
} else {
instance.play();
}
return timeline;
};
/**
* Stop the animation by instance.
* @method PIXI.animate.Animator#stop
* @static
* @param {PIXI.animate.MovieClip} instance Movie clip to play.
*/
Animator.stop = function stop(instance) {
for (var i = 0, len = this._timelines.length; i < len; i++) {
var timeline = this._timelines[i];
if (timeline.instance === instance) {
this._internalStop(timeline);
break;
}
}
};
/**
* Stop all the currently playing animations.
* @method PIXI.animate.Animator#stopAll
* @static
*/
Animator.stopAll = function stopAll() {
for (var i = this._timelines.length - 1; i >= 0; i--) {
this._internalStop(this._timelines[i]);
}
};
/**
* Stop the animation
* @method PIXI.animate.Animator#_internalStop
* @private
* @static
* @param {PIXI.animate.AnimatorTimeline} timeline Timeline to stop.
*/
Animator._internalStop = function _internalStop(timeline) {
this._timelines.splice(this._timelines.indexOf(timeline), 1);
timeline.instance.stop();
timeline.destroy();
};
_createClass(Animator, null, [{
key: "_timelines",
/**
* The collection of timelines
* @name {Array<PIXI.animate.AnimatorTimeline>} PIXI.animate.Animator#_timelines
* @private
* @static
*/
get: function get() {
return timelines;
}
/**
* Suffix added to label for a stop.
* @name {String} PIXI.animate.Animator.STOP_LABEL
* @static
* @default "_stop"
*/
}, {
key: "STOP_LABEL",
get: function get() {
return "_stop";
}
/**
* Suffix added to label for a loop.
* @name {String} PIXI.animate.Animator.LOOP_LABEL
* @static
* @default "_loop"
*/
}, {
key: "LOOP_LABEL",
get: function get() {
return "_loop";
}
}]);
return Animator;
}();
module.exports = Animator;
//# sourceMappingURL=Animator.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,193 @@
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var pool = [];
/**
* Represents a single animation play.
* @class AnimatorTimeline
* @memberof PIXI.animate
*/
var AnimatorTimeline = function () {
function AnimatorTimeline() {
_classCallCheck(this, AnimatorTimeline);
this._update = this.update.bind(this);
this.init(null, 0, 0, false, null);
}
/**
* The pool of timelines to use
* @method PIXI.animate.AnimatorTimeline#init
* @param {PIXI.animate.MovieClip} instance
* @param {Number} start
* @param {Number} end
* @param {Boolean} loop
* @param {Function} callback
* @private
*/
AnimatorTimeline.prototype.init = function init(instance, start, end, loop, callback) {
/**
* Instance of clip to play.
* @name PIXI.animate.AnimatorTimeline#instance
* @type {PIXI.animate.MovieClip}
* @readOnly
*/
this.instance = instance;
/**
* `true` if the timeline is suppose to loop.
* @name PIXI.animate.AnimatorTimeline#loop
* @type {Boolean}
* @readOnly
*/
this.loop = loop;
/**
* Frame number of the starting farme.
* @name PIXI.animate.AnimatorTimeline#start
* @type {int}
* @readOnly
*/
this.start = start;
/**
* Frame number of the ending frame.
* @name PIXI.animate.AnimatorTimeline#end
* @type {int}
* @readOnly
*/
this.end = end;
/**
* Callback called when completed (non-looping animation).
* @name PIXI.animate.AnimatorTimeline#callback
* @type {Function}
* @readOnly
*/
this.callback = callback;
if (instance) {
instance.gotoAndStop(start);
instance._beforeUpdate = this._update;
}
};
/**
* Don't use after this
* @method PIXI.animate.AnimatorTimeline#destroy
* @private
*/
AnimatorTimeline.prototype.destroy = function destroy() {
this.instance._beforeUpdate = null;
this.init(null, 0, 0, false, null);
AnimatorTimeline._pool.push(this);
};
/**
* Is the animation complete
* @method PIXI.animate.AnimatorTimeline#update
* @param {PIXI.animate.MovieClip} instance
* @return {Function} Callback to do after updateTimeline
* @private
*/
AnimatorTimeline.prototype.update = function update(instance) {
var completed = void 0;
if (instance.currentFrame >= this.end) {
// In case we over-shoot the current frame becuase of low FPS
instance.currentFrame = this.end;
if (this.loop) {
// Update timeline so we get actions at the end frame
instance._updateTimeline();
instance.gotoAndPlay(this.start);
} else {
instance.stop();
if (this.callback) {
completed = this.callback;
}
this.stop(); // cleanup timeline
}
}
return completed;
};
/**
* Stop the animation, cannot be reused.
* @method PIXI.animate.AnimatorTimeline#stop
*/
AnimatorTimeline.prototype.stop = function stop() {
PIXI.animate.Animator._internalStop(this);
};
/**
* The progress from 0 to 1 of the playback.
* @name PIXI.animate.AnimatorTimeline#progress
* @type {Number}
* @readOnly
*/
/**
* Create a new timeline
* @method PIXI.animate.AnimatorTimeline.create
* @static
* @param {PIXI.animate.MovieClip} instance
* @param {Number} start
* @param {Number} end
* @param {Boolean} loop
* @param {Function} callback
* @return {PIXI.animate.AnimatorTimeline}
*/
AnimatorTimeline.create = function create(instance, start, end, loop, callback) {
var timeline;
if (this._pool.length) {
timeline = this._pool.pop();
} else {
timeline = new AnimatorTimeline();
}
timeline.init(instance, start, end, loop, callback);
return timeline;
};
_createClass(AnimatorTimeline, [{
key: "progress",
get: function get() {
var progress = (this.instance.currentFrame - this.start) / (this.end - this.start);
return Math.max(0, Math.min(1, progress)); // clamp
}
/**
* The pool of timelines to use
* @name PIXI.animate.AnimatorTimeline._pool
* @type {Array<PIXI.animate.AnimatorTimeline>}
* @static
* @private
*/
}], [{
key: "_pool",
get: function get() {
return pool;
}
}]);
return AnimatorTimeline;
}();
module.exports = AnimatorTimeline;
//# sourceMappingURL=AnimatorTimeline.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,100 @@
'use strict';
exports.__esModule = true;
var _load2 = require('./load');
var _load3 = _interopRequireDefault(_load2);
var _sound = require('./sound');
var _sound2 = _interopRequireDefault(_sound);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* Extends the PIXI.Application class to provide easy loading.
* ```
* const scene = new PIXI.animate.Scene();
* scene.load(lib.StageName);
* ```
* @class Scene
* @memberof PIXI.animate
* @param {Number} [width=800] Stage width
* @param {Number} [height=600] Stage height
* @param {Object} [renderOptions] See PIXI.Application for more info.
* @param {Boolean} [noWebGL=false] Disable WebGL
*/
var Scene = function (_PIXI$Application) {
_inherits(Scene, _PIXI$Application);
function Scene(width, height, renderOptions, noWebGL) {
_classCallCheck(this, Scene);
/**
* Reference to the global sound object
* @name PIXI.animate.Scene#sound
* @type {PIXI.animate.sound}
* @readOnly
*/
var _this = _possibleConstructorReturn(this, _PIXI$Application.call(this, width, height, renderOptions, noWebGL));
_this.sound = _sound2.default;
/**
* The stage object created.
* @name PIXI.animate.Scene#instance
* @type {PIXI.animate.MovieClip}
* @readOnly
*/
_this.instance = null;
return _this;
}
/**
* Load a stage scene and add it to the stage.
* @method PIXI.animate.Scene#load
* @param {Function} StageRef Reference to the stage class.
* @param {Function} [complete] Callback when finished loading.
* @param {String} [basePath] Optional base directory to prepend to assets.
* @return {PIXI.loaders.Loader} instance of PIXI resource loader
*/
Scene.prototype.load = function load(StageRef, complete, basePath) {
var _this2 = this;
return (0, _load3.default)(StageRef, this.stage, function (instance) {
_this2.instance = instance;
if (complete) {
complete(instance);
}
}, basePath);
};
/**
* Destroy and don't use after calling.
* @method PIXI.animate.Scene#destroy
* @param {Boolean} [removeView=false] `true` to remove canvas element.
*/
Scene.prototype.destroy = function destroy(removeView) {
if (this.instance) {
this.instance.destroy(true);
this.instance = null;
}
_PIXI$Application.prototype.destroy.call(this, removeView);
};
return Scene;
}(PIXI.Application);
exports.default = Scene;
//# sourceMappingURL=Scene.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/animate/Scene.js"],"names":["Scene","width","height","renderOptions","noWebGL","sound","instance","load","StageRef","complete","basePath","stage","destroy","removeView","PIXI","Application"],"mappings":";;;;AAAA;;;;AACA;;;;;;;;;;;;AAEA;;;;;;;;;;;;;IAaMA,K;;;AAEL,gBAAYC,KAAZ,EAAmBC,MAAnB,EAA2BC,aAA3B,EAA0CC,OAA1C,EAAmD;AAAA;;AAGlD;;;;;;AAHkD,+CAClD,6BAAMH,KAAN,EAAaC,MAAb,EAAqBC,aAArB,EAAoCC,OAApC,CADkD;;AASlD,QAAKC,KAAL;;AAEA;;;;;;AAMA,QAAKC,QAAL,GAAgB,IAAhB;AAjBkD;AAkBlD;;AAED;;;;;;;;;;iBAQAC,I,iBAAKC,Q,EAAUC,Q,EAAUC,Q,EAAU;AAAA;;AAClC,SAAO,oBAAKF,QAAL,EAAe,KAAKG,KAApB,EAA2B,UAACL,QAAD,EAAc;AAC/C,UAAKA,QAAL,GAAgBA,QAAhB;AACA,OAAIG,QAAJ,EAAc;AACbA,aAASH,QAAT;AACA;AACD,GALM,EAKJI,QALI,CAAP;AAMA,E;;AAED;;;;;;;iBAKAE,O,oBAAQC,U,EAAY;AACnB,MAAI,KAAKP,QAAT,EAAmB;AAClB,QAAKA,QAAL,CAAcM,OAAd,CAAsB,IAAtB;AACA,QAAKN,QAAL,GAAgB,IAAhB;AACA;AACD,8BAAMM,OAAN,YAAcC,UAAd;AACA,E;;;EAlDkBC,KAAKC,W;;kBAqDVf,K","file":"Scene.js","sourcesContent":["import load from './load';\nimport sound from './sound';\n\n/**\n * Extends the PIXI.Application class to provide easy loading.\n * ```\n * const scene = new PIXI.animate.Scene();\n * scene.load(lib.StageName);\n * ```\n * @class Scene\n * @memberof PIXI.animate\n * @param {Number} [width=800] Stage width\n * @param {Number} [height=600] Stage height\n * @param {Object} [renderOptions] See PIXI.Application for more info.\n * @param {Boolean} [noWebGL=false] Disable WebGL\n */\nclass Scene extends PIXI.Application {\n\n\tconstructor(width, height, renderOptions, noWebGL) {\n\t\tsuper(width, height, renderOptions, noWebGL);\n\n\t\t/**\n\t\t * Reference to the global sound object\n\t\t * @name PIXI.animate.Scene#sound\n\t\t * @type {PIXI.animate.sound}\n\t\t * @readOnly\n\t\t */\n\t\tthis.sound = sound;\n\n\t\t/**\n\t\t * The stage object created.\n\t\t * @name PIXI.animate.Scene#instance\n\t\t * @type {PIXI.animate.MovieClip}\n\t\t * @readOnly\n\t\t */\n\t\tthis.instance = null;\n\t}\n\n\t/**\n\t * Load a stage scene and add it to the stage.\n\t * @method PIXI.animate.Scene#load\n\t * @param {Function} StageRef Reference to the stage class.\n\t * @param {Function} [complete] Callback when finished loading.\n\t * @param {String} [basePath] Optional base directory to prepend to assets.\n\t * @return {PIXI.loaders.Loader} instance of PIXI resource loader\n\t */\n\tload(StageRef, complete, basePath) {\n\t\treturn load(StageRef, this.stage, (instance) => {\n\t\t\tthis.instance = instance;\n\t\t\tif (complete) {\n\t\t\t\tcomplete(instance);\n\t\t\t}\n\t\t}, basePath);\n\t}\n\n\t/**\n\t * Destroy and don't use after calling.\n\t * @method PIXI.animate.Scene#destroy\n\t * @param {Boolean} [removeView=false] `true` to remove canvas element.\n\t */\n\tdestroy(removeView) {\n\t\tif (this.instance) {\n\t\t\tthis.instance.destroy(true);\n\t\t\tthis.instance = null;\n\t\t}\n\t\tsuper.destroy(removeView);\n\t}\n}\n\nexport default Scene;"]}

View File

@@ -0,0 +1,102 @@
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _utils = require('./utils');
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Contains the collection of graphics data
* @memberof PIXI.animate
* @class ShapesCache
*/
var ShapesCache = {};
/**
* Add an item or itesm to the cache
* @method PIXI.animate.ShapesCache.add
* @static
* @param {String} prop The id of graphic or the map of graphics to add
* @param {String|Array<Array>} items Collection of draw commands
*/
Object.defineProperty(ShapesCache, 'add', {
enumerable: false,
value: function value(prop, items) {
// Decode string to map of files
if (typeof items === "string") {
items = _utils2.default.deserializeShapes(items);
}
// Convert all hex string colors (animate) to int (pixi.js)
for (var i = 0; i < items.length; i++) {
var item = items[i];
for (var j = 0; j < item.length; j++) {
var arg = item[j];
if (typeof arg === 'string' && arg[0] === '#') {
item[j] = _utils2.default.hexToUint(arg);
}
}
}
ShapesCache[prop] = items;
}
});
/**
* Get the graphic from cache
* @method PIXI.animate.ShapesCache.fromCache
* @static
* @param {String} id The cache id
* @return {Array} Series of graphic draw commands
*/
Object.defineProperty(ShapesCache, 'fromCache', {
enumerable: false,
value: function value(id) {
return ShapesCache[id] || null;
}
});
/**
* Remove the graphic from cache
* @method PIXI.animate.ShapesCache.remove
* @static
* @param {String|Object} id The cache id or map
*/
Object.defineProperty(ShapesCache, 'remove', {
enumerable: false,
value: function value(id) {
if ((typeof id === 'undefined' ? 'undefined' : _typeof(id)) === "object") {
for (var name in id) {
ShapesCache.remove(name);
}
return;
}
if (ShapesCache[id]) {
ShapesCache[id].length = 0;
delete ShapesCache[id];
}
}
});
/**
* Remove all graphics from cache
* @method PIXI.animate.ShapesCache.removeAll
* @static
*/
Object.defineProperty(ShapesCache, 'removeAll', {
enumerable: false,
value: function value() {
for (var id in ShapesCache) {
ShapesCache.remove(id);
}
}
});
// Assign to namespace
exports.default = ShapesCache;
//# sourceMappingURL=ShapesCache.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/animate/ShapesCache.js"],"names":["ShapesCache","Object","defineProperty","enumerable","value","prop","items","deserializeShapes","i","length","item","j","arg","hexToUint","id","name","remove"],"mappings":";;;;;;AAAA;;;;;;AAEA;;;;;AAKA,IAAMA,cAAc,EAApB;;AAEA;;;;;;;AAOAC,OAAOC,cAAP,CAAsBF,WAAtB,EAAmC,KAAnC,EAA0C;AACtCG,gBAAY,KAD0B;AAEtCC,WAAO,eAASC,IAAT,EAAeC,KAAf,EAAsB;;AAEzB;AACA,YAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;AAC3BA,oBAAQ,gBAAMC,iBAAN,CAAwBD,KAAxB,CAAR;AACH;;AAED;AACA,aAAK,IAAIE,IAAI,CAAb,EAAgBA,IAAIF,MAAMG,MAA1B,EAAkCD,GAAlC,EAAuC;AACnC,gBAAIE,OAAOJ,MAAME,CAAN,CAAX;AACA,iBAAK,IAAIG,IAAI,CAAb,EAAgBA,IAAID,KAAKD,MAAzB,EAAiCE,GAAjC,EAAsC;AAClC,oBAAIC,MAAMF,KAAKC,CAAL,CAAV;AACA,oBAAI,OAAOC,GAAP,KAAe,QAAf,IAA2BA,IAAI,CAAJ,MAAW,GAA1C,EAA+C;AAC3CF,yBAAKC,CAAL,IAAU,gBAAME,SAAN,CAAgBD,GAAhB,CAAV;AACH;AACJ;AACJ;AACDZ,oBAAYK,IAAZ,IAAoBC,KAApB;AACH;AApBqC,CAA1C;;AAwBA;;;;;;;AAOAL,OAAOC,cAAP,CAAsBF,WAAtB,EAAmC,WAAnC,EAAgD;AAC5CG,gBAAY,KADgC;AAE5CC,WAAO,eAASU,EAAT,EAAa;AAChB,eAAOd,YAAYc,EAAZ,KAAmB,IAA1B;AACH;AAJ2C,CAAhD;;AAOA;;;;;;AAMAb,OAAOC,cAAP,CAAsBF,WAAtB,EAAmC,QAAnC,EAA6C;AACzCG,gBAAY,KAD6B;AAEzCC,WAAO,eAASU,EAAT,EAAa;AAChB,YAAI,QAAOA,EAAP,yCAAOA,EAAP,OAAc,QAAlB,EAA4B;AACxB,iBAAK,IAAIC,IAAT,IAAiBD,EAAjB,EAAqB;AACjBd,4BAAYgB,MAAZ,CAAmBD,IAAnB;AACH;AACD;AACH;AACD,YAAIf,YAAYc,EAAZ,CAAJ,EAAqB;AACjBd,wBAAYc,EAAZ,EAAgBL,MAAhB,GAAyB,CAAzB;AACA,mBAAOT,YAAYc,EAAZ,CAAP;AACH;AACJ;AAbwC,CAA7C;;AAgBA;;;;;AAKAb,OAAOC,cAAP,CAAsBF,WAAtB,EAAmC,WAAnC,EAAgD;AAC5CG,gBAAY,KADgC;AAE5CC,WAAO,iBAAW;AACd,aAAK,IAAIU,EAAT,IAAed,WAAf,EAA4B;AACxBA,wBAAYgB,MAAZ,CAAmBF,EAAnB;AACH;AACJ;AAN2C,CAAhD;;AASA;kBACed,W","file":"ShapesCache.js","sourcesContent":["import utils from './utils';\n\n/**\n * Contains the collection of graphics data\n * @memberof PIXI.animate\n * @class ShapesCache\n */\nconst ShapesCache = {};\n\n/**\n * Add an item or itesm to the cache\n * @method PIXI.animate.ShapesCache.add\n * @static\n * @param {String} prop The id of graphic or the map of graphics to add\n * @param {String|Array<Array>} items Collection of draw commands\n */\nObject.defineProperty(ShapesCache, 'add', {\n enumerable: false,\n value: function(prop, items) {\n\n // Decode string to map of files\n if (typeof items === \"string\") {\n items = utils.deserializeShapes(items);\n }\n\n // Convert all hex string colors (animate) to int (pixi.js)\n for (let i = 0; i < items.length; i++) {\n let item = items[i];\n for (let j = 0; j < item.length; j++) {\n let arg = item[j];\n if (typeof arg === 'string' && arg[0] === '#') {\n item[j] = utils.hexToUint(arg);\n }\n }\n }\n ShapesCache[prop] = items;\n }\n});\n\n\n/**\n * Get the graphic from cache\n * @method PIXI.animate.ShapesCache.fromCache\n * @static\n * @param {String} id The cache id\n * @return {Array} Series of graphic draw commands\n */\nObject.defineProperty(ShapesCache, 'fromCache', {\n enumerable: false,\n value: function(id) {\n return ShapesCache[id] || null;\n }\n});\n\n/**\n * Remove the graphic from cache\n * @method PIXI.animate.ShapesCache.remove\n * @static\n * @param {String|Object} id The cache id or map\n */\nObject.defineProperty(ShapesCache, 'remove', {\n enumerable: false,\n value: function(id) {\n if (typeof id === \"object\") {\n for (let name in id) {\n ShapesCache.remove(name);\n }\n return;\n }\n if (ShapesCache[id]) {\n ShapesCache[id].length = 0;\n delete ShapesCache[id];\n }\n }\n});\n\n/**\n * Remove all graphics from cache\n * @method PIXI.animate.ShapesCache.removeAll\n * @static\n */\nObject.defineProperty(ShapesCache, 'removeAll', {\n enumerable: false,\n value: function() {\n for (let id in ShapesCache) {\n ShapesCache.remove(id);\n }\n }\n});\n\n// Assign to namespace\nexport default ShapesCache;"]}

View File

@@ -0,0 +1,40 @@
'use strict';
exports.__esModule = true;
var _ShapesCache = require('./ShapesCache');
var _ShapesCache2 = _interopRequireDefault(_ShapesCache);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The middleware for PIXI's ResourceLoader to be able to
* load Flash symbols such as graphics and images.
* @memberof PIXI.animate
* @class SymbolLoader
* @private
*/
var SymbolLoader = function SymbolLoader() {
return function (resource, next) {
var url = resource.url;
var data = resource.data;
if (!data) {
next();
} else if (url.search(/\.shapes\.(json|txt)$/i) > -1) {
_ShapesCache2.default.add(resource.name, data);
} else if (data.nodeName && data.nodeName === 'IMG') {
// Add individual images to the texture cache by their
// short symbol name, not the URL
PIXI.Texture.addTextureToCache(resource.texture, resource.name);
}
next();
};
};
// Assign to the loader
PIXI.loaders.Loader.addPixiMiddleware(SymbolLoader);
exports.default = SymbolLoader;
//# sourceMappingURL=SymbolLoader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/animate/SymbolLoader.js"],"names":["SymbolLoader","resource","next","url","data","search","add","name","nodeName","PIXI","Texture","addTextureToCache","texture","loaders","Loader","addPixiMiddleware"],"mappings":";;;;AAAA;;;;;;AAEA;;;;;;;AAOA,IAAIA,eAAe,SAAfA,YAAe,GAAW;AAC1B,WAAO,UAASC,QAAT,EAAmBC,IAAnB,EAAyB;AAC5B,YAAIC,MAAMF,SAASE,GAAnB;AACA,YAAIC,OAAOH,SAASG,IAApB;;AAEA,YAAI,CAACA,IAAL,EAAW;AACPF;AACH,SAFD,MAEO,IAAIC,IAAIE,MAAJ,CAAW,wBAAX,IAAuC,CAAC,CAA5C,EAA+C;AAClD,kCAAYC,GAAZ,CAAgBL,SAASM,IAAzB,EAA+BH,IAA/B;AACH,SAFM,MAEA,IAAIA,KAAKI,QAAL,IAAiBJ,KAAKI,QAAL,KAAkB,KAAvC,EAA8C;AACjD;AACA;AACAC,iBAAKC,OAAL,CAAaC,iBAAb,CACIV,SAASW,OADb,EAEIX,SAASM,IAFb;AAIH;AACDL;AACH,KAjBD;AAkBH,CAnBD;;AAqBA;AACAO,KAAKI,OAAL,CAAaC,MAAb,CAAoBC,iBAApB,CAAsCf,YAAtC;;kBAEeA,Y","file":"SymbolLoader.js","sourcesContent":["import ShapesCache from './ShapesCache';\n\n/**\n * The middleware for PIXI's ResourceLoader to be able to \n * load Flash symbols such as graphics and images.\n * @memberof PIXI.animate\n * @class SymbolLoader\n * @private\n */\nlet SymbolLoader = function() {\n return function(resource, next) {\n let url = resource.url;\n let data = resource.data;\n\n if (!data) {\n next();\n } else if (url.search(/\\.shapes\\.(json|txt)$/i) > -1) {\n ShapesCache.add(resource.name, data);\n } else if (data.nodeName && data.nodeName === 'IMG') {\n // Add individual images to the texture cache by their\n // short symbol name, not the URL\n PIXI.Texture.addTextureToCache(\n resource.texture,\n resource.name\n );\n }\n next();\n };\n};\n\n// Assign to the loader\nPIXI.loaders.Loader.addPixiMiddleware(SymbolLoader);\n\nexport default SymbolLoader;\n"]}

View File

@@ -0,0 +1,150 @@
'use strict';
exports.__esModule = true;
var _Tween = require('./Tween');
var _Tween2 = _interopRequireDefault(_Tween);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The Timeline class represents a
* @memberof PIXI.animate
* @class Timeline
* @param {PIXI.DisplayObject} Target The target for this string of tweens.
* @extends Array
* @constructor
*/
var Timeline = function Timeline(target) {
Array.call(this);
/**
* The target DisplayObject.
* @name PIXI.animate.Timeline#target
* @type {PIXI.DisplayObject}
*/
this.target = target;
/**
* Current properties in the tween, to make building the timeline more
* efficient.
* @name PIXI.animate.Timeline#_currentProps
* @type {Object}
* @private
*/
this._currentProps = {};
};
var p = Timeline.prototype = Object.create(Array.prototype);
/**
* Adds one or more tweens (or timelines) to this timeline. The tweens will be paused (to remove them from the normal ticking system)
* and managed by this timeline. Adding a tween to multiple timelines will result in unexpected behaviour.
* @method PIXI.animate.Timeline#addTween
* @param tween The tween(s) to add. Accepts multiple arguments.
* @return Tween The first tween that was passed in.
*/
p.addTween = function (properties, startFrame, duration, ease) {
this.extendLastFrame(startFrame - 1);
//ownership of startProps is passed to the new Tween - this object should not be reused
var startProps = {};
var prop = void 0;
//figure out what the starting values for this tween should be
for (prop in properties) {
//if we have already set that property in an earlier tween, use the ending value
if (this._currentProps.hasOwnProperty(prop)) {
startProps[prop] = this._currentProps[prop];
}
//otherwise, get the current value
else {
var startValue = startProps[prop] = this.getPropFromShorthand(prop);
//go through previous tweens to set the value so that when the timeline loops
//around, the values are set properly - having each tween know what came before
//allows us to set to a specific frame without running through the entire timeline
for (var i = this.length - 1; i >= 0; --i) {
this[i].startProps[prop] = startValue;
this[i].endProps[prop] = startValue;
}
}
}
//create the new Tween and add it to the list
var tween = new _Tween2.default(this.target, startProps, properties, startFrame, duration, ease);
this.push(tween);
//update starting values for the next tween - if tweened values included 'p', then Tween
//parsed that to add additional data that is required
Object.assign(this._currentProps, tween.endProps);
};
/**
* Add a single keyframe that doesn't tween.
* @method PIXI.animate.Timeline#addKeyframe
* @param {Object} properties The properties to set.
* @param {int} startFrame The starting frame index.
*/
p.addKeyframe = function (properties, startFrame) {
this.extendLastFrame(startFrame - 1);
var startProps = Object.assign({}, this._currentProps, properties);
//create the new Tween and add it to the list
var tween = new _Tween2.default(this.target, startProps, null, startFrame, 0);
this.push(tween);
Object.assign(this._currentProps, tween.endProps);
};
/**
* Extend the last frame of the tween.
* @method PIXI.animate.Timeline#extendLastFrame
* @param {int} endFrame The ending frame index.
*/
p.extendLastFrame = function (endFrame) {
if (this.length) {
var prevTween = this[this.length - 1];
if (prevTween.endFrame < endFrame) {
if (prevTween.isTweenlessFrame) {
prevTween.endFrame = endFrame;
} else {
this.addKeyframe(this._currentProps, prevTween.endFrame + 1, endFrame - prevTween.endFrame + 1);
}
}
}
};
/**
* Get the value for a property
* @method PIXI.animate.Timeline#getPropFromShorthand
* @param {string} prop
*/
p.getPropFromShorthand = function (prop) {
var target = this.target;
switch (prop) {
case 'x':
return target.position.x;
case 'y':
return target.position.y;
case 'sx':
return target.scale.x;
case 'sy':
return target.scale.y;
case 'kx':
return target.skew.x;
case 'ky':
return target.skew.y;
case 'r':
return target.rotation;
case 'a':
return target.alpha;
case 'v':
return target.visible;
case 'm':
return target.mask;
// case 't':
// return target.tint;
//not sure if we'll actually handle graphics this way?
//g: return null;
}
return null;
};
// Assign to namespace
exports.default = Timeline;
//# sourceMappingURL=Timeline.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,292 @@
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Provide timeline playback of movieclip
* @memberof PIXI.animate
* @class Tween
* @constructor
* @param {PIXI.animate.MovieClip} target The target to play
* @param {Object} startProps The starting properties
* @param {Object} endProps The ending properties
* @param {int} duration Number oframes to tween
* @param {Function} [ease] Ease function to use
*/
var Tween = function () {
function Tween(target, startProps, endProps, startFrame, duration, ease) {
_classCallCheck(this, Tween);
/**
* target display object
* @name PIXI.animate.Tween#target
* @type {Object}
*/
this.target = target;
/**
* properties at the start of the tween
* @type {Object}
* @name PIXI.animate.Tween#startProps
*/
this.startProps = startProps;
/**
* properties at the end of the tween, as well as any properties that are set
* instead of tweened
* @type {Object}
* @name PIXI.animate.Tween#endProps
*/
this.endProps = {};
/**
* duration of tween in frames. For a keyframe with no tweening, the duration will be 0.
* @type {int}
* @name PIXI.animate.Tween#duration
*/
this.duration = duration;
/**
* The frame that the tween starts on
* @type {int}
* @name PIXI.animate.Tween#startFrame
*/
this.startFrame = startFrame;
/**
* the frame that the tween ends on
* @type {int}
* @name PIXI.animate.Tween#endFrame
*/
this.endFrame = startFrame + duration;
/**
* easing function to use, if any
* @type {Function}
* @name PIXI.animate.Tween#ease
*/
this.ease = ease;
/**
* If we don't tween.
* @type {Boolean}
* @name PIXI.animate.Tween#isTweenlessFrame
*/
this.isTweenlessFrame = !endProps;
var prop = void 0;
if (endProps) {
//make a copy to safely include any unchanged values from the start of the tween
for (prop in endProps) {
this.endProps[prop] = endProps[prop];
}
}
//copy in any starting properties don't change
for (prop in startProps) {
if (!this.endProps.hasOwnProperty(prop)) {
this.endProps[prop] = startProps[prop];
}
}
}
/**
* Set the current frame.
* @method PIXI.animate.Tween#setPosition
* @param {int} currentFrame
*/
Tween.prototype.setPosition = function setPosition(currentFrame) {
//if this is a single frame with no tweening, or at the end of the tween, then
//just speed up the process by setting values
if (currentFrame >= this.endFrame) {
this.setToEnd();
return;
}
if (this.isTweenlessFrame) {
this.setToEnd();
return;
}
var time = (currentFrame - this.startFrame) / this.duration;
if (this.ease) {
time = this.ease(time);
}
var target = this.target;
var startProps = this.startProps;
var endProps = this.endProps;
for (var _prop in endProps) {
var lerp = props[_prop];
if (lerp) {
setPropFromShorthand(target, _prop, lerp(startProps[_prop], endProps[_prop], time));
} else {
setPropFromShorthand(target, _prop, startProps[_prop]);
}
}
};
/**
* Set to the end position
* @method PIXI.animate.Tween#setToEnd
*/
Tween.prototype.setToEnd = function setToEnd() {
var endProps = this.endProps;
var target = this.target;
for (var _prop2 in endProps) {
setPropFromShorthand(target, _prop2, endProps[_prop2]);
}
};
return Tween;
}();
//standard tweening
function lerpValue(start, end, t) {
return start + (end - start) * t;
}
var props = {
//position
x: lerpValue,
y: lerpValue,
//scale
sx: lerpValue,
sy: lerpValue,
//skew
kx: lerpValue,
ky: lerpValue,
//rotation
r: lerpRotation,
//alpha
a: lerpValue,
//tinting
// t: lerpColor,
t: null,
//values to be set
v: null, //visible
c: null, //colorTransform
m: null, //mask
g: null //not sure if we'll actually handle graphics this way?
};
//split r, g, b into separate values for tweening
/*function lerpColor(start, end, t)
{
//split start color into components
let sR = start >> 16 & 0xFF;
let sG = start >> 8 & 0xFF;
let sB = start & 0xFF;
//split end color into components
let eR = end >> 16 & 0xFF;
let eG = end >> 8 & 0xFF;
let eB = end & 0xFF;
//lerp red
let r = sR + (eR - sR) * percent;
//clamp red to valid values
if (r < 0)
r = 0;
else if (r > 255)
r = 255;
//lerp green
let g = sG + (eG - sG) * percent;
//clamp green to valid values
if (g < 0)
g = 0;
else if (g > 255)
g = 255;
//lerp blue
let b = sB + (eB - sB) * percent;
//clamp blue to valid values
if (b < 0)
b = 0;
else if (b > 255)
b = 255;
let combined = (r << 16) | (g << 8) | b;
return combined;
}*/
var PI = Math.PI;
var TWO_PI = PI * 2;
//handle 355 -> 5 degrees only going through a 10 degree change instead of
//the long way around
//Math from http://stackoverflow.com/a/2708740
function lerpRotation(start, end, t) {
var difference = Math.abs(end - start);
if (difference > PI) {
// We need to add on to one of the values.
if (end > start) {
// We'll add it on to start...
start += TWO_PI;
} else {
// Add it on to end.
end += PI + TWO_PI;
}
}
// Interpolate it.
var value = start + (end - start) * t;
// wrap to 0-2PI
/*if (value >= 0 && value <= TWO_PI)
return value;
return value % TWO_PI;*/
//just return, as it's faster
return value;
}
function setPropFromShorthand(target, prop, value) {
switch (prop) {
case "x":
target.transform.position.x = value;
break;
case "y":
target.transform.position.y = value;
break;
case "sx":
target.transform.scale.x = value;
break;
case "sy":
target.transform.scale.y = value;
break;
case "kx":
target.transform.skew.x = value;
break;
case "ky":
target.transform.skew.y = value;
break;
case "r":
target.transform.rotation = value;
break;
case "a":
target.alpha = value;
break;
case "t":
target.i(value); // i = setTint
break;
case "c":
target.c.apply(target, value); // c = setColorTransform
break;
case "v":
target.visible = value;
break;
case "m":
target.ma(value); // ma = setMask
break;
}
}
// Assign to namespace
exports.default = Tween;
//# sourceMappingURL=Tween.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,69 @@
'use strict';
exports.__esModule = true;
exports.VERSION = exports.Tween = exports.Timeline = exports.SymbolLoader = exports.ShapesCache = exports.Scene = exports.MovieClip = exports.utils = exports.sound = exports.load = exports.AnimatorTimeline = exports.Animator = undefined;
var _load = require('./load');
var _load2 = _interopRequireDefault(_load);
var _sound = require('./sound');
var _sound2 = _interopRequireDefault(_sound);
var _utils = require('./utils');
var _utils2 = _interopRequireDefault(_utils);
var _MovieClip = require('./MovieClip');
var _MovieClip2 = _interopRequireDefault(_MovieClip);
var _Scene = require('./Scene');
var _Scene2 = _interopRequireDefault(_Scene);
var _ShapesCache = require('./ShapesCache');
var _ShapesCache2 = _interopRequireDefault(_ShapesCache);
var _SymbolLoader = require('./SymbolLoader');
var _SymbolLoader2 = _interopRequireDefault(_SymbolLoader);
var _Timeline = require('./Timeline');
var _Timeline2 = _interopRequireDefault(_Timeline);
var _Tween = require('./Tween');
var _Tween2 = _interopRequireDefault(_Tween);
var _Animator = require('./Animator');
var _Animator2 = _interopRequireDefault(_Animator);
var _AnimatorTimeline = require('./AnimatorTimeline');
var _AnimatorTimeline2 = _interopRequireDefault(_AnimatorTimeline);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var VERSION = '1.3.3';
/**
* @namespace PIXI.animate
*/
exports.Animator = _Animator2.default;
exports.AnimatorTimeline = _AnimatorTimeline2.default;
exports.load = _load2.default;
exports.sound = _sound2.default;
exports.utils = _utils2.default;
exports.MovieClip = _MovieClip2.default;
exports.Scene = _Scene2.default;
exports.ShapesCache = _ShapesCache2.default;
exports.SymbolLoader = _SymbolLoader2.default;
exports.Timeline = _Timeline2.default;
exports.Tween = _Tween2.default;
exports.VERSION = VERSION;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/animate/index.js"],"names":["VERSION","Animator","AnimatorTimeline","load","sound","utils","MovieClip","Scene","ShapesCache","SymbolLoader","Timeline","Tween"],"mappings":";;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;AAEA,IAAMA,iBAAN;;AAEA;;;QAIIC,Q;QACAC,gB;QACAC,I;QACAC,K;QACAC,K;QACAC,S;QACAC,K;QACAC,W;QACAC,Y;QACAC,Q;QACAC,K;QACAX,O,GAAAA,O","file":"index.js","sourcesContent":["import load from './load';\nimport sound from './sound';\nimport utils from './utils';\nimport MovieClip from './MovieClip';\nimport Scene from './Scene';\nimport ShapesCache from './ShapesCache';\nimport SymbolLoader from './SymbolLoader';\nimport Timeline from './Timeline';\nimport Tween from './Tween';\nimport Animator from './Animator';\nimport AnimatorTimeline from './AnimatorTimeline';\n\nconst VERSION = __VERSION__;\n\n/**\n * @namespace PIXI.animate\n */\nexport {\n Animator,\n AnimatorTimeline,\n load,\n sound,\n utils,\n MovieClip,\n Scene,\n ShapesCache,\n SymbolLoader,\n Timeline,\n Tween,\n VERSION\n};"]}

View File

@@ -0,0 +1,162 @@
"use strict";
exports.__esModule = true;
/**
* Load the stage class and preload any assets
* @method PIXI.animate.load
* @param {Object} options Options for loading.
* @param {Function} options.stage Reference to the stage class
* @param {Object} [options.stage.assets] Assets used to preload
* @param {PIXI.Container} options.parent The Container to auto-add the stage to.
* @param {String} [options.basePath] Base root directory
* @return {PIXI.loaders.Loader} instance of PIXI resource loader
*/
/**
* Load the stage class and preload any assets
* ```
* let renderer = new PIXI.autoDetectRenderer(1280, 720);
* let stage = new PIXI.Container();
* PIXI.animate.load(lib.MyStage, function(instance){
* stage.addChild(instance);
* });
* function update() {
* renderer.render(stage);
* update();
* }
* update();
* ```
* @method PIXI.animate.load
* @param {Function} StageRef Reference to the stage class.
* @param {Object} [StageRef.assets] Assets used to preload.
* @param {Function} complete The callback function when complete.
* @return {PIXI.loaders.Loader} instance of PIXI resource loader
*/
/**
* Load the stage class and preload any assets
* ```
* let renderer = new PIXI.autoDetectRenderer(1280, 720);
* let stage = new PIXI.Container();
* PIXI.animate.load(lib.MyStage, stage);
* function update() {
* renderer.render(stage);
* update();
* }
* update();
* ```
* @method PIXI.animate.load
* @param {Function} StageRef Reference to the stage class.
* @param {Object} [StageRef.assets] Assets used to preload.
* @param {PIXI.Container} parent The Container to auto-add the stage to.
* @param {String} [basePath] Base root directory
* @return {PIXI.loaders.Loader} instance of PIXI resource loader
*/
/**
* Load the stage class and preload any assets
* ```
* let basePath = "file:/path/to/assets";
* let renderer = new PIXI.autoDetectRenderer(1280, 720);
*
* let extensions = PIXI.compressedTextures.detectExtensions(renderer);
* let loader = new PIXI.loaders.Loader();
* // this is an example of setting up a pre loader plugin to handle compressed textures in this case
* loader.pre(PIXI.compressedTextures.extensionChooser(extensions));
*
* // specify metadata this way if you want to provide a default loading strategy for all assets listed in the PIXI animation
* let metadata = { default: { metadata: { imageMetadata: { choice: [".crn"] } } } };
* // specify metadata this way if you want to provide a specific loading strategy for a certain asset listed inside the PIXI animation library
* let metadata = { MyStage_atlas_1: { metadata: { imageMetadata: { choice: [".crn"] } } } };
*
* let stage = new PIXI.Container();
* PIXI.animate.load(lib.MyStage, stage, ()=>{}, basePath, loader, metadata);
* function update() {
* renderer.render(stage);
* update();
* }
* update();
* ```
* @method PIXI.animate.load
* @param {Function} StageRef Reference to the stage class.
* @param {Object} [StageRef.assets] Assets used to preload.
* @param {PIXI.Container} parent The Container to auto-add the stage to.
* @param {Function} [complete] The callback function when complete.
* @param {String} [basePath] Base root directory
* @param {PIXI.loaders.Loader} [loader] A Pixi loader object
* @param {Object} [metadata] A metadata object for the asset being loaded
* @return {PIXI.loaders.Loader} instance of PIXI resource loader
*/
var load = function load(options, parent, complete, basePath, loader, metadata) {
// Support arguments (ref, complete, basePath)
if (typeof parent === "function") {
basePath = complete;
complete = parent;
parent = null;
} else {
if (typeof complete === "string") {
basePath = complete;
complete = null;
}
}
if (typeof options === "function") {
options = {
stage: options,
parent: parent,
basePath: basePath || "",
complete: complete
};
}
options = Object.assign({
stage: null,
parent: null,
basePath: '',
complete: null
}, options || {});
loader = loader || new PIXI.loaders.Loader();
function done() {
var instance = new options.stage();
if (options.parent) {
options.parent.addChild(instance);
}
if (options.complete) {
options.complete(instance, loader);
}
}
// Check for assets to preload
var assets = options.stage.assets || {};
if (assets && Object.keys(assets).length) {
// assetBaseDir can accept either with trailing slash or not
var _basePath = options.basePath;
if (_basePath) {
_basePath += "/";
}
for (var id in assets) {
var data = null;
if (metadata) {
// if the metadata was supplied for this particular asset, use these options
if (metadata[id]) {
data = metadata[id];
}
// if the metadata supplied a default option
else if (metadata.default) {
data = metadata.default;
}
}
loader.add(id, _basePath + assets[id], data);
}
loader.once('complete', done).load();
} else {
// tiny case where there's only text and no shapes/animations
done();
}
return loader;
};
exports.default = load;
//# sourceMappingURL=load.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
"use strict";
exports.__esModule = true;
/**
* @description Event emitter for all sound events. This emits a single
* `play` event which contains the alias, loop and MovieClip which is playing
* the sound.
* @name PIXI.animate.sound
* @type {EventEmitter}
* @example
*
* PIXI.animate.sound.on('play', (alias, loop, context) => {
* // custom handle sounds being played
* // where 'alias' is the ID in stage assets
* });
*/
exports.default = new PIXI.utils.EventEmitter();
//# sourceMappingURL=sound.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/animate/sound.js"],"names":["PIXI","utils","EventEmitter"],"mappings":";;;AAAA;;;;;;;;;;;;;kBAae,IAAIA,KAAKC,KAAL,CAAWC,YAAf,E","file":"sound.js","sourcesContent":["/**\n * @description Event emitter for all sound events. This emits a single\n * `play` event which contains the alias, loop and MovieClip which is playing\n * the sound.\n * @name PIXI.animate.sound\n * @type {EventEmitter}\n * @example\n * \n * PIXI.animate.sound.on('play', (alias, loop, context) => {\n * // custom handle sounds being played\n * // where 'alias' is the ID in stage assets\n * });\n */\nexport default new PIXI.utils.EventEmitter();"]}

View File

@@ -0,0 +1,251 @@
'use strict';
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// If the movieclip plugin is installed
var _prepare = null;
/**
* @namespace PIXI.animate.utils
* @description For keyframe conversions
*/
var AnimateUtils = function () {
function AnimateUtils() {
_classCallCheck(this, AnimateUtils);
}
/**
* Convert the Hexidecimal string (e.g., "#fff") to uint
* @static
* @method PIXI.animate.utils.hexToUint
*/
AnimateUtils.hexToUint = function hexToUint(hex) {
// Remove the hash
hex = hex.substr(1);
// Convert shortcolors fc9 to ffcc99
if (hex.length === 3) {
hex = hex.replace(/([a-f0-9])/g, '$1$1');
}
return parseInt(hex, 16);
};
/**
* Fill frames with booleans of true (showing) and false (hidden).
* @static
* @method PIXI.animate.utils.fillFrames
* @param {Array<Boolean>} timeline
* @param {int} startFrame The start frame when the timeline shows up
* @param {int} duration The length of showing
*/
AnimateUtils.fillFrames = function fillFrames(timeline, startFrame, duration) {
//ensure that the timeline is long enough
var oldLength = timeline.length;
if (oldLength < startFrame + duration) {
timeline.length = startFrame + duration;
//fill any gaps with false to denote that the child should be removed for a bit
if (oldLength < startFrame) {
//if the browser has implemented the ES6 fill() function, use that
if (timeline.fill) {
timeline.fill(false, oldLength, startFrame);
} else {
//if we can't use fill, then do a for loop to fill it
for (var i = oldLength; i < startFrame; ++i) {
timeline[i] = false;
}
}
}
}
//if the browser has implemented the ES6 fill() function, use that
if (timeline.fill) {
timeline.fill(true, startFrame, startFrame + duration);
} else {
var length = timeline.length;
//if we can't use fill, then do a for loop to fill it
for (var _i = startFrame; _i < length; ++_i) {
timeline[_i] = true;
}
}
};
/**
* Convert serialized array into keyframes
* `"0x100y100 1x150"` to: `{ "0": {"x":100, "y": 100}, "1": {"x": 150} }`
* @static
* @method PIXI.animate.utils.deserializeKeyframes
* @param {String} keyframes
* @param {Object} Resulting keyframes
*/
AnimateUtils.deserializeKeyframes = function deserializeKeyframes(keyframes) {
var result = {};
var i = 0;
var keysMap = {
X: 'x', // x position
Y: 'y', // y position
A: 'sx', // scale x
B: 'sy', // scale y
C: 'kx', // skew x
D: 'ky', // skew y
R: 'r', // rotation
L: 'a', // alpha
T: 't', // tint
F: 'c', // colorTransform
V: 'v' // visibility
};
var c = void 0,
buffer = '',
isFrameStarted = false,
prop = void 0,
frame = {};
while (i <= keyframes.length) {
c = keyframes[i];
if (keysMap[c]) {
if (!isFrameStarted) {
isFrameStarted = true;
result[buffer] = frame;
}
if (prop) {
frame[prop] = this.parseValue(prop, buffer);
}
prop = keysMap[c];
buffer = '';
i++;
}
// Start a new prop
else if (!c || c === ' ') {
i++;
frame[prop] = this.parseValue(prop, buffer);
buffer = '';
prop = null;
frame = {};
isFrameStarted = false;
} else {
buffer += c;
i++;
}
}
return result;
};
/**
* Convert serialized shapes into draw commands for PIXI.Graphics.
* @static
* @method PIXI.animate.utils.deserializeShapes
* @param {String} str
* @param {Array} Resulting shapes map
*/
AnimateUtils.deserializeShapes = function deserializeShapes(str) {
var result = [];
// each shape is a new line
var shapes = str.split("\n");
var isCommand = /^[a-z]{1,2}$/;
for (var i = 0; i < shapes.length; i++) {
var shape = shapes[i].split(' '); // arguments are space separated
for (var j = 0; j < shape.length; j++) {
// Convert all numbers to floats, ignore colors
var arg = shape[j];
if (arg[0] !== '#' && !isCommand.test(arg)) {
shape[j] = parseFloat(arg);
}
}
result.push(shape);
}
return result;
};
/**
* Parse the value of the compressed keyframe.
* @method PIXI.animate.utils.parseValue
* @static
* @private
* @param {String} prop The property key
* @param {String} buffer The contents
* @return {*} The parsed value
*/
AnimateUtils.parseValue = function parseValue(prop, buffer) {
switch (prop) {
// Color transforms are parsed as an array
case 'c':
{
buffer = buffer.split(',');
buffer.forEach(function (val, i, buffer) {
buffer[i] = parseFloat(val);
});
return buffer;
}
// Tint value should not be converted
// can be color uint or string
case 't':
{
return buffer;
}
// The visiblity parse as boolean
case 'v':
{
return !!parseInt(buffer);
}
// Everything else parse a floats
default:
{
return parseFloat(buffer);
}
}
};
/**
* Upload all the textures and graphics to the GPU.
* @method PIXI.animate.utils.upload
* @static
* @param {PIXI.WebGLRenderer} renderer Render to upload to
* @param {PIXI.DisplayObject} clip MovieClip to upload
* @param {function} done When complete
*/
AnimateUtils.upload = function upload(renderer, displayObject, done) {
if (!_prepare) {
_prepare = renderer.plugins.prepare;
_prepare.register(this.addMovieClips);
}
_prepare.upload(displayObject, done);
};
/**
* Add movie clips to the upload prepare.
* @method PIXI.animate.utils.addMovieClips
* @static
* @private
* @param {*} item To add to the queue
*/
AnimateUtils.addMovieClips = function addMovieClips(item) {
if (item instanceof PIXI.animate.MovieClip) {
item._timedChildTimelines.forEach(function (timeline) {
var index = item.children.indexOf(timeline.target);
if (index === -1) {
_prepare.add(timeline.target);
}
});
return true;
}
return false;
};
return AnimateUtils;
}();
exports.default = AnimateUtils;
//# sourceMappingURL=utils.js.map

File diff suppressed because one or more lines are too long