@combos-fun/plugin-transition 0.0.19 → 0.0.21
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.
|
@@ -14,7 +14,7 @@ class TransitionSystem extends engine.System {
|
|
|
14
14
|
/** Auto-generated by scripts/build-package.mjs — do not edit. */
|
|
15
15
|
Object.assign(TransitionSystem, {
|
|
16
16
|
packageName: "@combos-fun/plugin-transition",
|
|
17
|
-
packageVersion: "0.0.
|
|
17
|
+
packageVersion: "0.0.20",
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
const easingMap = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-transition.cjs.js","sources":["../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Animation.ts","../lib/component.ts"],"sourcesContent":["import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport TransitionSystem from './system';\n\nObject.assign(TransitionSystem, {\n packageName: \"@combos-fun/plugin-transition\",\n packageVersion: \"0.0.19\",\n});\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: Record<string, (t: number) => number> = {\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: Easing.Linear.None,\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 currentTime: number;\n\n stopped: 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.get(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.stopped) 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 })\n .group(this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween ?? 'linear'] ?? Easing.Linear.None)\n .onUpdate(obj => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: obj.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, currentTime) {\n this.currentTime = currentTime\n this.stopped = 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(this.currentTime));\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause(this.currentTime));\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume(this.currentTime));\n }\n\n stop() {\n this.stopped = 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 '@combos-fun/engine';\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 private currentTime: number = 0;\n private needPlay: { name: string, iteration?: number }[] = [];\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.needPlay.push({ name, 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 update(e) {\n this.currentTime = e.time\n for (const key in this.animations) {\n this.animations[key].currentTime = e.time\n }\n this.tweenGroup.update(e.time);\n for (const play of this.needPlay) {\n this.animations[play.name]?.play(play.iteration, this.currentTime)\n }\n this.needPlay.length = 0\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"],"names":["System","Easing","Tween","Component","Group"],"mappings":";;;;;AAEc,MAAO,gBAAiB,SAAQA,aAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;ACHnC;AAIA,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;AAC9B,IAAA,WAAW,EAAE,+BAA+B;AAC5C,IAAA,cAAc,EAAE,QAAQ;AACzB,CAAA,CAAC;;ACGF,MAAM,SAAS,GAA0C;AACvD,IAAA,MAAM,EAAEC,eAAM,CAAC,MAAM,CAAC,IAAI;AAC1B,IAAA,SAAS,EAAEA,eAAM,CAAC,SAAS,CAAC,EAAE;AAC9B,IAAA,UAAU,EAAEA,eAAM,CAAC,SAAS,CAAC,GAAG;AAChC,IAAA,aAAa,EAAEA,eAAM,CAAC,SAAS,CAAC,KAAK;AACrC,IAAA,WAAW,EAAEA,eAAM,CAAC,MAAM,CAAC,EAAE;AAC7B,IAAA,YAAY,EAAEA,eAAM,CAAC,MAAM,CAAC,GAAG;AAC/B,IAAA,eAAe,EAAEA,eAAM,CAAC,MAAM,CAAC,KAAK;AACpC,IAAA,IAAI,EAAEA,eAAM,CAAC,MAAM,CAAC,IAAI;CACzB;AAEa,MAAO,SAAS,CAAA;IAc5B,WAAA,CAAY,SAAS,EAAE,UAAiB,EAAA;QAbhC,IAAA,CAAA,MAAM,GAAG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CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;QACpE;AACA,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;IAC1B;AAEA,IAAA,YAAY,CAAC,IAAI,EAAA;AACf,QAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;AAClE,QAAA,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS;IACnC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin-transition.cjs.js","sources":["../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Animation.ts","../lib/component.ts"],"sourcesContent":["import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport TransitionSystem from './system';\n\nObject.assign(TransitionSystem, {\n packageName: \"@combos-fun/plugin-transition\",\n packageVersion: \"0.0.20\",\n});\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: Record<string, (t: number) => number> = {\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: Easing.Linear.None,\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 currentTime: number;\n\n stopped: 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.get(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.stopped) 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 })\n .group(this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween ?? 'linear'] ?? Easing.Linear.None)\n .onUpdate(obj => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: obj.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, currentTime) {\n this.currentTime = currentTime\n this.stopped = 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(this.currentTime));\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause(this.currentTime));\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume(this.currentTime));\n }\n\n stop() {\n this.stopped = 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 '@combos-fun/engine';\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 private currentTime: number = 0;\n private needPlay: { name: string, iteration?: number }[] = [];\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.needPlay.push({ name, 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 update(e) {\n this.currentTime = e.time\n for (const key in this.animations) {\n this.animations[key].currentTime = e.time\n }\n this.tweenGroup.update(e.time);\n for (const play of this.needPlay) {\n this.animations[play.name]?.play(play.iteration, this.currentTime)\n }\n this.needPlay.length = 0\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"],"names":["System","Easing","Tween","Component","Group"],"mappings":";;;;;AAEc,MAAO,gBAAiB,SAAQA,aAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;ACHnC;AAIA,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;AAC9B,IAAA,WAAW,EAAE,+BAA+B;AAC5C,IAAA,cAAc,EAAE,QAAQ;AACzB,CAAA,CAAC;;ACGF,MAAM,SAAS,GAA0C;AACvD,IAAA,MAAM,EAAEC,eAAM,CAAC,MAAM,CAAC,IAAI;AAC1B,IAAA,SAAS,EAAEA,eAAM,CAAC,SAAS,CAAC,EAAE;AAC9B,IAAA,UAAU,EAAEA,eAAM,CAAC,SAAS,CAAC,GAAG;AAChC,IAAA,aAAa,EAAEA,eAAM,CAAC,SAAS,CAAC,KAAK;AACrC,IAAA,WAAW,EAAEA,eAAM,CAAC,MAAM,CAAC,EAAE;AAC7B,IAAA,YAAY,EAAEA,eAAM,CAAC,MAAM,CAAC,GAAG;AAC/B,IAAA,eAAe,EAAEA,eAAM,CAAC,MAAM,CAAC,KAAK;AACpC,IAAA,IAAI,EAAEA,eAAM,CAAC,MAAM,CAAC,IAAI;CACzB;AAEa,MAAO,SAAS,CAA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AI,CAAC,QAAQ,EAAE;AAChC,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;QACpE;AACA,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;IAC1B;AAEA,IAAA,YAAY,CAAC,IAAI,EAAA;AACf,QAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;AAClE,QAAA,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS;IACnC;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@combos-fun/engine"),i=require("@tweenjs/tween.js");class e extends t.System{constructor(){super(...arguments),this.name="transition"}static{this.systemName="transition"}}Object.assign(e,{packageName:"@combos-fun/plugin-transition",packageVersion:"0.0.
|
|
1
|
+
"use strict";var t=require("@combos-fun/engine"),i=require("@tweenjs/tween.js");class e extends t.System{constructor(){super(...arguments),this.name="transition"}static{this.systemName="transition"}}Object.assign(e,{packageName:"@combos-fun/plugin-transition",packageVersion:"0.0.20"});const s={linear:i.Easing.Linear.None,"ease-in":i.Easing.Quadratic.In,"ease-out":i.Easing.Quadratic.Out,"ease-in-out":i.Easing.Quadratic.InOut,"bounce-in":i.Easing.Bounce.In,"bounce-out":i.Easing.Bounce.Out,"bounce-in-out":i.Easing.Bounce.InOut,none:i.Easing.Linear.None};class n{constructor(t,i){this.tweens=[],this.timelines=[],this.finishCount=0,this.callbacks=new Map,this.objectCache={},this.currIteration=0,this.timelines=t,this.tweenGroup=i}on(t,i){this.callbacks.get(t)||this.callbacks.set(t,[]),this.callbacks.get(t).push(i)}emit(t){const i=this.callbacks.get(t);i&&i.length&&i.forEach(t=>t())}checkFinish(){if(++this.finishCount==this.tweens.length)if(++this.currIteration==this.iteration)this.emit("finish");else{if(this.stopped)return;this.start()}}getObjectCache(t,i){const e=`${t.gameObject.id}${t.name}`;if(this.objectCache[e]||(this.objectCache[e]={}),this.objectCache[e][i])return this.objectCache[e][i];const s=i.split("."),n=s.length-1;let a=t;for(let t=0;t<n;t++)a=a[s[t]];return this.objectCache[e][i]={property:a,key:s[n]},this.objectCache[e][i]}doAnim({component:t,name:i,value:e}){const{property:s,key:n}=this.getObjectCache(t,i);s[n]=e}init(){let t;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((e,n)=>{for(let a=0;a<e.values.length-1;a++){const o=e.values[a],h=e.values[a+1],r=new i.Tween({value:o.value}).group(this.tweenGroup).to({value:h.value}).duration(h.time-o.time).easing(s[o.tween??"linear"]??i.Easing.Linear.None).onUpdate(t=>{this.doAnim({component:e.component,name:e.name,value:t.value})});0===a?this.tweens[n]=r:t.chain(r),t=r}t&&t.onComplete(()=>this.checkFinishFunc())})}play(t=1,i){this.currentTime=i,this.stopped=!1,this.start(),this.currIteration=0,this.iteration=t}start(){this.finishCount=0,this.tweens.length=0,this.init(),this.tweens.forEach(t=>t.start(this.currentTime))}pause(){this.tweens.forEach(t=>t.pause(this.currentTime))}resume(){this.tweens.forEach(t=>t.resume(this.currentTime))}stop(){this.stopped=!0,this.tweens.forEach(t=>t.stop())}destroy(){this.stop(),this.tweens=null,this.timelines=null,this.objectCache=null,this.callbacks.clear(),this.callbacks=null}}class a extends t.Component{constructor(){super(...arguments),this.animations={},this.group={},this.currentTime=0,this.needPlay=[]}static{this.componentName="Transition"}init({group:t}={group:{}}){this.group=t,this.tweenGroup=new i.Group}awake(){for(const t in this.group)this.newAnimation(t)}play(t,i){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:i})}stop(t){if(t)this.animations[t]?.stop();else for(const t in this.animations)this.animations[t]?.stop()}onPause(){for(const t in this.animations)this.animations[t]?.pause()}onResume(){for(const t in this.animations)this.animations[t]?.resume()}onDestroy(){for(const t in this.animations)this.animations[t]?.destroy();this.tweenGroup.removeAll(),this.tweenGroup=null,this.group=null,this.animations=null,this.removeAllListeners()}update(t){this.currentTime=t.time;for(const i in this.animations)this.animations[i].currentTime=t.time;this.tweenGroup.update(t.time);for(const t of this.needPlay)this.animations[t.name]?.play(t.iteration,this.currentTime);this.needPlay.length=0}newAnimation(t){const i=new n(this.group[t],this.tweenGroup);i.on("finish",()=>this.emit("finish",t)),this.animations[t]=i}}exports.Transition=a,exports.TransitionSystem=e;
|
|
@@ -12,7 +12,7 @@ class TransitionSystem extends System {
|
|
|
12
12
|
/** Auto-generated by scripts/build-package.mjs — do not edit. */
|
|
13
13
|
Object.assign(TransitionSystem, {
|
|
14
14
|
packageName: "@combos-fun/plugin-transition",
|
|
15
|
-
packageVersion: "0.0.
|
|
15
|
+
packageVersion: "0.0.20",
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
const easingMap = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-transition.esm.js","sources":["../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Animation.ts","../lib/component.ts"],"sourcesContent":["import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport TransitionSystem from './system';\n\nObject.assign(TransitionSystem, {\n packageName: \"@combos-fun/plugin-transition\",\n packageVersion: \"0.0.19\",\n});\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: Record<string, (t: number) => number> = {\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: Easing.Linear.None,\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 currentTime: number;\n\n stopped: 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.get(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.stopped) 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 })\n .group(this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween ?? 'linear'] ?? Easing.Linear.None)\n .onUpdate(obj => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: obj.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, currentTime) {\n this.currentTime = currentTime\n this.stopped = 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(this.currentTime));\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause(this.currentTime));\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume(this.currentTime));\n }\n\n stop() {\n this.stopped = 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 '@combos-fun/engine';\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 private currentTime: number = 0;\n private needPlay: { name: string, iteration?: number }[] = [];\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.needPlay.push({ name, 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 update(e) {\n this.currentTime = e.time\n for (const key in this.animations) {\n this.animations[key].currentTime = e.time\n }\n this.tweenGroup.update(e.time);\n for (const play of this.needPlay) {\n this.animations[play.name]?.play(play.iteration, this.currentTime)\n }\n this.needPlay.length = 0\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"],"names":[],"mappings":";;;AAEc,MAAO,gBAAiB,SAAQ,MAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;ACHnC;AAIA,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;AAC9B,IAAA,WAAW,EAAE,+BAA+B;AAC5C,IAAA,cAAc,EAAE,QAAQ;AACzB,CAAA,CAAC;;ACGF,MAAM,SAAS,GAA0C;AACvD,IAAA,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;AAC1B,IAAA,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;AAC9B,IAAA,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG;AAChC,IAAA,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK;AACrC,IAAA,WAAW,EAAE,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AAI,IAAI,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI;QAC3C;QACA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9B,QAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AAChC,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;QACpE;AACA,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;IAC1B;AAEA,IAAA,YAAY,CAAC,IAAI,EAAA;AACf,QAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;AAClE,QAAA,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS;IACnC;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin-transition.esm.js","sources":["../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Animation.ts","../lib/component.ts"],"sourcesContent":["import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport TransitionSystem from './system';\n\nObject.assign(TransitionSystem, {\n packageName: \"@combos-fun/plugin-transition\",\n packageVersion: \"0.0.20\",\n});\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: Record<string, (t: number) => number> = {\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: Easing.Linear.None,\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 currentTime: number;\n\n stopped: 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.get(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.stopped) 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 })\n .group(this.tweenGroup)\n .to({ value: nextFrame.value })\n .duration(nextFrame.time - frame.time)\n .easing(easingMap[frame.tween ?? 'linear'] ?? Easing.Linear.None)\n .onUpdate(obj => {\n this.doAnim({\n component: timeline.component,\n name: timeline.name,\n value: obj.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, currentTime) {\n this.currentTime = currentTime\n this.stopped = 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(this.currentTime));\n }\n\n pause() {\n this.tweens.forEach((tween: Tween<any>) => tween.pause(this.currentTime));\n }\n\n resume() {\n this.tweens.forEach((tween: Tween<any>) => tween.resume(this.currentTime));\n }\n\n stop() {\n this.stopped = 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 '@combos-fun/engine';\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 private currentTime: number = 0;\n private needPlay: { name: string, iteration?: number }[] = [];\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.needPlay.push({ name, 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 update(e) {\n this.currentTime = e.time\n for (const key in this.animations) {\n this.animations[key].currentTime = e.time\n }\n this.tweenGroup.update(e.time);\n for (const play of this.needPlay) {\n this.animations[play.name]?.play(play.iteration, this.currentTime)\n }\n this.needPlay.length = 0\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"],"names":[],"mappings":";;;AAEc,MAAO,gBAAiB,SAAQ,MAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;ACHnC;AAIA,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;AAC9B,IAAA,WAAW,EAAE,+BAA+B;AAC5C,IAAA,cAAc,EAAE,QAAQ;AACzB,CAAA,CAAC;;ACGF,MAAM,SAAS,GAA0C;AACvD,IAAA,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;AAC1B,IAAA,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;AAC9B,IAAA,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG;AAChC,IAAA,aAAa,EAAE,MAAM,CAAC,SA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C,IAAI;AACzB,QAAA,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,IAAI;QAC3C;QACA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9B,QAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;AAChC,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC;QACpE;AACA,QAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;IAC1B;AAEA,IAAA,YAAY,CAAC,IAAI,EAAA;AACf,QAAA,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC;AAClE,QAAA,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACvD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS;IACnC;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-transition",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "Data-driven tween / property animation",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-transition.esm.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@tweenjs/tween.js": "^25.0.0",
|
|
39
39
|
"sprite-timeline": "^1.10.2",
|
|
40
|
-
"@combos-fun/engine": "0.0.
|
|
40
|
+
"@combos-fun/engine": "0.0.21"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "node ../../scripts/build-package.mjs"
|