@eva/plugin-transition 1.2.7-editor.9 → 1.2.7-fix.5
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.
- package/dist/EVA.plugin.transition.js.map +1 -0
- package/dist/EVA.plugin.transition.min.js +1 -1
- package/dist/miniprogram.js +340 -0
- package/dist/plugin-transition.cjs.js.map +1 -0
- package/dist/plugin-transition.cjs.prod.js +1 -1
- package/dist/plugin-transition.esm.js.map +1 -0
- package/package.json +2 -2
|
@@ -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,EAA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U,UAAI,GAAG,YAAY,CAAC;;SAC9B;QAFQ,2BAAU,GAAG,YAAY,CAAC;QAEnC,uBAAC;KAAA,CAH6CC,aAAM,GAGnD;6BAHoB,gBAAgB;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var i=function(t,e){return i=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])},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 r,o={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-o.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*o.Bounce.In(2*t):.5*o.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 r=this._tweens[i[n]],o=!e;r&&!1===r.update(t,o)&&!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,r=Math.floor(n),o=u.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},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:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}),CatmullRom:function(t,e,i,n,r){var o=.5*(i-t),s=.5*(n-e),a=r*r;return(2*e-2*i+o+s)*(r*a)+(-3*e+3*i-2*o-s)*a+o*r+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=o.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 r in i){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(i[r]);if("undefined"!==a&&"function"!==a){if(u){var h=i[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),n[r]=u?i[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];n[r]=s?[]:{},this._setupProperties(o,e[r],i[r],n[r])}}}},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,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)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 o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),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 r in i)if(void 0!==e[r]){var o=e[r]||0,s=i[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[r],o,s,n):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*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:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.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("."),r=n.length-1,o=t,s=0;s<r;s++)o=o[n[s]];return this.objectCache[i][e]={property:o,key:n[r]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,r=this.getObjectCache(e,i);r.property[r.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var r=0;r<i.values.length-1;r++){var o=i.values[r],s=i.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===r?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},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.currentTime=0,e.needPlay=[],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.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var n in this.animations)null===(e=this.animations[n])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,i,n;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(n=this.animations[a.name])||void 0===n||n.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},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=d,v=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),m=v;return t.Transition=y,t.TransitionSystem=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
|
|
1
|
+
window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_transition=function(t,e){"use strict";var i=function(t,e){return(i=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 r,o={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-o.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*o.Bounce.In(2*t):.5*o.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 r=this._tweens[i[n]],o=!e;r&&!1===r.update(t,o)&&!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,r=Math.floor(n),o=u.Utils.Linear;return e<0?o(t[0],t[1],n):e>1?o(t[i],t[i-1],i-n):o(t[r],t[r+1>i?i:r+1],n-r)},Bezier:function(t,e){for(var i=0,n=t.length-1,r=Math.pow,o=u.Utils.Bernstein,s=0;s<=n;s++)i+=r(1-e,n-s)*r(e,s)*t[s]*o(n,s);return i},CatmullRom:function(t,e){var i=t.length-1,n=i*e,r=Math.floor(n),o=u.Utils.CatmullRom;return t[0]===t[i]?(e<0&&(r=Math.floor(n=i*(1+e))),o(t[(r-1+i)%i],t[r],t[(r+1)%i],t[(r+2)%i],n-r)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(o(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):o(t[r?r-1:0],t[r],t[i<r+1?i:r+1],t[i<r+2?i:r+2],n-r)},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:(r=[1],function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}),CatmullRom:function(t,e,i,n,r){var o=.5*(i-t),s=.5*(n-e),a=r*r;return(2*e-2*i+o+s)*(r*a)+(-3*e+3*i-2*o-s)*a+o*r+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=o.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 r in i){var o=t[r],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(i[r]);if("undefined"!==a&&"function"!==a){if(u){var h=i[r];if(0===h.length)continue;h=h.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(h)}if("object"!==a&&!s||!o||u)void 0===e[r]&&(e[r]=o),s||(e[r]*=1),n[r]=u?i[r].slice().reverse():e[r]||0;else{for(var p in e[r]=s?[]:{},o)e[r][p]=o[p];n[r]=s?[]:{},this._setupProperties(o,e[r],i[r],n[r])}}}},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,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>r)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 o=this._easingFunction(n);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),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 r in i)if(void 0!==e[r]){var o=e[r]||0,s=i[r],a=Array.isArray(t[r]),u=Array.isArray(s);!a&&u?t[r]=this._interpolationFunction(s,n):"object"==typeof s&&s?this._updateProperties(t[r],o,s,n):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[r]=o+(s-o)*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:o.Linear.None,"ease-in":o.Quadratic.In,"ease-out":o.Quadratic.Out,"ease-in-out":o.Quadratic.InOut,"bounce-in":o.Bounce.In,"bounce-out":o.Bounce.Out,"bounce-in-out":o.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("."),r=n.length-1,o=t,s=0;s<r;s++)o=o[n[s]];return this.objectCache[i][e]={property:o,key:n[r]},this.objectCache[i][e]},t.prototype.doAnim=function(t){var e=t.component,i=t.name,n=t.value,r=this.getObjectCache(e,i);r.property[r.key]=n},t.prototype.init=function(){var t,e=this;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((function(i,n){for(var r=0;r<i.values.length-1;r++){var o=i.values[r],s=i.values[r+1],a=new c({value:o.value},e.tweenGroup).to({value:s.value}).duration(s.time-o.time).easing(f[o.tween]).onUpdate((function(t){e.doAnim({component:i.component,name:i.name,value:t.value})}));0===r?e.tweens[n]=a:t.chain(a),t=a}t&&t.onComplete((function(){return e.checkFinishFunc()}))}))},t.prototype.play=function(t,e){void 0===t&&(t=1),this.currentTime=e,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},t.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(e){return e.start(t.currentTime)}))},t.prototype.pause=function(){var t=this;this.tweens.forEach((function(e){return e.pause(t.currentTime)}))},t.prototype.resume=function(){var t=this;this.tweens.forEach((function(e){return e.resume(t.currentTime)}))},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.currentTime=0,e.needPlay=[],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.needPlay.push({name:t,iteration:e})},e.prototype.stop=function(t){var e,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var n in this.animations)null===(e=this.animations[n])||void 0===e||e.stop()},e.prototype.onPause=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.pause()},e.prototype.onResume=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.resume()},e.prototype.onDestroy=function(){var t;for(var e in this.animations)null===(t=this.animations[e])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},e.prototype.update=function(t){var e,i,n;for(var r in this.currentTime=t.time,this.animations)this.animations[r].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var o=function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(this.needPlay),s=o.next();!s.done;s=o.next()){var a=s.value;null===(n=this.animations[a.name])||void 0===n||n.play(a.iteration,this.currentTime)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}this.needPlay.length=0},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);return t.Transition=d,t.TransitionSystem=y,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.transition=window.EVA.plugin.transition||_EVA_IIFE_transition;
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { __extends, __values } from 'tslib';
|
|
2
|
+
import { Easing, Tween, Group } from '@tweenjs/tween.js';
|
|
3
|
+
import { Component, System } from '@eva/eva.js/dist/miniprogram';
|
|
4
|
+
var easingMap = {
|
|
5
|
+
linear: Easing.Linear.None,
|
|
6
|
+
'ease-in': Easing.Quadratic.In,
|
|
7
|
+
'ease-out': Easing.Quadratic.Out,
|
|
8
|
+
'ease-in-out': Easing.Quadratic.InOut,
|
|
9
|
+
'bounce-in': Easing.Bounce.In,
|
|
10
|
+
'bounce-out': Easing.Bounce.Out,
|
|
11
|
+
'bounce-in-out': Easing.Bounce.InOut,
|
|
12
|
+
none: function none(p) {
|
|
13
|
+
return ~~p;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var Animation = function () {
|
|
18
|
+
function Animation(timelines, tweenGroup) {
|
|
19
|
+
this.tweens = [];
|
|
20
|
+
this.timelines = [];
|
|
21
|
+
this.finishCount = 0;
|
|
22
|
+
this.callbacks = new Map();
|
|
23
|
+
this.objectCache = {};
|
|
24
|
+
this.currIteration = 0;
|
|
25
|
+
this.timelines = timelines;
|
|
26
|
+
this.tweenGroup = tweenGroup;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Animation.prototype.on = function (eventName, callback) {
|
|
30
|
+
if (!this.callbacks[eventName]) {
|
|
31
|
+
this.callbacks.set(eventName, []);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.callbacks.get(eventName).push(callback);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Animation.prototype.emit = function (eventName) {
|
|
38
|
+
var callbacks = this.callbacks.get(eventName);
|
|
39
|
+
if (!callbacks || !callbacks.length) return;
|
|
40
|
+
callbacks.forEach(function (fn) {
|
|
41
|
+
return fn();
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Animation.prototype.checkFinish = function () {
|
|
46
|
+
if (++this.finishCount == this.tweens.length) {
|
|
47
|
+
if (++this.currIteration == this.iteration) {
|
|
48
|
+
this.emit('finish');
|
|
49
|
+
} else {
|
|
50
|
+
if (this.stoped) return;
|
|
51
|
+
this.start();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
Animation.prototype.getObjectCache = function (component, name) {
|
|
57
|
+
var key = "" + component.gameObject.id + component.name;
|
|
58
|
+
|
|
59
|
+
if (!this.objectCache[key]) {
|
|
60
|
+
this.objectCache[key] = {};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.objectCache[key][name]) {
|
|
64
|
+
return this.objectCache[key][name];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var keys = name.split('.');
|
|
68
|
+
var keyIndex = keys.length - 1;
|
|
69
|
+
var property = component;
|
|
70
|
+
|
|
71
|
+
for (var i = 0; i < keyIndex; i++) {
|
|
72
|
+
property = property[keys[i]];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.objectCache[key][name] = {
|
|
76
|
+
property: property,
|
|
77
|
+
key: keys[keyIndex]
|
|
78
|
+
};
|
|
79
|
+
return this.objectCache[key][name];
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
Animation.prototype.doAnim = function (_a) {
|
|
83
|
+
var component = _a.component,
|
|
84
|
+
name = _a.name,
|
|
85
|
+
value = _a.value;
|
|
86
|
+
|
|
87
|
+
var _b = this.getObjectCache(component, name),
|
|
88
|
+
property = _b.property,
|
|
89
|
+
key = _b.key;
|
|
90
|
+
|
|
91
|
+
property[key] = value;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Animation.prototype.init = function () {
|
|
95
|
+
var _this = this;
|
|
96
|
+
|
|
97
|
+
this.checkFinishFunc = this.checkFinish.bind(this);
|
|
98
|
+
var lastTween;
|
|
99
|
+
this.timelines.forEach(function (timeline, i) {
|
|
100
|
+
for (var j = 0; j < timeline.values.length - 1; j++) {
|
|
101
|
+
var frame = timeline.values[j];
|
|
102
|
+
var nextFrame = timeline.values[j + 1];
|
|
103
|
+
var tween = new Tween({
|
|
104
|
+
value: frame.value
|
|
105
|
+
}, _this.tweenGroup).to({
|
|
106
|
+
value: nextFrame.value
|
|
107
|
+
}).duration(nextFrame.time - frame.time).easing(easingMap[frame.tween]).onUpdate(function (props) {
|
|
108
|
+
_this.doAnim({
|
|
109
|
+
component: timeline.component,
|
|
110
|
+
name: timeline.name,
|
|
111
|
+
value: props.value
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (j === 0) {
|
|
116
|
+
_this.tweens[i] = tween;
|
|
117
|
+
} else {
|
|
118
|
+
lastTween.chain(tween);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
lastTween = tween;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
lastTween && lastTween.onComplete(function () {
|
|
125
|
+
return _this.checkFinishFunc();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
Animation.prototype.play = function (iteration, currentTime) {
|
|
131
|
+
if (iteration === void 0) {
|
|
132
|
+
iteration = 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
this.currentTime = currentTime;
|
|
136
|
+
this.stoped = false;
|
|
137
|
+
this.start();
|
|
138
|
+
this.currIteration = 0;
|
|
139
|
+
this.iteration = iteration;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
Animation.prototype.start = function () {
|
|
143
|
+
var _this = this;
|
|
144
|
+
|
|
145
|
+
this.finishCount = 0;
|
|
146
|
+
this.tweens.length = 0;
|
|
147
|
+
this.init();
|
|
148
|
+
this.tweens.forEach(function (tween) {
|
|
149
|
+
return tween.start(_this.currentTime);
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
Animation.prototype.pause = function () {
|
|
154
|
+
var _this = this;
|
|
155
|
+
|
|
156
|
+
this.tweens.forEach(function (tween) {
|
|
157
|
+
return tween.pause(_this.currentTime);
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
Animation.prototype.resume = function () {
|
|
162
|
+
var _this = this;
|
|
163
|
+
|
|
164
|
+
this.tweens.forEach(function (tween) {
|
|
165
|
+
return tween.resume(_this.currentTime);
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
Animation.prototype.stop = function () {
|
|
170
|
+
this.stoped = true;
|
|
171
|
+
this.tweens.forEach(function (tween) {
|
|
172
|
+
return tween.stop();
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
Animation.prototype.destroy = function () {
|
|
177
|
+
this.stop();
|
|
178
|
+
this.tweens = null;
|
|
179
|
+
this.timelines = null;
|
|
180
|
+
this.objectCache = null;
|
|
181
|
+
this.callbacks.clear();
|
|
182
|
+
this.callbacks = null;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return Animation;
|
|
186
|
+
}();
|
|
187
|
+
|
|
188
|
+
var Animation$1 = Animation;
|
|
189
|
+
|
|
190
|
+
var Transition = function (_super) {
|
|
191
|
+
__extends(Transition, _super);
|
|
192
|
+
|
|
193
|
+
function Transition() {
|
|
194
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
195
|
+
|
|
196
|
+
_this.animations = {};
|
|
197
|
+
_this.group = {};
|
|
198
|
+
_this.currentTime = 0;
|
|
199
|
+
_this.needPlay = [];
|
|
200
|
+
return _this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
Transition.prototype.init = function (_a) {
|
|
204
|
+
var group = (_a === void 0 ? {
|
|
205
|
+
group: {}
|
|
206
|
+
} : _a).group;
|
|
207
|
+
this.group = group;
|
|
208
|
+
this.tweenGroup = new Group();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
Transition.prototype.awake = function () {
|
|
212
|
+
for (var name_1 in this.group) {
|
|
213
|
+
this.newAnimation(name_1);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
Transition.prototype.play = function (name, iteration) {
|
|
218
|
+
if (!name) {
|
|
219
|
+
name = Object.keys(this.group)[0];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (name && !this.animations[name] && this.group[name]) {
|
|
223
|
+
this.newAnimation(name);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (name && this.animations[name]) {
|
|
227
|
+
this.needPlay.push({
|
|
228
|
+
name: name,
|
|
229
|
+
iteration: iteration
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
Transition.prototype.stop = function (name) {
|
|
235
|
+
var _a, _b;
|
|
236
|
+
|
|
237
|
+
if (!name) {
|
|
238
|
+
for (var key in this.animations) {
|
|
239
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.stop();
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
(_b = this.animations[name]) === null || _b === void 0 ? void 0 : _b.stop();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
Transition.prototype.onPause = function () {
|
|
247
|
+
var _a;
|
|
248
|
+
|
|
249
|
+
for (var key in this.animations) {
|
|
250
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.pause();
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Transition.prototype.onResume = function () {
|
|
255
|
+
var _a;
|
|
256
|
+
|
|
257
|
+
for (var key in this.animations) {
|
|
258
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.resume();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
Transition.prototype.onDestroy = function () {
|
|
263
|
+
var _a;
|
|
264
|
+
|
|
265
|
+
for (var key in this.animations) {
|
|
266
|
+
(_a = this.animations[key]) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
this.tweenGroup.removeAll();
|
|
270
|
+
this.tweenGroup = null;
|
|
271
|
+
this.group = null;
|
|
272
|
+
this.animations = null;
|
|
273
|
+
this.removeAllListeners();
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
Transition.prototype.update = function (e) {
|
|
277
|
+
var e_1, _a;
|
|
278
|
+
|
|
279
|
+
var _b;
|
|
280
|
+
|
|
281
|
+
this.currentTime = e.time;
|
|
282
|
+
|
|
283
|
+
for (var key in this.animations) {
|
|
284
|
+
this.animations[key].currentTime = e.time;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
this.tweenGroup.update(e.time);
|
|
288
|
+
|
|
289
|
+
try {
|
|
290
|
+
for (var _c = __values(this.needPlay), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
291
|
+
var play = _d.value;
|
|
292
|
+
(_b = this.animations[play.name]) === null || _b === void 0 ? void 0 : _b.play(play.iteration, this.currentTime);
|
|
293
|
+
}
|
|
294
|
+
} catch (e_1_1) {
|
|
295
|
+
e_1 = {
|
|
296
|
+
error: e_1_1
|
|
297
|
+
};
|
|
298
|
+
} finally {
|
|
299
|
+
try {
|
|
300
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
301
|
+
} finally {
|
|
302
|
+
if (e_1) throw e_1.error;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
this.needPlay.length = 0;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
Transition.prototype.newAnimation = function (name) {
|
|
310
|
+
var _this = this;
|
|
311
|
+
|
|
312
|
+
var animation = new Animation$1(this.group[name], this.tweenGroup);
|
|
313
|
+
animation.on('finish', function () {
|
|
314
|
+
return _this.emit('finish', name);
|
|
315
|
+
});
|
|
316
|
+
this.animations[name] = animation;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
Transition.componentName = 'Transition';
|
|
320
|
+
return Transition;
|
|
321
|
+
}(Component);
|
|
322
|
+
|
|
323
|
+
var Transition$1 = Transition;
|
|
324
|
+
|
|
325
|
+
var TransitionSystem = function (_super) {
|
|
326
|
+
__extends(TransitionSystem, _super);
|
|
327
|
+
|
|
328
|
+
function TransitionSystem() {
|
|
329
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
330
|
+
|
|
331
|
+
_this.name = 'transition';
|
|
332
|
+
return _this;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
TransitionSystem.systemName = 'transition';
|
|
336
|
+
return TransitionSystem;
|
|
337
|
+
}(System);
|
|
338
|
+
|
|
339
|
+
var TransitionSystem$1 = TransitionSystem;
|
|
340
|
+
export { Transition$1 as Transition, TransitionSystem$1 as TransitionSystem };
|
|
@@ -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,S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,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 +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
|
|
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}},r=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,r=t,s=0;s<o;s++)r=r[e[s]];return this.objectCache[i][n]={property:r,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,r){for(var s=0;s<e.values.length-1;s++){var a=e.values[s],u=e.values[s+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===s?i.tweens[r]=h:n.chain(h),n=h}n&&n.onComplete((function(){return i.checkFinishFunc()}))}))},n.prototype.play=function(t,n){void 0===t&&(t=1),this.currentTime=n,this.stoped=!1,this.start(),this.currIteration=0,this.iteration=t},n.prototype.start=function(){var t=this;this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach((function(n){return n.start(t.currentTime)}))},n.prototype.pause=function(){var t=this;this.tweens.forEach((function(n){return n.pause(t.currentTime)}))},n.prototype.resume=function(){var t=this;this.tweens.forEach((function(n){return n.resume(t.currentTime)}))},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}(),s=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.animations={},t.group={},t.currentTime=0,t.needPlay=[],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.needPlay.push({name:t,iteration:n})},i.prototype.stop=function(t){var n,i;if(t)null===(i=this.animations[t])||void 0===i||i.stop();else for(var e in this.animations)null===(n=this.animations[e])||void 0===n||n.stop()},i.prototype.onPause=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.pause()},i.prototype.onResume=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.resume()},i.prototype.onDestroy=function(){var t;for(var n in this.animations)null===(t=this.animations[n])||void 0===t||t.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()},i.prototype.update=function(t){var n,i,e;for(var o in this.currentTime=t.time,this.animations)this.animations[o].currentTime=t.time;this.tweenGroup.update(t.time);try{for(var r=function(t){var n="function"==typeof Symbol&&t[Symbol.iterator],i=0;return n?n.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}(this.needPlay),s=r.next();!s.done;s=r.next()){var a=s.value;null===(e=this.animations[a.name])||void 0===e||e.play(a.iteration,this.currentTime)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.needPlay.length=0},i.prototype.newAnimation=function(t){var n=this,i=new r(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=s,exports.TransitionSystem=a;
|
|
@@ -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,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK;IACrC,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;IAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG;IAC/B,eAAe,EAAE,MAAM,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,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,CAH6C,MAAM,GAGnD;yBAHoB,gBAAgB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-transition",
|
|
3
|
-
"version": "1.2.7-
|
|
3
|
+
"version": "1.2.7-fix.5",
|
|
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.2.7-
|
|
21
|
+
"@eva/eva.js": "1.2.7-fix.5",
|
|
22
22
|
"@tweenjs/tween.js": "^18.6.4",
|
|
23
23
|
"sprite-timeline": "^1.10.2"
|
|
24
24
|
}
|