@combos-fun/plugin-transition 0.0.1
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/README.md +3 -0
- package/dist/plugin-transition.cjs.js +222 -0
- package/dist/plugin-transition.cjs.js.map +1 -0
- package/dist/plugin-transition.cjs.prod.js +1 -0
- package/dist/plugin-transition.d.ts +41 -0
- package/dist/plugin-transition.esm.js +219 -0
- package/dist/plugin-transition.esm.js.map +1 -0
- package/index.js +7 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tween_js = require('@tweenjs/tween.js');
|
|
4
|
+
var engine = require('@combos-fun/engine');
|
|
5
|
+
|
|
6
|
+
const easingMap = {
|
|
7
|
+
linear: tween_js.Easing.Linear.None,
|
|
8
|
+
'ease-in': tween_js.Easing.Quadratic.In,
|
|
9
|
+
'ease-out': tween_js.Easing.Quadratic.Out,
|
|
10
|
+
'ease-in-out': tween_js.Easing.Quadratic.InOut,
|
|
11
|
+
'bounce-in': tween_js.Easing.Bounce.In,
|
|
12
|
+
'bounce-out': tween_js.Easing.Bounce.Out,
|
|
13
|
+
'bounce-in-out': tween_js.Easing.Bounce.InOut,
|
|
14
|
+
none: tween_js.Easing.Linear.None,
|
|
15
|
+
};
|
|
16
|
+
class Animation {
|
|
17
|
+
constructor(timelines, tweenGroup) {
|
|
18
|
+
this.tweens = [];
|
|
19
|
+
this.timelines = [];
|
|
20
|
+
this.finishCount = 0;
|
|
21
|
+
this.callbacks = new Map();
|
|
22
|
+
this.objectCache = {};
|
|
23
|
+
this.currIteration = 0;
|
|
24
|
+
this.timelines = timelines;
|
|
25
|
+
this.tweenGroup = tweenGroup;
|
|
26
|
+
}
|
|
27
|
+
on(eventName, callback) {
|
|
28
|
+
if (!this.callbacks.get(eventName)) {
|
|
29
|
+
this.callbacks.set(eventName, []);
|
|
30
|
+
}
|
|
31
|
+
this.callbacks.get(eventName).push(callback);
|
|
32
|
+
}
|
|
33
|
+
emit(eventName) {
|
|
34
|
+
const callbacks = this.callbacks.get(eventName);
|
|
35
|
+
if (!callbacks || !callbacks.length)
|
|
36
|
+
return;
|
|
37
|
+
callbacks.forEach(fn => fn());
|
|
38
|
+
}
|
|
39
|
+
checkFinish() {
|
|
40
|
+
if (++this.finishCount == this.tweens.length) {
|
|
41
|
+
if (++this.currIteration == this.iteration) {
|
|
42
|
+
this.emit('finish');
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (this.stoped)
|
|
46
|
+
return;
|
|
47
|
+
this.start();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getObjectCache(component, name) {
|
|
52
|
+
const key = `${component.gameObject.id}${component.name}`;
|
|
53
|
+
if (!this.objectCache[key]) {
|
|
54
|
+
this.objectCache[key] = {};
|
|
55
|
+
}
|
|
56
|
+
if (this.objectCache[key][name]) {
|
|
57
|
+
return this.objectCache[key][name];
|
|
58
|
+
}
|
|
59
|
+
const keys = name.split('.');
|
|
60
|
+
const keyIndex = keys.length - 1;
|
|
61
|
+
let property = component;
|
|
62
|
+
for (let i = 0; i < keyIndex; i++) {
|
|
63
|
+
property = property[keys[i]];
|
|
64
|
+
}
|
|
65
|
+
this.objectCache[key][name] = { property, key: keys[keyIndex] };
|
|
66
|
+
return this.objectCache[key][name];
|
|
67
|
+
}
|
|
68
|
+
doAnim({ component, name, value }) {
|
|
69
|
+
const { property, key } = this.getObjectCache(component, name);
|
|
70
|
+
property[key] = value;
|
|
71
|
+
}
|
|
72
|
+
init() {
|
|
73
|
+
this.checkFinishFunc = this.checkFinish.bind(this);
|
|
74
|
+
let lastTween;
|
|
75
|
+
this.timelines.forEach((timeline, i) => {
|
|
76
|
+
for (let j = 0; j < timeline.values.length - 1; j++) {
|
|
77
|
+
const frame = timeline.values[j];
|
|
78
|
+
const nextFrame = timeline.values[j + 1];
|
|
79
|
+
const tween = new tween_js.Tween({ value: frame.value })
|
|
80
|
+
.group(this.tweenGroup)
|
|
81
|
+
.to({ value: nextFrame.value })
|
|
82
|
+
.duration(nextFrame.time - frame.time)
|
|
83
|
+
.easing(easingMap[frame.tween ?? 'linear'] ?? tween_js.Easing.Linear.None)
|
|
84
|
+
.onUpdate(obj => {
|
|
85
|
+
this.doAnim({
|
|
86
|
+
component: timeline.component,
|
|
87
|
+
name: timeline.name,
|
|
88
|
+
value: obj.value,
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
if (j === 0) {
|
|
92
|
+
this.tweens[i] = tween;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
lastTween.chain(tween);
|
|
96
|
+
}
|
|
97
|
+
lastTween = tween;
|
|
98
|
+
}
|
|
99
|
+
lastTween && lastTween.onComplete(() => this.checkFinishFunc());
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
play(iteration = 1, currentTime) {
|
|
103
|
+
this.currentTime = currentTime;
|
|
104
|
+
this.stoped = false;
|
|
105
|
+
this.start();
|
|
106
|
+
this.currIteration = 0;
|
|
107
|
+
this.iteration = iteration;
|
|
108
|
+
}
|
|
109
|
+
start() {
|
|
110
|
+
this.finishCount = 0;
|
|
111
|
+
this.tweens.length = 0;
|
|
112
|
+
this.init();
|
|
113
|
+
this.tweens.forEach((tween) => tween.start(this.currentTime));
|
|
114
|
+
}
|
|
115
|
+
pause() {
|
|
116
|
+
this.tweens.forEach((tween) => tween.pause(this.currentTime));
|
|
117
|
+
}
|
|
118
|
+
resume() {
|
|
119
|
+
this.tweens.forEach((tween) => tween.resume(this.currentTime));
|
|
120
|
+
}
|
|
121
|
+
stop() {
|
|
122
|
+
this.stoped = true;
|
|
123
|
+
this.tweens.forEach((tween) => tween.stop());
|
|
124
|
+
}
|
|
125
|
+
destroy() {
|
|
126
|
+
this.stop();
|
|
127
|
+
this.tweens = null;
|
|
128
|
+
this.timelines = null;
|
|
129
|
+
this.objectCache = null;
|
|
130
|
+
this.callbacks.clear();
|
|
131
|
+
this.callbacks = null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
class Transition extends engine.Component {
|
|
136
|
+
constructor() {
|
|
137
|
+
super(...arguments);
|
|
138
|
+
this.animations = {};
|
|
139
|
+
this.group = {};
|
|
140
|
+
this.currentTime = 0;
|
|
141
|
+
this.needPlay = [];
|
|
142
|
+
}
|
|
143
|
+
static { this.componentName = 'Transition'; }
|
|
144
|
+
init({ group } = { group: {} }) {
|
|
145
|
+
this.group = group;
|
|
146
|
+
this.tweenGroup = new tween_js.Group();
|
|
147
|
+
}
|
|
148
|
+
awake() {
|
|
149
|
+
for (const name in this.group) {
|
|
150
|
+
this.newAnimation(name);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
play(name, iteration) {
|
|
154
|
+
if (!name) {
|
|
155
|
+
name = Object.keys(this.group)[0];
|
|
156
|
+
}
|
|
157
|
+
if (name && !this.animations[name] && this.group[name]) {
|
|
158
|
+
this.newAnimation(name);
|
|
159
|
+
}
|
|
160
|
+
if (name && this.animations[name]) {
|
|
161
|
+
this.needPlay.push({ name, iteration });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
stop(name) {
|
|
165
|
+
if (!name) {
|
|
166
|
+
for (const key in this.animations) {
|
|
167
|
+
this.animations[key]?.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.animations[name]?.stop();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
onPause() {
|
|
175
|
+
for (const key in this.animations) {
|
|
176
|
+
this.animations[key]?.pause();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
onResume() {
|
|
180
|
+
for (const key in this.animations) {
|
|
181
|
+
this.animations[key]?.resume();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
onDestroy() {
|
|
185
|
+
for (const key in this.animations) {
|
|
186
|
+
this.animations[key]?.destroy();
|
|
187
|
+
}
|
|
188
|
+
this.tweenGroup.removeAll();
|
|
189
|
+
this.tweenGroup = null;
|
|
190
|
+
this.group = null;
|
|
191
|
+
this.animations = null;
|
|
192
|
+
this.removeAllListeners();
|
|
193
|
+
}
|
|
194
|
+
update(e) {
|
|
195
|
+
this.currentTime = e.time;
|
|
196
|
+
for (const key in this.animations) {
|
|
197
|
+
this.animations[key].currentTime = e.time;
|
|
198
|
+
}
|
|
199
|
+
this.tweenGroup.update(e.time);
|
|
200
|
+
for (const play of this.needPlay) {
|
|
201
|
+
this.animations[play.name]?.play(play.iteration, this.currentTime);
|
|
202
|
+
}
|
|
203
|
+
this.needPlay.length = 0;
|
|
204
|
+
}
|
|
205
|
+
newAnimation(name) {
|
|
206
|
+
const animation = new Animation(this.group[name], this.tweenGroup);
|
|
207
|
+
animation.on('finish', () => this.emit('finish', name));
|
|
208
|
+
this.animations[name] = animation;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
class TransitionSystem extends engine.System {
|
|
213
|
+
constructor() {
|
|
214
|
+
super(...arguments);
|
|
215
|
+
this.name = 'transition';
|
|
216
|
+
}
|
|
217
|
+
static { this.systemName = 'transition'; }
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
exports.Transition = Transition;
|
|
221
|
+
exports.TransitionSystem = TransitionSystem;
|
|
222
|
+
//# sourceMappingURL=plugin-transition.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-transition.cjs.js","sources":["../lib/Animation.ts","../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Tween, Easing } from '@tweenjs/tween.js';\nimport type { Group } from '@tweenjs/tween.js';\n\ninterface CacheItem {\n property: Record<string, any>;\n key: string;\n}\n\ntype Cache = Record<string, CacheItem>;\n\nconst easingMap: 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 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.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.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 })\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.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(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.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 '@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","import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n"],"names":["Easing","Tween","Component","Group","System"],"mappings":";;;;;AAUA,MAAM,SAAS,GAA0C;AACvD,IAAA,MAAM,EAAEA,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,UA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AAI,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;;;AC/FY,MAAO,gBAAiB,SAAQC,aAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("@tweenjs/tween.js"),i=require("@combos-fun/engine");const e={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:t.Easing.Linear.None};class s{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.stoped)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 i;this.checkFinishFunc=this.checkFinish.bind(this),this.timelines.forEach((s,n)=>{for(let a=0;a<s.values.length-1;a++){const o=s.values[a],h=s.values[a+1],r=new t.Tween({value:o.value}).group(this.tweenGroup).to({value:h.value}).duration(h.time-o.time).easing(e[o.tween??"linear"]??t.Easing.Linear.None).onUpdate(t=>{this.doAnim({component:s.component,name:s.name,value:t.value})});0===a?this.tweens[n]=r:i.chain(r),i=r}i&&i.onComplete(()=>this.checkFinishFunc())})}play(t=1,i){this.currentTime=i,this.stoped=!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.stoped=!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 n extends i.Component{constructor(){super(...arguments),this.animations={},this.group={},this.currentTime=0,this.needPlay=[]}static{this.componentName="Transition"}init({group:i}={group:{}}){this.group=i,this.tweenGroup=new t.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 s(this.group[t],this.tweenGroup);i.on("finish",()=>this.emit("finish",t)),this.animations[t]=i}}class a extends i.System{constructor(){super(...arguments),this.name="transition"}static{this.systemName="transition"}}exports.Transition=n,exports.TransitionSystem=a;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Component, System } from '@combos-fun/engine';
|
|
2
|
+
import { Group } from '@tweenjs/tween.js';
|
|
3
|
+
|
|
4
|
+
interface AnimationStruct {
|
|
5
|
+
name: string;
|
|
6
|
+
component: Component;
|
|
7
|
+
values: {
|
|
8
|
+
time: number;
|
|
9
|
+
value: number;
|
|
10
|
+
tween?: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
interface TransitionParams {
|
|
14
|
+
group: Record<string, AnimationStruct[]>;
|
|
15
|
+
}
|
|
16
|
+
declare class Transition extends Component<TransitionParams> {
|
|
17
|
+
static componentName: string;
|
|
18
|
+
private animations;
|
|
19
|
+
tweenGroup: Group;
|
|
20
|
+
group: Record<string, AnimationStruct[]>;
|
|
21
|
+
private currentTime;
|
|
22
|
+
private needPlay;
|
|
23
|
+
init({ group }?: {
|
|
24
|
+
group: {};
|
|
25
|
+
}): void;
|
|
26
|
+
awake(): void;
|
|
27
|
+
play(name: string, iteration?: number): void;
|
|
28
|
+
stop(name: any): void;
|
|
29
|
+
onPause(): void;
|
|
30
|
+
onResume(): void;
|
|
31
|
+
onDestroy(): void;
|
|
32
|
+
update(e: any): void;
|
|
33
|
+
newAnimation(name: any): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare class TransitionSystem extends System {
|
|
37
|
+
static systemName: string;
|
|
38
|
+
readonly name = "transition";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { Transition, TransitionSystem };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Easing, Tween, Group } from '@tweenjs/tween.js';
|
|
2
|
+
import { Component, System } from '@combos-fun/engine';
|
|
3
|
+
|
|
4
|
+
const 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: Easing.Linear.None,
|
|
13
|
+
};
|
|
14
|
+
class Animation {
|
|
15
|
+
constructor(timelines, tweenGroup) {
|
|
16
|
+
this.tweens = [];
|
|
17
|
+
this.timelines = [];
|
|
18
|
+
this.finishCount = 0;
|
|
19
|
+
this.callbacks = new Map();
|
|
20
|
+
this.objectCache = {};
|
|
21
|
+
this.currIteration = 0;
|
|
22
|
+
this.timelines = timelines;
|
|
23
|
+
this.tweenGroup = tweenGroup;
|
|
24
|
+
}
|
|
25
|
+
on(eventName, callback) {
|
|
26
|
+
if (!this.callbacks.get(eventName)) {
|
|
27
|
+
this.callbacks.set(eventName, []);
|
|
28
|
+
}
|
|
29
|
+
this.callbacks.get(eventName).push(callback);
|
|
30
|
+
}
|
|
31
|
+
emit(eventName) {
|
|
32
|
+
const callbacks = this.callbacks.get(eventName);
|
|
33
|
+
if (!callbacks || !callbacks.length)
|
|
34
|
+
return;
|
|
35
|
+
callbacks.forEach(fn => fn());
|
|
36
|
+
}
|
|
37
|
+
checkFinish() {
|
|
38
|
+
if (++this.finishCount == this.tweens.length) {
|
|
39
|
+
if (++this.currIteration == this.iteration) {
|
|
40
|
+
this.emit('finish');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (this.stoped)
|
|
44
|
+
return;
|
|
45
|
+
this.start();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
getObjectCache(component, name) {
|
|
50
|
+
const key = `${component.gameObject.id}${component.name}`;
|
|
51
|
+
if (!this.objectCache[key]) {
|
|
52
|
+
this.objectCache[key] = {};
|
|
53
|
+
}
|
|
54
|
+
if (this.objectCache[key][name]) {
|
|
55
|
+
return this.objectCache[key][name];
|
|
56
|
+
}
|
|
57
|
+
const keys = name.split('.');
|
|
58
|
+
const keyIndex = keys.length - 1;
|
|
59
|
+
let property = component;
|
|
60
|
+
for (let i = 0; i < keyIndex; i++) {
|
|
61
|
+
property = property[keys[i]];
|
|
62
|
+
}
|
|
63
|
+
this.objectCache[key][name] = { property, key: keys[keyIndex] };
|
|
64
|
+
return this.objectCache[key][name];
|
|
65
|
+
}
|
|
66
|
+
doAnim({ component, name, value }) {
|
|
67
|
+
const { property, key } = this.getObjectCache(component, name);
|
|
68
|
+
property[key] = value;
|
|
69
|
+
}
|
|
70
|
+
init() {
|
|
71
|
+
this.checkFinishFunc = this.checkFinish.bind(this);
|
|
72
|
+
let lastTween;
|
|
73
|
+
this.timelines.forEach((timeline, i) => {
|
|
74
|
+
for (let j = 0; j < timeline.values.length - 1; j++) {
|
|
75
|
+
const frame = timeline.values[j];
|
|
76
|
+
const nextFrame = timeline.values[j + 1];
|
|
77
|
+
const tween = new Tween({ value: frame.value })
|
|
78
|
+
.group(this.tweenGroup)
|
|
79
|
+
.to({ value: nextFrame.value })
|
|
80
|
+
.duration(nextFrame.time - frame.time)
|
|
81
|
+
.easing(easingMap[frame.tween ?? 'linear'] ?? Easing.Linear.None)
|
|
82
|
+
.onUpdate(obj => {
|
|
83
|
+
this.doAnim({
|
|
84
|
+
component: timeline.component,
|
|
85
|
+
name: timeline.name,
|
|
86
|
+
value: obj.value,
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
if (j === 0) {
|
|
90
|
+
this.tweens[i] = tween;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
lastTween.chain(tween);
|
|
94
|
+
}
|
|
95
|
+
lastTween = tween;
|
|
96
|
+
}
|
|
97
|
+
lastTween && lastTween.onComplete(() => this.checkFinishFunc());
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
play(iteration = 1, currentTime) {
|
|
101
|
+
this.currentTime = currentTime;
|
|
102
|
+
this.stoped = false;
|
|
103
|
+
this.start();
|
|
104
|
+
this.currIteration = 0;
|
|
105
|
+
this.iteration = iteration;
|
|
106
|
+
}
|
|
107
|
+
start() {
|
|
108
|
+
this.finishCount = 0;
|
|
109
|
+
this.tweens.length = 0;
|
|
110
|
+
this.init();
|
|
111
|
+
this.tweens.forEach((tween) => tween.start(this.currentTime));
|
|
112
|
+
}
|
|
113
|
+
pause() {
|
|
114
|
+
this.tweens.forEach((tween) => tween.pause(this.currentTime));
|
|
115
|
+
}
|
|
116
|
+
resume() {
|
|
117
|
+
this.tweens.forEach((tween) => tween.resume(this.currentTime));
|
|
118
|
+
}
|
|
119
|
+
stop() {
|
|
120
|
+
this.stoped = true;
|
|
121
|
+
this.tweens.forEach((tween) => tween.stop());
|
|
122
|
+
}
|
|
123
|
+
destroy() {
|
|
124
|
+
this.stop();
|
|
125
|
+
this.tweens = null;
|
|
126
|
+
this.timelines = null;
|
|
127
|
+
this.objectCache = null;
|
|
128
|
+
this.callbacks.clear();
|
|
129
|
+
this.callbacks = null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
class Transition extends Component {
|
|
134
|
+
constructor() {
|
|
135
|
+
super(...arguments);
|
|
136
|
+
this.animations = {};
|
|
137
|
+
this.group = {};
|
|
138
|
+
this.currentTime = 0;
|
|
139
|
+
this.needPlay = [];
|
|
140
|
+
}
|
|
141
|
+
static { this.componentName = 'Transition'; }
|
|
142
|
+
init({ group } = { group: {} }) {
|
|
143
|
+
this.group = group;
|
|
144
|
+
this.tweenGroup = new Group();
|
|
145
|
+
}
|
|
146
|
+
awake() {
|
|
147
|
+
for (const name in this.group) {
|
|
148
|
+
this.newAnimation(name);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
play(name, iteration) {
|
|
152
|
+
if (!name) {
|
|
153
|
+
name = Object.keys(this.group)[0];
|
|
154
|
+
}
|
|
155
|
+
if (name && !this.animations[name] && this.group[name]) {
|
|
156
|
+
this.newAnimation(name);
|
|
157
|
+
}
|
|
158
|
+
if (name && this.animations[name]) {
|
|
159
|
+
this.needPlay.push({ name, iteration });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
stop(name) {
|
|
163
|
+
if (!name) {
|
|
164
|
+
for (const key in this.animations) {
|
|
165
|
+
this.animations[key]?.stop();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.animations[name]?.stop();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
onPause() {
|
|
173
|
+
for (const key in this.animations) {
|
|
174
|
+
this.animations[key]?.pause();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
onResume() {
|
|
178
|
+
for (const key in this.animations) {
|
|
179
|
+
this.animations[key]?.resume();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
onDestroy() {
|
|
183
|
+
for (const key in this.animations) {
|
|
184
|
+
this.animations[key]?.destroy();
|
|
185
|
+
}
|
|
186
|
+
this.tweenGroup.removeAll();
|
|
187
|
+
this.tweenGroup = null;
|
|
188
|
+
this.group = null;
|
|
189
|
+
this.animations = null;
|
|
190
|
+
this.removeAllListeners();
|
|
191
|
+
}
|
|
192
|
+
update(e) {
|
|
193
|
+
this.currentTime = e.time;
|
|
194
|
+
for (const key in this.animations) {
|
|
195
|
+
this.animations[key].currentTime = e.time;
|
|
196
|
+
}
|
|
197
|
+
this.tweenGroup.update(e.time);
|
|
198
|
+
for (const play of this.needPlay) {
|
|
199
|
+
this.animations[play.name]?.play(play.iteration, this.currentTime);
|
|
200
|
+
}
|
|
201
|
+
this.needPlay.length = 0;
|
|
202
|
+
}
|
|
203
|
+
newAnimation(name) {
|
|
204
|
+
const animation = new Animation(this.group[name], this.tweenGroup);
|
|
205
|
+
animation.on('finish', () => this.emit('finish', name));
|
|
206
|
+
this.animations[name] = animation;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
class TransitionSystem extends System {
|
|
211
|
+
constructor() {
|
|
212
|
+
super(...arguments);
|
|
213
|
+
this.name = 'transition';
|
|
214
|
+
}
|
|
215
|
+
static { this.systemName = 'transition'; }
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { Transition, TransitionSystem };
|
|
219
|
+
//# sourceMappingURL=plugin-transition.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-transition.esm.js","sources":["../lib/Animation.ts","../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Tween, Easing } from '@tweenjs/tween.js';\nimport type { Group } from '@tweenjs/tween.js';\n\ninterface CacheItem {\n property: Record<string, any>;\n key: string;\n}\n\ntype Cache = Record<string, CacheItem>;\n\nconst easingMap: 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 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.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.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 })\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.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(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.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 '@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","import { System } from '@combos-fun/engine';\n\nexport default class TransitionSystem extends System {\n static systemName = 'transition';\n readonly name = 'transition';\n}\n"],"names":[],"mappings":";;;AAUA,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,MAAM,CAAC,MAAM,CAAC,EAAE;AAC7B,IAAA,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG;AAC/B,IAAA,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;AACpC,IAAA,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;CACzB;AAEa,MAAO,SAAS,CAAA;IAc5B,WAAA,CAAY,SAAS,EAAE,UAAiB,EAAA;QAbhC,IAAA,CAAA,MAAM,GAAG,EAAE;QACX,IAAA,CAAA,SAAS,GAAG,EAAE;QACd,IAAA,CAAA,WAAW,GAAG,CAAC;AACf,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,GAAG,EAAE;QAK7B,IAAA,CAAA,WAAW,GAA0B,EAAE;QACvC,IAAA,CAAA,aAAa,GAAW,CAAC;AAKvB,QAAA,IAAI,CAAC,SAAS,GAAG,SAAS;AAC1B,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU;IAC9B;IAEA,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAA;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC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,CAAC,CAAC;AACvD,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,SAAS;IACnC;;;AC/FY,MAAO,gBAAiB,SAAQ,MAAM,CAAA;AAApD,IAAA,WAAA,GAAA;;QAEW,IAAA,CAAA,IAAI,GAAG,YAAY;IAC9B;aAFS,IAAA,CAAA,UAAU,GAAG,YAAH,CAAgB;;;;;"}
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@combos-fun/plugin-transition",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "@combos-fun/plugin-transition",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"module": "dist/plugin-transition.esm.js",
|
|
7
|
+
"bundle": "CombosFun.plugin.transition",
|
|
8
|
+
"unpkg": "dist/CombosFun.plugin.transition.min.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"types": "dist/plugin-transition.d.ts",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"combos-fun",
|
|
16
|
+
"game"
|
|
17
|
+
],
|
|
18
|
+
"author": "sun668 <q947692259@gmail.com>",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@tweenjs/tween.js": "^25.0.0",
|
|
21
|
+
"sprite-timeline": "^1.10.2",
|
|
22
|
+
"@combos-fun/engine": "0.0.1"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "node ../../scripts/build-package.mjs"
|
|
26
|
+
}
|
|
27
|
+
}
|