@eva/plugin-transition 1.1.1-fix.2 → 1.1.1-fix.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EVA.plugin.transition.js","sources":["../../../node_modules/tslib/tslib.es6.js","../lib/animation.ts","../lib/component.ts","../lib/system.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Tween, Easing } from '@tweenjs/tween.js';\nimport type { Group } from '@tweenjs/tween.js';\n\ninterface CacheItem {\n property: Record<string, any>;\n key: string;\n}\n\ntype Cache = Record<string, CacheItem>;\n\nconst easingMap = {\n linear: Easing.Linear.None,\n 'ease-in': Easing.Quadratic.In,\n 'ease-out': Easing.Quadratic.Out,\n 'ease-in-out': Easing.Quadratic.InOut,\n 'bounce-in': Easing.Bounce.In,\n 'bounce-out': Easing.Bounce.Out,\n 'bounce-in-out': Easing.Bounce.InOut,\n none: p => ~~p,\n};\n\nexport default class Animation {\n private tweens = [];\n private timelines = [];\n private finishCount = 0;\n private callbacks = new Map();\n readonly tweenGroup: Group;\n\n stoped: boolean;\n objectCache: Record<string, Cache> = {};\n currIteration: number = 0;\n iteration: number;\n checkFinishFunc: Function;\n\n constructor(timelines, tweenGroup: Group) {\n this.timelines = timelines;\n this.tweenGroup = tweenGroup;\n }\n\n on(eventName, callback) {\n if (!this.callbacks[eventName]) {\n this.callbacks.set(eventName, []);\n }\n this.callbacks.get(eventName).push(callback);\n }\n\n emit(eventName) {\n const callbacks = this.callbacks.get(eventName);\n if (!callbacks || !callbacks.length) return;\n callbacks.forEach(fn => fn());\n }\n\n checkFinish() {\n if (++this.finishCount == this.tweens.length) {\n if (++this.currIteration == this.iteration) {\n this.emit('finish');\n } else {\n if (this.stoped) return;\n this.start();\n }\n }\n }\n\n getObjectCache(component, name): CacheItem {\n const key = `${component.gameObject.id}${component.name}`;\n if (!this.objectCache[key]) {\n this.objectCache[key] = {};\n }\n if (this.objectCache[key][name]) {\n return this.objectCache[key][name];\n }\n const keys = name.split('.');\n const keyIndex = keys.length - 1;\n let property = component;\n for (let i = 0; i < keyIndex; i++) {\n property = property[keys[i]];\n }\n this.objectCache[key][name] = { property, key: keys[keyIndex] };\n return this.objectCache[key][name];\n }\n\n doAnim({ component, name, value }) {\n const { property, key } = this.getObjectCache(component, name);\n property[key] = value;\n }\n\n init() {\n this.checkFinishFunc = this.checkFinish.bind(this);\n\n let lastTween;\n this.timelines.forEach((timeline, i) => {\n for (let j = 0; j < timeline.values.length - 1; j++) {\n const frame = timeline.values[j];\n const nextFrame = timeline.values[j + 1];\n\n const tween = new Tween({ value: frame.value }, this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween])\n .onUpdate(props => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: props.value,\n });\n });\n\n if (j === 0) {\n this.tweens[i] = tween;\n } else {\n lastTween.chain(tween);\n }\n\n lastTween = tween;\n }\n lastTween && lastTween.onComplete(() => this.checkFinishFunc());\n });\n }\n\n play(iteration = 1) {\n this.stoped = false;\n this.start();\n this.currIteration = 0;\n this.iteration = iteration;\n }\n\n start() {\n this.finishCount = 0;\n this.tweens.length = 0;\n this.init();\n this.tweens.forEach((tween: Tween<any>) => tween.start());\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause());\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume());\n }\n\n stop() {\n this.stoped = true;\n this.tweens.forEach((tween: Tween<any>) => tween.stop());\n }\n\n destroy() {\n this.stop();\n this.tweens = null;\n this.timelines = null;\n this.objectCache = null;\n this.callbacks.clear();\n this.callbacks = null;\n }\n}\n","import Animation from './animation';\nimport { Component } from '@eva/eva.js';\nimport { Group } from '@tweenjs/tween.js';\n\ninterface AnimationStruct {\n name: string;\n component: Component;\n values: {\n time: number;\n value: number;\n tween?: string;\n }[];\n}\ninterface TransitionParams {\n group: Record<string, AnimationStruct[]>;\n}\nexport default class Transition extends Component<TransitionParams> {\n static componentName: string = 'Transition';\n\n private animations: Record<string, Animation> = {};\n\n tweenGroup: Group;\n group: Record<string, AnimationStruct[]> = {};\n\n init({ group } = { group: {} }) {\n this.group = group;\n this.tweenGroup = new Group();\n }\n\n awake() {\n for (const name in this.group) {\n this.newAnimation(name);\n }\n }\n\n play(name: string, iteration: number) {\n if (!name) {\n name = Object.keys(this.group)[0];\n }\n if (name && !this.animations[name] && this.group[name]) {\n this.newAnimation(name);\n }\n if (name && this.animations[name]) {\n this.animations[name].play(iteration);\n }\n }\n\n stop(name) {\n if (!name) {\n for (const key in this.animations) {\n this.animations[key].stop();\n }\n } else {\n this.animations[name].stop();\n }\n }\n\n onPause() {\n for (const key in this.animations) {\n this.animations[key].pause();\n }\n }\n\n onResume() {\n for (const key in this.animations) {\n this.animations[key].resume();\n }\n }\n\n onDestroy() {\n for (const key in this.animations) {\n this.animations[key].destroy();\n }\n this.tweenGroup.removeAll();\n this.tweenGroup = null;\n this.group = null;\n this.animations = null;\n this.removeAllListeners();\n }\n\n update() {\n this.tweenGroup.update();\n }\n\n newAnimation(name) {\n const animation = new Animation(this.group[name], this.tweenGroup);\n animation.on('finish', () => this.emit('finish', name));\n this.animations[name] = animation;\n }\n}\n","import { System } from '@eva/eva.js';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n"],"names":["Easing","Tween","Group","Animation","Component","System"],"mappings":";;;;;;IAAA;IACA;AACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;IACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAA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=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o,r={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-r.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*r.Bounce.In(2*t):.5*r.Bounce.Out(2*t-1)+.5}}},s="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},a=function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=s()),void 0===e&&(e=!1);var i=Object.keys(this._tweens);if(0===i.length)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var o=this._tweens[i[n]],r=!e;o&&!1===o.update(t,r)&&!e&&delete this._tweens[i[n]]}i=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),u={Linear:function(t,e){var i=t.length-1,n=i*e,o=Math.floor(n),r=u.Utils.Linear;return e<0?r(t[0],t[1],n):e>1?r(t[i],t[i-1],i-n):r(t[o],t[o+1>i?i:o+1],n-o)},Bezier:function(t,e){for(var i=0,n=t.length-1,o=Math.pow,r=u.Utils.Bernstein,s=0;s<=n;s++)i+=o(1-e,n-s)*o(e,s)*t[s]*r(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,o=Math.floor(n),r=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(o=Math.floor(n=i*(1+e))),r(t[(o-1+i)%i],t[o],t[(o+1)%i],t[(o+2)%i],n-o)):e<0?t[0]-(r(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(r(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):r(t[o?o-1:0],t[o],t[i<o+1?i:o+1],t[i<o+2?i:o+2],n-o)},Utils:{Linear:function(t,e,i){return(e-t)*i+t},Bernstein:function(t,e){var i=u.Utils.Factorial;return i(t)/i(e)/i(t-e)},Factorial:(o=[1],function(t){var e=1;if(o[t])return o[t];for(var i=t;i>1;i--)e*=i;return o[t]=e,e}),CatmullRom:function(t,e,i,n,o){var r=.5*(i-t),s=.5*(n-e),a=o*o;return(2*e-2*i+r+s)*(o*a)+(-3*e+3*i-2*r-s)*a+r*o+e}}},h=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),p=new a,c=function(){function t(t,e){void 0===e&&(e=p),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=r.Linear.None,this._interpolationFunction=u.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=h.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?s()+parseFloat(t):t:s(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,i,n){for(var o in i){var r=t[o],s=Array.isArray(r),a=s?"array":typeof r,u=!s&&Array.isArray(i[o]);if("undefined"!==a&&"function"!==a){if(u){var h=i[o];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,r)),i[o]=[r].concat(h)}if("object"!==a&&!s||!r||u)void 0===e[o]&&(e[o]=r),s||(e[o]*=1),n[o]=u?i[o].slice().reverse():e[o]||0;else{for(var p in e[o]=s?[]:{},r)e[o][p]=r[p];n[o]=s?[]:{},this._setupProperties(r,e[o],i[o],n[o])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=s()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=s()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=s()),void 0===e&&(e=!0),this._isPaused)return!0;var i,n,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n;var r=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,r),this._onUpdateCallback&&this._onUpdateCallback(this._object,n),1===n){if(this._repeat>0){for(i in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[i]||(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,i,n){for(var o in i)if(void 0!==e[o]){var r=e[o]||0,s=i[o],a=Array.isArray(t[o]),u=Array.isArray(s);!a&&u?t[o]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[o],r,s,n):"number"==typeof(s=this._handleRelativeValue(r,s))&&(t[o]=r+(s-r)*n)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],i=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof i?this._valuesStartRepeat[t]+parseFloat(i):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=p;l.getAll.bind(l),l.removeAll.bind(l),l.add.bind(l),l.remove.bind(l),l.update.bind(l);var f={linear:r.Linear.None,"ease-in":r.Quadratic.In,"ease-out":r.Quadratic.Out,"ease-in-out":r.Quadratic.InOut,"bounce-in":r.Bounce.In,"bounce-out":r.Bounce.Out,"bounce-in-out":r.Bounce.InOut,none:function(t){return~~t}},_=function(){function t(t,e){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=e}return t.prototype.on=function(t,e){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(e)},t.prototype.emit=function(t){var e=this.callbacks.get(t);e&&e.length&&e.forEach((function(t){return t()}))},t.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},t.prototype.getObjectCache=function(t,e){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][e])return this.objectCache[i][e];for(var n=e.split("."),o=n.length-1,r=t,s=0;s<o;s++)r=r[n[s]];return this.objectCache[i][e]={property:r,key:n[o]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,o=this.getObjectCache(e,i);o.property[o.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var o=0;o<i.values.length-1;o++){var r=i.values[o],s=i.values[o+1],a=new c({value:r.value},e.tweenGroup).to({value:s.value}).duration(s.time-r.time).easing(f[r.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===o?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t){void 0===t&&(t=1),this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(t){return t.start()}))},t.prototype.pause=function(){this.tweens.forEach((function(t){return t.pause()}))},t.prototype.resume=function(){this.tweens.forEach((function(t){return t.resume()}))},t.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},t.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},t}(),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.animations={},e.group={},e}return n(e,t),e.prototype.init=function(t){var e=(void 0===t?{group:{}}:t).group;this.group=e,this.tweenGroup=new a},e.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},e.prototype.play=function(t,e){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.animations[t].play(e)},e.prototype.stop=function(t){if(t)this.animations[t].stop();else for(var e in this.animations)this.animations[e].stop()},e.prototype.onPause=function(){for(var t in this.animations)this.animations[t].pause()},e.prototype.onResume=function(){for(var t in this.animations)this.animations[t].resume()},e.prototype.onDestroy=function(){for(var t in this.animations)this.animations[t].destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(){this.tweenGroup.update()},e.prototype.newAnimation=function(t){var e=this,i=new _(this.group[t],this.tweenGroup);i.on("finish",(function(){return e.emit("finish",t)})),this.animations[t]=i},e.componentName="Transition",e}(e.Component),y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="transition",e}return n(e,t),e.systemName="transition",e}(e.System);t.Transition=d,t.TransitionSystem=y,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@eva/eva.js")):"function"==typeof define&&define.amd?define(["exports","@eva/eva.js"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).EVA=t.EVA||{},t.EVA.plugin=t.EVA.plugin||{},t.EVA.plugin.transition={}),t.EVA);
2
- //# sourceMappingURL=EVA.plugin.transition.min.js.map
@@ -32,17 +32,6 @@ function __extends(d, b) {
32
32
  extendStatics(d, b);
33
33
  function __() { this.constructor = d; }
34
34
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35
- }
36
-
37
- function __values(o) {
38
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
39
- if (m) return m.call(o);
40
- return {
41
- next: function () {
42
- if (o && i >= o.length) o = void 0;
43
- return { value: o && o[i++], done: !o };
44
- }
45
- };
46
35
  }
47
36
 
48
37
  var easingMap = {
@@ -142,28 +131,24 @@ var Animation = (function () {
142
131
  lastTween && lastTween.onComplete(function () { return _this.checkFinishFunc(); });
143
132
  });
144
133
  };
145
- Animation.prototype.play = function (iteration, currentTime) {
134
+ Animation.prototype.play = function (iteration) {
146
135
  if (iteration === void 0) { iteration = 1; }
147
- this.currentTime = currentTime;
148
136
  this.stoped = false;
149
137
  this.start();
150
138
  this.currIteration = 0;
151
139
  this.iteration = iteration;
152
140
  };
153
141
  Animation.prototype.start = function () {
154
- var _this = this;
155
142
  this.finishCount = 0;
156
143
  this.tweens.length = 0;
157
144
  this.init();
158
- this.tweens.forEach(function (tween) { return tween.start(_this.currentTime); });
145
+ this.tweens.forEach(function (tween) { return tween.start(); });
159
146
  };
160
147
  Animation.prototype.pause = function () {
161
- var _this = this;
162
- this.tweens.forEach(function (tween) { return tween.pause(_this.currentTime); });
148
+ this.tweens.forEach(function (tween) { return tween.pause(); });
163
149
  };
164
150
  Animation.prototype.resume = function () {
165
- var _this = this;
166
- this.tweens.forEach(function (tween) { return tween.resume(_this.currentTime); });
151
+ this.tweens.forEach(function (tween) { return tween.resume(); });
167
152
  };
168
153
  Animation.prototype.stop = function () {
169
154
  this.stoped = true;
@@ -187,8 +172,6 @@ var Transition = (function (_super) {
187
172
  var _this = _super !== null && _super.apply(this, arguments) || this;
188
173
  _this.animations = {};
189
174
  _this.group = {};
190
- _this.currentTime = 0;
191
- _this.needPlay = [];
192
175
  return _this;
193
176
  }
194
177
  Transition.prototype.init = function (_a) {
@@ -209,36 +192,32 @@ var Transition = (function (_super) {
209
192
  this.newAnimation(name);
210
193
  }
211
194
  if (name && this.animations[name]) {
212
- this.needPlay.push({ name: name, iteration: iteration });
195
+ this.animations[name].play(iteration);
213
196
  }
214
197
  };
215
198
  Transition.prototype.stop = function (name) {
216
- var _a, _b;
217
199
  if (!name) {
218
200
  for (var key in this.animations) {
219
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
201
+ this.animations[key].stop();
220
202
  }
221
203
  }
222
204
  else {
223
- (_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
205
+ this.animations[name].stop();
224
206
  }
225
207
  };
226
208
  Transition.prototype.onPause = function () {
227
- var _a;
228
209
  for (var key in this.animations) {
229
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
210
+ this.animations[key].pause();
230
211
  }
231
212
  };
232
213
  Transition.prototype.onResume = function () {
233
- var _a;
234
214
  for (var key in this.animations) {
235
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
215
+ this.animations[key].resume();
236
216
  }
237
217
  };
238
218
  Transition.prototype.onDestroy = function () {
239
- var _a;
240
219
  for (var key in this.animations) {
241
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
220
+ this.animations[key].destroy();
242
221
  }
243
222
  this.tweenGroup.removeAll();
244
223
  this.tweenGroup = null;
@@ -246,28 +225,8 @@ var Transition = (function (_super) {
246
225
  this.animations = null;
247
226
  this.removeAllListeners();
248
227
  };
249
- Transition.prototype.update = function (e) {
250
- var e_1, _a;
251
- var _b;
252
- this.currentTime = e.time;
253
- for (var key in this.animations) {
254
- this.animations[key].currentTime = e.time;
255
- }
256
- this.tweenGroup.update(e.time);
257
- try {
258
- for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
259
- var play = _d.value;
260
- (_b = this.animations[play.name]) === null || _b === void 0 ? void 0 : _b.play(play.iteration, this.currentTime);
261
- }
262
- }
263
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
264
- finally {
265
- try {
266
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
267
- }
268
- finally { if (e_1) throw e_1.error; }
269
- }
270
- this.needPlay.length = 0;
228
+ Transition.prototype.update = function () {
229
+ this.tweenGroup.update();
271
230
  };
272
231
  Transition.prototype.newAnimation = function (name) {
273
232
  var _this = this;
@@ -294,3 +253,4 @@ var TransitionSystem$1 = TransitionSystem;
294
253
 
295
254
  exports.Transition = Transition$1;
296
255
  exports.TransitionSystem = TransitionSystem$1;
256
+ //# sourceMappingURL=plugin-transition.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-transition.cjs.js","sources":["../lib/animation.ts","../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Tween, Easing } from '@tweenjs/tween.js';\nimport type { Group } from '@tweenjs/tween.js';\n\ninterface CacheItem {\n property: Record<string, any>;\n key: string;\n}\n\ntype Cache = Record<string, CacheItem>;\n\nconst easingMap = {\n linear: Easing.Linear.None,\n 'ease-in': Easing.Quadratic.In,\n 'ease-out': Easing.Quadratic.Out,\n 'ease-in-out': Easing.Quadratic.InOut,\n 'bounce-in': Easing.Bounce.In,\n 'bounce-out': Easing.Bounce.Out,\n 'bounce-in-out': Easing.Bounce.InOut,\n none: p => ~~p,\n};\n\nexport default class Animation {\n private tweens = [];\n private timelines = [];\n private finishCount = 0;\n private callbacks = new Map();\n readonly tweenGroup: Group;\n\n stoped: boolean;\n objectCache: Record<string, Cache> = {};\n currIteration: number = 0;\n iteration: number;\n checkFinishFunc: Function;\n\n constructor(timelines, tweenGroup: Group) {\n this.timelines = timelines;\n this.tweenGroup = tweenGroup;\n }\n\n on(eventName, callback) {\n if (!this.callbacks[eventName]) {\n this.callbacks.set(eventName, []);\n }\n this.callbacks.get(eventName).push(callback);\n }\n\n emit(eventName) {\n const callbacks = this.callbacks.get(eventName);\n if (!callbacks || !callbacks.length) return;\n callbacks.forEach(fn => fn());\n }\n\n checkFinish() {\n if (++this.finishCount == this.tweens.length) {\n if (++this.currIteration == this.iteration) {\n this.emit('finish');\n } else {\n if (this.stoped) return;\n this.start();\n }\n }\n }\n\n getObjectCache(component, name): CacheItem {\n const key = `${component.gameObject.id}${component.name}`;\n if (!this.objectCache[key]) {\n this.objectCache[key] = {};\n }\n if (this.objectCache[key][name]) {\n return this.objectCache[key][name];\n }\n const keys = name.split('.');\n const keyIndex = keys.length - 1;\n let property = component;\n for (let i = 0; i < keyIndex; i++) {\n property = property[keys[i]];\n }\n this.objectCache[key][name] = { property, key: keys[keyIndex] };\n return this.objectCache[key][name];\n }\n\n doAnim({ component, name, value }) {\n const { property, key } = this.getObjectCache(component, name);\n property[key] = value;\n }\n\n init() {\n this.checkFinishFunc = this.checkFinish.bind(this);\n\n let lastTween;\n this.timelines.forEach((timeline, i) => {\n for (let j = 0; j < timeline.values.length - 1; j++) {\n const frame = timeline.values[j];\n const nextFrame = timeline.values[j + 1];\n\n const tween = new Tween({ value: frame.value }, this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween])\n .onUpdate(props => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: props.value,\n });\n });\n\n if (j === 0) {\n this.tweens[i] = tween;\n } else {\n lastTween.chain(tween);\n }\n\n lastTween = tween;\n }\n lastTween && lastTween.onComplete(() => this.checkFinishFunc());\n });\n }\n\n play(iteration = 1) {\n this.stoped = false;\n this.start();\n this.currIteration = 0;\n this.iteration = iteration;\n }\n\n start() {\n this.finishCount = 0;\n this.tweens.length = 0;\n this.init();\n this.tweens.forEach((tween: Tween<any>) => tween.start());\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause());\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume());\n }\n\n stop() {\n this.stoped = true;\n this.tweens.forEach((tween: Tween<any>) => tween.stop());\n }\n\n destroy() {\n this.stop();\n this.tweens = null;\n this.timelines = null;\n this.objectCache = null;\n this.callbacks.clear();\n this.callbacks = null;\n }\n}\n","import Animation from './animation';\nimport { Component } from '@eva/eva.js';\nimport { Group } from '@tweenjs/tween.js';\n\ninterface AnimationStruct {\n name: string;\n component: Component;\n values: {\n time: number;\n value: number;\n tween?: string;\n }[];\n}\ninterface TransitionParams {\n group: Record<string, AnimationStruct[]>;\n}\nexport default class Transition extends Component<TransitionParams> {\n static componentName: string = 'Transition';\n\n private animations: Record<string, Animation> = {};\n\n tweenGroup: Group;\n group: Record<string, AnimationStruct[]> = {};\n\n init({ group } = { group: {} }) {\n this.group = group;\n this.tweenGroup = new Group();\n }\n\n awake() {\n for (const name in this.group) {\n this.newAnimation(name);\n }\n }\n\n play(name: string, iteration: number) {\n if (!name) {\n name = Object.keys(this.group)[0];\n }\n if (name && !this.animations[name] && this.group[name]) {\n this.newAnimation(name);\n }\n if (name && this.animations[name]) {\n this.animations[name].play(iteration);\n }\n }\n\n stop(name) {\n if (!name) {\n for (const key in this.animations) {\n this.animations[key].stop();\n }\n } else {\n this.animations[name].stop();\n }\n }\n\n onPause() {\n for (const key in this.animations) {\n this.animations[key].pause();\n }\n }\n\n onResume() {\n for (const key in this.animations) {\n this.animations[key].resume();\n }\n }\n\n onDestroy() {\n for (const key in this.animations) {\n this.animations[key].destroy();\n }\n this.tweenGroup.removeAll();\n this.tweenGroup = null;\n this.group = null;\n this.animations = null;\n this.removeAllListeners();\n }\n\n update() {\n this.tweenGroup.update();\n }\n\n newAnimation(name) {\n const animation = new Animation(this.group[name], this.tweenGroup);\n animation.on('finish', () => this.emit('finish', name));\n this.animations[name] = animation;\n }\n}\n","import { System } from '@eva/eva.js';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n"],"names":["Easing","Tween","Group","Animation","Component","System"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,SAAS,GAAG;IAChB,MAAM,EAAEA,eAAM,CAAC,MAAM,CAAC,IAAI;IAC1B,SAAS,EAAEA,eAAM,CAAC,SAAS,CAAC,EAAE;IAC9B,UAAU,EAAEA,eAAM,CAAC,SAAS,CAAC,GAAG;IAChC,aAAa,EAAEA,eAAM,CAAC,SAAS,CAAC,KAAK;IACrC,WAAW,EAAEA,eAAM,CAAC,MAAM,CAAC,EAAE;IAC7B,YAAY,EAAEA,eAAM,CAAC,MAAM,CAAC,GAAG;IAC/B,eAAe,EAAEA,eAAM,CAAC,MAAM,CAAC,KAAK;IACpC,IAAI,EAAE,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,CAAC,GAAA;CACf,CAAC;AAEF;IAaE,mBAAY,SAAS,EAAE,UAAiB;QAZhC,WAAM,GAAG,EAAE,CAAC;QACZ,cAAS,GAAG,EAAE,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAChB,cAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAI9B,gBAAW,GAA0B,EAAE,CAAC;QACxC,kBAAa,GAAW,CAAC,CAAC;QAKxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAA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AC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;SAC/B;KACF;IAED,8BAAS,GAAT;QACE,KAAK,IAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;SAChC;QACD,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;IAED,2BAAM,GAAN;QACE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;KAC1B;IAED,iCAAY,GAAZ,UAAa,IAAI;QAAjB,iBAIC;QAHC,IAAM,SAAS,GAAG,IAAIC,WAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACnE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAM,OAAA,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAA,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;KACnC;IAvEM,wBAAa,GAAW,YAAY,CAAC;IAwE9C,iBAAC;CAAA,CAzEuCC,gBAAS,GAyEhD;mBAzEoB,UAAU;;ACd/B;IAA8C,oCAAM;IAApD;QAAA,qEAGC;QADU,UAAI,GAAG,YAAY,CAAC;;KAC9B;IAFQ,2BAAU,GAAG,YAAY,CAAC;IAEnC,uBAAC;CAAA,CAH6CC,aAAM,GAGnD;yBAHoB,gBAAgB;;;;;"}
@@ -1,2 +1 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@tweenjs/tween.js"),n=require("@eva/eva.js"),i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])})(t,n)};function e(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var o={linear:t.Easing.Linear.None,"ease-in":t.Easing.Quadratic.In,"ease-out":t.Easing.Quadratic.Out,"ease-in-out":t.Easing.Quadratic.InOut,"bounce-in":t.Easing.Bounce.In,"bounce-out":t.Easing.Bounce.Out,"bounce-in-out":t.Easing.Bounce.InOut,none:function(t){return~~t}},s=function(){function n(t,n){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=n}return n.prototype.on=function(t,n){this.callbacks[t]||this.callbacks.set(t,[]),this.callbacks.get(t).push(n)},n.prototype.emit=function(t){var n=this.callbacks.get(t);n&&n.length&&n.forEach((function(t){return t()}))},n.prototype.checkFinish=function(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stoped)return;this.start()}},n.prototype.getObjectCache=function(t,n){var i=""+t.gameObject.id+t.name;if(this.objectCache[i]||(this.objectCache[i]={}),this.objectCache[i][n])return this.objectCache[i][n];for(var e=n.split("."),o=e.length-1,s=t,r=0;r<o;r++)s=s[e[r]];return this.objectCache[i][n]={property:s,key:e[o]},this.objectCache[i][n]},n.prototype.doAnim=function(t){var n=t.component,i=t.name,e=t.value,o=this.getObjectCache(n,i);o.property[o.key]=e},n.prototype.init=function(){var n,i=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(e,s){for(var r=0;r<e.values.length-1;r++){var a=e.values[r],u=e.values[r+1],h=new t.Tween({value:a.value},i.tweenGroup).to({value:u.value}).duration(u.time-a.time).easing(o[a.tween]).onUpdate((function(t){i.doAnim({component:e.component,name:e.name,value:t.value})}));0===r?i.tweens[s]=h:n.chain(h),n=h}n&&n.onComplete((function(){return i.checkFinishFunc()}))}))},n.prototype.play=function(t){void 0===t&&(t=1),this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},n.prototype.start=function(){this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(t){return t.start()}))},n.prototype.pause=function(){this.tweens.forEach((function(t){return t.pause()}))},n.prototype.resume=function(){this.tweens.forEach((function(t){return t.resume()}))},n.prototype.stop=function(){this.stoped=!0,this.tweens.forEach((function(t){return t.stop()}))},n.prototype.destroy=function(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null},n}(),r=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.animations={},t.group={},t}return e(i,n),i.prototype.init=function(n){var i=(void 0===n?{group:{}}:n).group;this.group=i,this.tweenGroup=new t.Group},i.prototype.awake=function(){for(var t in this.group)this.newAnimation(t)},i.prototype.play=function(t,n){t||(t=Object.keys(this.group)[0]),t&&!this.animations[t]&&this.group[t]&&this.newAnimation(t),t&&this.animations[t]&&this.animations[t].play(n)},i.prototype.stop=function(t){if(t)this.animations[t].stop();else for(var n in this.animations)this.animations[n].stop()},i.prototype.onPause=function(){for(var t in this.animations)this.animations[t].pause()},i.prototype.onResume=function(){for(var t in this.animations)this.animations[t].resume()},i.prototype.onDestroy=function(){for(var t in this.animations)this.animations[t].destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},i.prototype.update=function(){this.tweenGroup.update()},i.prototype.newAnimation=function(t){var n=this,i=new s(this.group[t],this.tweenGroup);i.on("finish",(function(){return n.emit("finish",t)})),this.animations[t]=i},i.componentName="Transition",i}(n.Component),a=function(t){function n(){var n=null!==t&&t.apply(this,arguments)||this;return n.name="transition",n}return e(n,t),n.systemName="transition",n}(n.System);exports.Transition=r,exports.TransitionSystem=a;
2
- //# sourceMappingURL=plugin-transition.cjs.prod.js.map
@@ -28,17 +28,6 @@ function __extends(d, b) {
28
28
  extendStatics(d, b);
29
29
  function __() { this.constructor = d; }
30
30
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31
- }
32
-
33
- function __values(o) {
34
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
35
- if (m) return m.call(o);
36
- return {
37
- next: function () {
38
- if (o && i >= o.length) o = void 0;
39
- return { value: o && o[i++], done: !o };
40
- }
41
- };
42
31
  }
43
32
 
44
33
  var easingMap = {
@@ -138,28 +127,24 @@ var Animation = (function () {
138
127
  lastTween && lastTween.onComplete(function () { return _this.checkFinishFunc(); });
139
128
  });
140
129
  };
141
- Animation.prototype.play = function (iteration, currentTime) {
130
+ Animation.prototype.play = function (iteration) {
142
131
  if (iteration === void 0) { iteration = 1; }
143
- this.currentTime = currentTime;
144
132
  this.stoped = false;
145
133
  this.start();
146
134
  this.currIteration = 0;
147
135
  this.iteration = iteration;
148
136
  };
149
137
  Animation.prototype.start = function () {
150
- var _this = this;
151
138
  this.finishCount = 0;
152
139
  this.tweens.length = 0;
153
140
  this.init();
154
- this.tweens.forEach(function (tween) { return tween.start(_this.currentTime); });
141
+ this.tweens.forEach(function (tween) { return tween.start(); });
155
142
  };
156
143
  Animation.prototype.pause = function () {
157
- var _this = this;
158
- this.tweens.forEach(function (tween) { return tween.pause(_this.currentTime); });
144
+ this.tweens.forEach(function (tween) { return tween.pause(); });
159
145
  };
160
146
  Animation.prototype.resume = function () {
161
- var _this = this;
162
- this.tweens.forEach(function (tween) { return tween.resume(_this.currentTime); });
147
+ this.tweens.forEach(function (tween) { return tween.resume(); });
163
148
  };
164
149
  Animation.prototype.stop = function () {
165
150
  this.stoped = true;
@@ -183,8 +168,6 @@ var Transition = (function (_super) {
183
168
  var _this = _super !== null && _super.apply(this, arguments) || this;
184
169
  _this.animations = {};
185
170
  _this.group = {};
186
- _this.currentTime = 0;
187
- _this.needPlay = [];
188
171
  return _this;
189
172
  }
190
173
  Transition.prototype.init = function (_a) {
@@ -205,36 +188,32 @@ var Transition = (function (_super) {
205
188
  this.newAnimation(name);
206
189
  }
207
190
  if (name && this.animations[name]) {
208
- this.needPlay.push({ name: name, iteration: iteration });
191
+ this.animations[name].play(iteration);
209
192
  }
210
193
  };
211
194
  Transition.prototype.stop = function (name) {
212
- var _a, _b;
213
195
  if (!name) {
214
196
  for (var key in this.animations) {
215
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
197
+ this.animations[key].stop();
216
198
  }
217
199
  }
218
200
  else {
219
- (_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
201
+ this.animations[name].stop();
220
202
  }
221
203
  };
222
204
  Transition.prototype.onPause = function () {
223
- var _a;
224
205
  for (var key in this.animations) {
225
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
206
+ this.animations[key].pause();
226
207
  }
227
208
  };
228
209
  Transition.prototype.onResume = function () {
229
- var _a;
230
210
  for (var key in this.animations) {
231
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
211
+ this.animations[key].resume();
232
212
  }
233
213
  };
234
214
  Transition.prototype.onDestroy = function () {
235
- var _a;
236
215
  for (var key in this.animations) {
237
- (_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
216
+ this.animations[key].destroy();
238
217
  }
239
218
  this.tweenGroup.removeAll();
240
219
  this.tweenGroup = null;
@@ -242,28 +221,8 @@ var Transition = (function (_super) {
242
221
  this.animations = null;
243
222
  this.removeAllListeners();
244
223
  };
245
- Transition.prototype.update = function (e) {
246
- var e_1, _a;
247
- var _b;
248
- this.currentTime = e.time;
249
- for (var key in this.animations) {
250
- this.animations[key].currentTime = e.time;
251
- }
252
- this.tweenGroup.update(e.time);
253
- try {
254
- for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
255
- var play = _d.value;
256
- (_b = this.animations[play.name]) === null || _b === void 0 ? void 0 : _b.play(play.iteration, this.currentTime);
257
- }
258
- }
259
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
260
- finally {
261
- try {
262
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
263
- }
264
- finally { if (e_1) throw e_1.error; }
265
- }
266
- this.needPlay.length = 0;
224
+ Transition.prototype.update = function () {
225
+ this.tweenGroup.update();
267
226
  };
268
227
  Transition.prototype.newAnimation = function (name) {
269
228
  var _this = this;
@@ -289,3 +248,4 @@ var TransitionSystem = (function (_super) {
289
248
  var TransitionSystem$1 = TransitionSystem;
290
249
 
291
250
  export { Transition$1 as Transition, TransitionSystem$1 as TransitionSystem };
251
+ //# sourceMappingURL=plugin-transition.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-transition.esm.js","sources":["../lib/animation.ts","../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Tween, Easing } from '@tweenjs/tween.js';\nimport type { Group } from '@tweenjs/tween.js';\n\ninterface CacheItem {\n property: Record<string, any>;\n key: string;\n}\n\ntype Cache = Record<string, CacheItem>;\n\nconst easingMap = {\n linear: Easing.Linear.None,\n 'ease-in': Easing.Quadratic.In,\n 'ease-out': Easing.Quadratic.Out,\n 'ease-in-out': Easing.Quadratic.InOut,\n 'bounce-in': Easing.Bounce.In,\n 'bounce-out': Easing.Bounce.Out,\n 'bounce-in-out': Easing.Bounce.InOut,\n none: p => ~~p,\n};\n\nexport default class Animation {\n private tweens = [];\n private timelines = [];\n private finishCount = 0;\n private callbacks = new Map();\n readonly tweenGroup: Group;\n\n stoped: boolean;\n objectCache: Record<string, Cache> = {};\n currIteration: number = 0;\n iteration: number;\n checkFinishFunc: Function;\n\n constructor(timelines, tweenGroup: Group) {\n this.timelines = timelines;\n this.tweenGroup = tweenGroup;\n }\n\n on(eventName, callback) {\n if (!this.callbacks[eventName]) {\n this.callbacks.set(eventName, []);\n }\n this.callbacks.get(eventName).push(callback);\n }\n\n emit(eventName) {\n const callbacks = this.callbacks.get(eventName);\n if (!callbacks || !callbacks.length) return;\n callbacks.forEach(fn => fn());\n }\n\n checkFinish() {\n if (++this.finishCount == this.tweens.length) {\n if (++this.currIteration == this.iteration) {\n this.emit('finish');\n } else {\n if (this.stoped) return;\n this.start();\n }\n }\n }\n\n getObjectCache(component, name): CacheItem {\n const key = `${component.gameObject.id}${component.name}`;\n if (!this.objectCache[key]) {\n this.objectCache[key] = {};\n }\n if (this.objectCache[key][name]) {\n return this.objectCache[key][name];\n }\n const keys = name.split('.');\n const keyIndex = keys.length - 1;\n let property = component;\n for (let i = 0; i < keyIndex; i++) {\n property = property[keys[i]];\n }\n this.objectCache[key][name] = { property, key: keys[keyIndex] };\n return this.objectCache[key][name];\n }\n\n doAnim({ component, name, value }) {\n const { property, key } = this.getObjectCache(component, name);\n property[key] = value;\n }\n\n init() {\n this.checkFinishFunc = this.checkFinish.bind(this);\n\n let lastTween;\n this.timelines.forEach((timeline, i) => {\n for (let j = 0; j < timeline.values.length - 1; j++) {\n const frame = timeline.values[j];\n const nextFrame = timeline.values[j + 1];\n\n const tween = new Tween({ value: frame.value }, this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween])\n .onUpdate(props => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: props.value,\n });\n });\n\n if (j === 0) {\n this.tweens[i] = tween;\n } else {\n lastTween.chain(tween);\n }\n\n lastTween = tween;\n }\n lastTween && lastTween.onComplete(() => this.checkFinishFunc());\n });\n }\n\n play(iteration = 1) {\n this.stoped = false;\n this.start();\n this.currIteration = 0;\n this.iteration = iteration;\n }\n\n start() {\n this.finishCount = 0;\n this.tweens.length = 0;\n this.init();\n this.tweens.forEach((tween: Tween<any>) => tween.start());\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause());\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume());\n }\n\n stop() {\n this.stoped = true;\n this.tweens.forEach((tween: Tween<any>) => tween.stop());\n }\n\n destroy() {\n this.stop();\n this.tweens = null;\n this.timelines = null;\n this.objectCache = null;\n this.callbacks.clear();\n this.callbacks = null;\n }\n}\n","import Animation from './animation';\nimport { Component } from '@eva/eva.js';\nimport { Group } from '@tweenjs/tween.js';\n\ninterface AnimationStruct {\n name: string;\n component: Component;\n values: {\n time: number;\n value: number;\n tween?: string;\n }[];\n}\ninterface TransitionParams {\n group: Record<string, AnimationStruct[]>;\n}\nexport default class Transition extends Component<TransitionParams> {\n static componentName: string = 'Transition';\n\n private animations: Record<string, Animation> = {};\n\n tweenGroup: Group;\n group: Record<string, AnimationStruct[]> = {};\n\n init({ group } = { group: {} }) {\n this.group = group;\n this.tweenGroup = new Group();\n }\n\n awake() {\n for (const name in this.group) {\n this.newAnimation(name);\n }\n }\n\n play(name: string, iteration: number) {\n if (!name) {\n name = Object.keys(this.group)[0];\n }\n if (name && !this.animations[name] && this.group[name]) {\n this.newAnimation(name);\n }\n if (name && this.animations[name]) {\n this.animations[name].play(iteration);\n }\n }\n\n stop(name) {\n if (!name) {\n for (const key in this.animations) {\n this.animations[key].stop();\n }\n } else {\n this.animations[name].stop();\n }\n }\n\n onPause() {\n for (const key in this.animations) {\n this.animations[key].pause();\n }\n }\n\n onResume() {\n for (const key in this.animations) {\n this.animations[key].resume();\n }\n }\n\n onDestroy() {\n for (const key in this.animations) {\n this.animations[key].destroy();\n }\n this.tweenGroup.removeAll();\n this.tweenGroup = null;\n this.group = null;\n this.animations = null;\n this.removeAllListeners();\n }\n\n update() {\n this.tweenGroup.update();\n }\n\n newAnimation(name) {\n const animation = new Animation(this.group[name], this.tweenGroup);\n animation.on('finish', () => this.emit('finish', name));\n this.animations[name] = animation;\n }\n}\n","import { System } from '@eva/eva.js';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n"],"names":["Animation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,SAAS,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;IAC1B,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;IAC9B,UAAU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C,UAAU,CAAC,CAAC;QACnE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAM,OAAA,KAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAA,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;KACnC;IAvEM,wBAAa,GAAW,YAAY,CAAC;IAwE9C,iBAAC;CAAA,CAzEuC,SAAS,GAyEhD;mBAzEoB,UAAU;;ACd/B;IAA8C,oCAAM;IAApD;QAAA,qEAGC;QADU,UAAI,GAAG,YAAY,CAAC;;KAC9B;IAFQ,2BAAU,GAAG,YAAY,CAAC;IAEnC,uBAAC;CAAA,CAH6C,MAAM,GAGnD;yBAHoB,gBAAgB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-transition",
3
- "version": "1.1.1-fix.2",
3
+ "version": "1.1.1-fix.3",
4
4
  "description": "@eva/plugin-transition",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-transition.esm.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "1.1.1-fix.2",
21
+ "@eva/eva.js": "1.1.1-fix.3",
22
22
  "@tweenjs/tween.js": "^18.6.4",
23
23
  "sprite-timeline": "^1.10.2"
24
24
  }