@eva/plugin-renderer-lottie 2.0.1-beta.3 → 2.0.1-beta.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.renderer.lottie.js +29 -60
- package/dist/EVA.plugin.renderer.lottie.min.js +1 -1
- package/dist/plugin-renderer-lottie.cjs.js +29 -56
- package/dist/plugin-renderer-lottie.cjs.prod.js +1 -1
- package/dist/plugin-renderer-lottie.d.ts +1 -0
- package/dist/plugin-renderer-lottie.esm.js +34 -61
- package/package.json +3 -3
|
@@ -10565,8 +10565,6 @@ function createSizedArray(len) {
|
|
|
10565
10565
|
return Array.apply(null, { length: len });
|
|
10566
10566
|
}
|
|
10567
10567
|
|
|
10568
|
-
window.$commands = [];
|
|
10569
|
-
|
|
10570
10568
|
class MatrixHelper extends pixi_js.Matrix {
|
|
10571
10569
|
reset() {
|
|
10572
10570
|
// 重置为单位矩阵
|
|
@@ -11097,18 +11095,17 @@ class SpriteElement extends pixi_js.Sprite {
|
|
|
11097
11095
|
* @param {object} config layer data information
|
|
11098
11096
|
*/
|
|
11099
11097
|
constructor(lottieLayer, imageInfo) {
|
|
11100
|
-
const {
|
|
11101
|
-
super(
|
|
11098
|
+
const { texture: texturePromise } = imageInfo;
|
|
11099
|
+
super();
|
|
11102
11100
|
this.label = lottieLayer.fullname;
|
|
11103
11101
|
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11102
|
+
texturePromise
|
|
11103
|
+
.then(texture => {
|
|
11104
|
+
this.texture = texture;
|
|
11105
|
+
})
|
|
11106
|
+
.catch(e => {
|
|
11107
|
+
console.error(e);
|
|
11110
11108
|
});
|
|
11111
|
-
}
|
|
11112
11109
|
|
|
11113
11110
|
this.lottieLayer = lottieLayer;
|
|
11114
11111
|
|
|
@@ -11181,32 +11178,6 @@ class SpriteElement extends pixi_js.Sprite {
|
|
|
11181
11178
|
}
|
|
11182
11179
|
}
|
|
11183
11180
|
|
|
11184
|
-
class BaseTexture extends pixi_js.EventEmitter {
|
|
11185
|
-
constructor(url) {
|
|
11186
|
-
super();
|
|
11187
|
-
this.texture = pixi_js.Texture.EMPTY;
|
|
11188
|
-
this.img = new Image();
|
|
11189
|
-
this.img.src = url;
|
|
11190
|
-
this.img.onload = () => {
|
|
11191
|
-
this.texture = pixi_js.Texture.from(this.img);
|
|
11192
|
-
this.emit('loaded');
|
|
11193
|
-
};
|
|
11194
|
-
this.img.onerror = () => {
|
|
11195
|
-
this.emit('error');
|
|
11196
|
-
};
|
|
11197
|
-
}
|
|
11198
|
-
}
|
|
11199
|
-
|
|
11200
|
-
class Texture {
|
|
11201
|
-
constructor(url) {
|
|
11202
|
-
this.baseTexture = new BaseTexture(url);
|
|
11203
|
-
}
|
|
11204
|
-
|
|
11205
|
-
static from(url) {
|
|
11206
|
-
return new Texture(url);
|
|
11207
|
-
}
|
|
11208
|
-
}
|
|
11209
|
-
|
|
11210
11181
|
const regHttp = /^(https?:)?\/\//;
|
|
11211
11182
|
|
|
11212
11183
|
/**
|
|
@@ -11262,25 +11233,20 @@ class LoadTexture extends Eventer {
|
|
|
11262
11233
|
this.assets.forEach(asset => {
|
|
11263
11234
|
const id = asset.id;
|
|
11264
11235
|
const url = createUrl(asset, this.prefix);
|
|
11265
|
-
const
|
|
11266
|
-
this.textures[id] =
|
|
11236
|
+
const texturePromise = pixi_js.Assets.load(url);
|
|
11237
|
+
this.textures[id] = texturePromise;
|
|
11267
11238
|
this._total++;
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
this.emit('update');
|
|
11271
|
-
if (this._received + this._failed >= this._total) this._onComplete();
|
|
11272
|
-
} else {
|
|
11273
|
-
texture.baseTexture.once('loaded', () => {
|
|
11239
|
+
texturePromise
|
|
11240
|
+
.then(() => {
|
|
11274
11241
|
this._received++;
|
|
11275
11242
|
this.emit('update');
|
|
11276
11243
|
if (this._received + this._failed >= this._total) this._onComplete();
|
|
11277
|
-
})
|
|
11278
|
-
|
|
11244
|
+
})
|
|
11245
|
+
.catch(e => {
|
|
11279
11246
|
this._failed++;
|
|
11280
11247
|
this.emit('update');
|
|
11281
11248
|
if (this._received + this._failed >= this._total) this._onComplete();
|
|
11282
11249
|
});
|
|
11283
|
-
}
|
|
11284
11250
|
});
|
|
11285
11251
|
}
|
|
11286
11252
|
|
|
@@ -11828,7 +11794,8 @@ class AnimationGroup extends Eventer {
|
|
|
11828
11794
|
},
|
|
11829
11795
|
};
|
|
11830
11796
|
session.fontManager.addChars(data.chars);
|
|
11831
|
-
|
|
11797
|
+
// @TODO
|
|
11798
|
+
// session.fontManager.addFonts(data.fonts, document.body);
|
|
11832
11799
|
|
|
11833
11800
|
this._buildElements(session);
|
|
11834
11801
|
|
|
@@ -12884,7 +12851,7 @@ class AnimationManager extends Eventer {
|
|
|
12884
12851
|
}
|
|
12885
12852
|
}
|
|
12886
12853
|
|
|
12887
|
-
const { major } = iOSVersion__default(
|
|
12854
|
+
const { major } = iOSVersion__default(globalThis.navigator.userAgent) || {};
|
|
12888
12855
|
|
|
12889
12856
|
/**
|
|
12890
12857
|
* dataURL 转成 blob
|
|
@@ -12970,14 +12937,16 @@ let LottieSystem = class LottieSystem extends pluginRenderer.Renderer {
|
|
|
12970
12937
|
if (!container)
|
|
12971
12938
|
return;
|
|
12972
12939
|
const _a = component.options, { resource: rn } = _a, otherOpts = __rest(_a, ["resource"]);
|
|
12973
|
-
const
|
|
12940
|
+
const res = yield eva_js.resource.getResource(rn);
|
|
12941
|
+
const data = res.data;
|
|
12942
|
+
const url = res.src.json.url;
|
|
12974
12943
|
const json = Object.assign({}, (data.json || {}));
|
|
12975
12944
|
const assets = json.assets || [];
|
|
12976
12945
|
assets.forEach(item => {
|
|
12977
12946
|
if (item.p)
|
|
12978
12947
|
item.p = imageHandle(item.p);
|
|
12979
12948
|
});
|
|
12980
|
-
const anim = this.manager.parseAnimation(Object.assign({ keyframes: json }, otherOpts));
|
|
12949
|
+
const anim = this.manager.parseAnimation(Object.assign({ keyframes: json, prefix: this.getDir(url) }, otherOpts));
|
|
12981
12950
|
component.anim = anim;
|
|
12982
12951
|
container.addChildAt(anim.group, 0);
|
|
12983
12952
|
this.managerLife.forEach(eventName => {
|
|
@@ -12987,6 +12956,9 @@ let LottieSystem = class LottieSystem extends pluginRenderer.Renderer {
|
|
|
12987
12956
|
component.emit('success', {});
|
|
12988
12957
|
});
|
|
12989
12958
|
}
|
|
12959
|
+
getDir(url) {
|
|
12960
|
+
return new URL('./', url).href;
|
|
12961
|
+
}
|
|
12990
12962
|
remove(changed) {
|
|
12991
12963
|
const component = changed.component;
|
|
12992
12964
|
const container = this.renderSystem.containerManager.getContainer(changed.gameObject.id);
|
|
@@ -13039,7 +13011,10 @@ class Lottie extends eva_js.Component {
|
|
|
13039
13011
|
this.currentSlot[name] = pixi_js.Sprite.from(value);
|
|
13040
13012
|
}
|
|
13041
13013
|
else if (type === 'TEXT') {
|
|
13042
|
-
this.currentSlot[name] = new pixi_js.Text(
|
|
13014
|
+
this.currentSlot[name] = new pixi_js.Text({
|
|
13015
|
+
text: value,
|
|
13016
|
+
style: new pixi_js.TextStyle(style),
|
|
13017
|
+
});
|
|
13043
13018
|
}
|
|
13044
13019
|
if (x)
|
|
13045
13020
|
this.currentSlot[name].x = x;
|
|
@@ -13074,9 +13049,7 @@ class Lottie extends eva_js.Component {
|
|
|
13074
13049
|
this.on('success', () => {
|
|
13075
13050
|
const ele = this.anim.querySelector(name);
|
|
13076
13051
|
const display = ele.display;
|
|
13077
|
-
g.
|
|
13078
|
-
g.drawRect(0, 0, 100, 100);
|
|
13079
|
-
g.endFill();
|
|
13052
|
+
g.rect(0, 0, 100, 100).fill(0xffffff);
|
|
13080
13053
|
g.alpha = 0;
|
|
13081
13054
|
display.addChild(g);
|
|
13082
13055
|
ele.display.interactive = true;
|