@eva/plugin-renderer-lottie 2.0.1-beta.27 → 2.0.1-beta.29

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.
@@ -13121,6 +13121,12 @@ let LottieSystem = class LottieSystem extends pluginRenderer.Renderer {
13121
13121
  'update',
13122
13122
  ];
13123
13123
  }
13124
+ /**
13125
+ * System 初始化用,可以配置参数,游戏未开始
13126
+ *
13127
+ * System init, set params, game is not begain
13128
+ * @param param init params
13129
+ */
13124
13130
  init() {
13125
13131
  this.renderSystem = this.game.getSystem('Renderer');
13126
13132
  this.app = this.renderSystem.application;
@@ -13191,13 +13197,78 @@ LottieSystem = __decorate([
13191
13197
  ], LottieSystem);
13192
13198
  var LottieSystem$1 = LottieSystem;
13193
13199
 
13200
+ /**
13201
+ * Lottie 动画组件
13202
+ *
13203
+ * Lottie 组件用于播放 Adobe After Effects 导出的 Lottie 动画文件。
13204
+ * Lottie 是一种基于 JSON 的动画格式,可以实现复杂的矢量动画效果,
13205
+ * 文件体积小、性能高,适用于图标动画、loading 动画、复杂 UI 动效等场景。
13206
+ *
13207
+ * 主要功能:
13208
+ * - 播放 Lottie JSON 动画
13209
+ * - 支持动画片段播放和循环
13210
+ * - 支持插槽(slot)动态替换内容
13211
+ * - 支持帧事件监听
13212
+ * - 支持交互热区绑定
13213
+ * - 支持动态替换动画数据
13214
+ *
13215
+ * @example
13216
+ * ```typescript
13217
+ * // 基础用法
13218
+ * const animation = new GameObject('animation');
13219
+ * animation.addComponent(new Lottie({
13220
+ * resource: 'loadingAnimation', // Lottie JSON 资源
13221
+ * autoStart: true
13222
+ * }));
13223
+ *
13224
+ * // 播放指定片段
13225
+ * const lottie = animation.getComponent('Lottie');
13226
+ * lottie.play([0, 60], { repeats: -1 }); // 播放 0-60 帧,无限循环
13227
+ *
13228
+ * // 动态替换插槽内容
13229
+ * lottie.play([0, 120], {
13230
+ * slot: [{
13231
+ * name: 'avatar',
13232
+ * type: 'IMAGE',
13233
+ * value: 'user-avatar.png',
13234
+ * style: { width: 100, height: 100 }
13235
+ * }, {
13236
+ * name: 'username',
13237
+ * type: 'TEXT',
13238
+ * value: '玩家名称',
13239
+ * style: { fontSize: 24 }
13240
+ * }]
13241
+ * });
13242
+ *
13243
+ * // 监听特定帧事件
13244
+ * lottie.on('@30', () => {
13245
+ * console.log('到达第 30 帧');
13246
+ * });
13247
+ *
13248
+ * // 绑定点击热区
13249
+ * lottie.onTap('buttonLayer', () => {
13250
+ * console.log('按钮被点击');
13251
+ * });
13252
+ * ```
13253
+ */
13194
13254
  class Lottie extends eva_js.Component {
13255
+ /**
13256
+ * 构造 Lottie 组件
13257
+ * @param options - Lottie 配置选项
13258
+ * @param options.resource - Lottie JSON 资源名称
13259
+ * @param options.autoStart - 是否自动开始播放
13260
+ */
13195
13261
  constructor(options) {
13196
13262
  super();
13263
+ /** 待替换的数据 */
13197
13264
  this._replaceData = null;
13265
+ /** 资源加载状态 */
13198
13266
  this.loadStatus = false;
13267
+ /** 首次播放回调 */
13199
13268
  this.firstPlay = null;
13269
+ /** 前一次的插槽内容 */
13200
13270
  this.prevSlot = {};
13271
+ /** 当前的插槽内容 */
13201
13272
  this.currentSlot = {};
13202
13273
  this.options = Object.assign({ autoStart: false }, options);
13203
13274
  this.on('success', () => {
@@ -13282,6 +13353,7 @@ class Lottie extends eva_js.Component {
13282
13353
  });
13283
13354
  }
13284
13355
  }
13356
+ /** 组件名称 */
13285
13357
  Lottie.componentName = 'Lottie';
13286
13358
 
13287
13359
  eva_js.resource.registerResourceType('LOTTIE');
@@ -32,22 +32,91 @@ declare interface IOptions {
32
32
  replaceData?: boolean;
33
33
  }
34
34
 
35
+ /**
36
+ * Lottie 动画组件
37
+ *
38
+ * Lottie 组件用于播放 Adobe After Effects 导出的 Lottie 动画文件。
39
+ * Lottie 是一种基于 JSON 的动画格式,可以实现复杂的矢量动画效果,
40
+ * 文件体积小、性能高,适用于图标动画、loading 动画、复杂 UI 动效等场景。
41
+ *
42
+ * 主要功能:
43
+ * - 播放 Lottie JSON 动画
44
+ * - 支持动画片段播放和循环
45
+ * - 支持插槽(slot)动态替换内容
46
+ * - 支持帧事件监听
47
+ * - 支持交互热区绑定
48
+ * - 支持动态替换动画数据
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // 基础用法
53
+ * const animation = new GameObject('animation');
54
+ * animation.addComponent(new Lottie({
55
+ * resource: 'loadingAnimation', // Lottie JSON 资源
56
+ * autoStart: true
57
+ * }));
58
+ *
59
+ * // 播放指定片段
60
+ * const lottie = animation.getComponent('Lottie');
61
+ * lottie.play([0, 60], { repeats: -1 }); // 播放 0-60 帧,无限循环
62
+ *
63
+ * // 动态替换插槽内容
64
+ * lottie.play([0, 120], {
65
+ * slot: [{
66
+ * name: 'avatar',
67
+ * type: 'IMAGE',
68
+ * value: 'user-avatar.png',
69
+ * style: { width: 100, height: 100 }
70
+ * }, {
71
+ * name: 'username',
72
+ * type: 'TEXT',
73
+ * value: '玩家名称',
74
+ * style: { fontSize: 24 }
75
+ * }]
76
+ * });
77
+ *
78
+ * // 监听特定帧事件
79
+ * lottie.on('@30', () => {
80
+ * console.log('到达第 30 帧');
81
+ * });
82
+ *
83
+ * // 绑定点击热区
84
+ * lottie.onTap('buttonLayer', () => {
85
+ * console.log('按钮被点击');
86
+ * });
87
+ * ```
88
+ */
35
89
  export declare class Lottie extends Component {
90
+ /** 插槽配置 */
36
91
  slot: {
37
92
  [key: string]: string;
38
93
  };
94
+ /** 待替换的数据 */
39
95
  _replaceData: Record<string, string> | null;
96
+ /** 组件名称 */
40
97
  static componentName: string;
98
+ /** Lottie 动画实例 */
41
99
  anim: any;
100
+ /** Lottie 配置选项 */
42
101
  options: ExtendOptions;
102
+ /** 资源加载状态 */
43
103
  loadStatus: boolean;
104
+ /** 首次播放回调 */
44
105
  firstPlay: () => void | null;
106
+ /** 前一次的插槽内容 */
45
107
  prevSlot: {
46
108
  [name: string]: any;
47
109
  };
110
+ /** 当前的插槽内容 */
48
111
  currentSlot: {
49
112
  [name: string]: any;
50
113
  };
114
+ /**
115
+ * 构造 Lottie 组件
116
+ * @param options - Lottie 配置选项
117
+ * @param options.resource - Lottie JSON 资源名称
118
+ * @param options.autoStart - 是否自动开始播放
119
+ */
51
120
  constructor(options: IOptions);
52
121
  play(params?: number[], expandOpts?: IExpandOpts): void;
53
122
  replaceData(data: Record<string, string>): void;
@@ -63,6 +132,12 @@ export declare class LottieSystem extends Renderer {
63
132
  rendererManager: RendererManager;
64
133
  containerManager: ContainerManager;
65
134
  managerLife: string[];
135
+ /**
136
+ * System 初始化用,可以配置参数,游戏未开始
137
+ *
138
+ * System init, set params, game is not begain
139
+ * @param param init params
140
+ */
66
141
  init(): void;
67
142
  componentChanged(changed: ComponentChanged): Promise<void>;
68
143
  add(changed: ComponentChanged): Promise<void>;
@@ -13113,6 +13113,12 @@ let LottieSystem = class LottieSystem extends Renderer {
13113
13113
  'update',
13114
13114
  ];
13115
13115
  }
13116
+ /**
13117
+ * System 初始化用,可以配置参数,游戏未开始
13118
+ *
13119
+ * System init, set params, game is not begain
13120
+ * @param param init params
13121
+ */
13116
13122
  init() {
13117
13123
  this.renderSystem = this.game.getSystem('Renderer');
13118
13124
  this.app = this.renderSystem.application;
@@ -13183,13 +13189,78 @@ LottieSystem = __decorate([
13183
13189
  ], LottieSystem);
13184
13190
  var LottieSystem$1 = LottieSystem;
13185
13191
 
13192
+ /**
13193
+ * Lottie 动画组件
13194
+ *
13195
+ * Lottie 组件用于播放 Adobe After Effects 导出的 Lottie 动画文件。
13196
+ * Lottie 是一种基于 JSON 的动画格式,可以实现复杂的矢量动画效果,
13197
+ * 文件体积小、性能高,适用于图标动画、loading 动画、复杂 UI 动效等场景。
13198
+ *
13199
+ * 主要功能:
13200
+ * - 播放 Lottie JSON 动画
13201
+ * - 支持动画片段播放和循环
13202
+ * - 支持插槽(slot)动态替换内容
13203
+ * - 支持帧事件监听
13204
+ * - 支持交互热区绑定
13205
+ * - 支持动态替换动画数据
13206
+ *
13207
+ * @example
13208
+ * ```typescript
13209
+ * // 基础用法
13210
+ * const animation = new GameObject('animation');
13211
+ * animation.addComponent(new Lottie({
13212
+ * resource: 'loadingAnimation', // Lottie JSON 资源
13213
+ * autoStart: true
13214
+ * }));
13215
+ *
13216
+ * // 播放指定片段
13217
+ * const lottie = animation.getComponent('Lottie');
13218
+ * lottie.play([0, 60], { repeats: -1 }); // 播放 0-60 帧,无限循环
13219
+ *
13220
+ * // 动态替换插槽内容
13221
+ * lottie.play([0, 120], {
13222
+ * slot: [{
13223
+ * name: 'avatar',
13224
+ * type: 'IMAGE',
13225
+ * value: 'user-avatar.png',
13226
+ * style: { width: 100, height: 100 }
13227
+ * }, {
13228
+ * name: 'username',
13229
+ * type: 'TEXT',
13230
+ * value: '玩家名称',
13231
+ * style: { fontSize: 24 }
13232
+ * }]
13233
+ * });
13234
+ *
13235
+ * // 监听特定帧事件
13236
+ * lottie.on('@30', () => {
13237
+ * console.log('到达第 30 帧');
13238
+ * });
13239
+ *
13240
+ * // 绑定点击热区
13241
+ * lottie.onTap('buttonLayer', () => {
13242
+ * console.log('按钮被点击');
13243
+ * });
13244
+ * ```
13245
+ */
13186
13246
  class Lottie extends Component {
13247
+ /**
13248
+ * 构造 Lottie 组件
13249
+ * @param options - Lottie 配置选项
13250
+ * @param options.resource - Lottie JSON 资源名称
13251
+ * @param options.autoStart - 是否自动开始播放
13252
+ */
13187
13253
  constructor(options) {
13188
13254
  super();
13255
+ /** 待替换的数据 */
13189
13256
  this._replaceData = null;
13257
+ /** 资源加载状态 */
13190
13258
  this.loadStatus = false;
13259
+ /** 首次播放回调 */
13191
13260
  this.firstPlay = null;
13261
+ /** 前一次的插槽内容 */
13192
13262
  this.prevSlot = {};
13263
+ /** 当前的插槽内容 */
13193
13264
  this.currentSlot = {};
13194
13265
  this.options = Object.assign({ autoStart: false }, options);
13195
13266
  this.on('success', () => {
@@ -13274,6 +13345,7 @@ class Lottie extends Component {
13274
13345
  });
13275
13346
  }
13276
13347
  }
13348
+ /** 组件名称 */
13277
13349
  Lottie.componentName = 'Lottie';
13278
13350
 
13279
13351
  resource.registerResourceType('LOTTIE');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-lottie",
3
- "version": "2.0.1-beta.27",
3
+ "version": "2.0.1-beta.29",
4
4
  "description": "@eva/plugin-renderer-lottie",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-lottie.esm.js",
@@ -18,8 +18,8 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "2.0.1-beta.27",
22
- "@eva/plugin-renderer": "2.0.1-beta.27",
21
+ "@eva/eva.js": "2.0.1-beta.29",
22
+ "@eva/plugin-renderer": "2.0.1-beta.29",
23
23
  "ios-version": "^1.0.1",
24
24
  "pixi.js": "^8.8.1"
25
25
  }