@drincs/pixi-vn 1.2.25 → 1.3.0

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.
Files changed (35) hide show
  1. package/dist/{ContainerMemory-Bemxh6ml.d.cts → ContainerMemory-CrY9QSo2.d.cts} +16 -13
  2. package/dist/{ContainerMemory-BSDt46hh.d.ts → ContainerMemory-DrijxCcD.d.ts} +16 -13
  3. package/dist/{TickersSequence-_GvVF_1g.d.cts → TickersSequence-Cf1Vcu22.d.cts} +55 -12
  4. package/dist/{TickersSequence-_GvVF_1g.d.ts → TickersSequence-Cf1Vcu22.d.ts} +55 -12
  5. package/dist/canvas/index.cjs +144 -142
  6. package/dist/canvas/index.d.cts +5 -4
  7. package/dist/canvas/index.d.ts +5 -4
  8. package/dist/canvas/index.mjs +144 -142
  9. package/dist/canvas/tickers/index.cjs +145 -143
  10. package/dist/canvas/tickers/index.d.cts +141 -118
  11. package/dist/canvas/tickers/index.d.ts +141 -118
  12. package/dist/canvas/tickers/index.mjs +145 -143
  13. package/dist/character/index.cjs +41 -40
  14. package/dist/character/index.d.cts +1 -1
  15. package/dist/character/index.d.ts +1 -1
  16. package/dist/character/index.mjs +41 -40
  17. package/dist/{index-DiDhb7Kl.d.cts → index-Bl9hiHQR.d.cts} +4 -143
  18. package/dist/{index-DPlLfwK1.d.cts → index-Cax-mGq_.d.cts} +2 -17
  19. package/dist/{index-BWzZWl0z.d.ts → index-Cvdua0o-.d.ts} +2 -17
  20. package/dist/{index-BhqocQcj.d.cts → index-Dib5x6-D.d.ts} +138 -73
  21. package/dist/{index-B7Tn343-.d.ts → index-_rD16ks5.d.ts} +4 -143
  22. package/dist/{index-Bju40pxd.d.ts → index-jEmIURMn.d.cts} +138 -73
  23. package/dist/index.cjs +144 -143
  24. package/dist/index.d.cts +13 -37
  25. package/dist/index.d.ts +13 -37
  26. package/dist/index.mjs +144 -143
  27. package/dist/interfaces/index.d.cts +3 -3
  28. package/dist/interfaces/index.d.ts +3 -3
  29. package/dist/narration/index.cjs +55 -54
  30. package/dist/narration/index.d.cts +1 -1
  31. package/dist/narration/index.d.ts +1 -1
  32. package/dist/narration/index.mjs +55 -54
  33. package/dist/sound/index.cjs +42 -41
  34. package/dist/sound/index.mjs +42 -41
  35. package/package.json +4 -3
@@ -1,27 +1,9 @@
1
- import { UPDATE_PRIORITY, Ticker as Ticker$1 } from 'pixi.js';
2
- import { T as TickerArgs, d as TickerIdType } from '../../TickersSequence-_GvVF_1g.js';
3
- export { a as TickerHistory, b as TickerHistoryForExport, c as TickersSequence } from '../../TickersSequence-_GvVF_1g.js';
1
+ import { Ticker, UPDATE_PRIORITY } from 'pixi.js';
2
+ import { a as TickerArgs, T as Ticker$1, e as TickerIdType } from '../../TickersSequence-Cf1Vcu22.js';
3
+ export { b as TickerHistory, c as TickerInfo, d as TickersSequence } from '../../TickersSequence-Cf1Vcu22.js';
4
+ import { ObjectTarget, AnimationOptions, AnimationPlaybackControlsWithThen, ObjectSegment, At, SequenceOptions } from 'motion';
4
5
 
5
- interface Ticker<TArgs extends TickerArgs> {
6
- /**
7
- * Arguments to pass to the ticker
8
- */
9
- args: TArgs;
10
- /**
11
- * Duration in seconds to run the ticker
12
- */
13
- duration?: number;
14
- /**
15
- * Priority of the ticker
16
- */
17
- priority?: UPDATE_PRIORITY;
18
- /**
19
- * Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link RegisteredTickers.getInstance}
20
- */
21
- id: TickerIdType;
22
- }
23
-
24
- type TickerValue = Ticker$1;
6
+ type TickerValue = Ticker;
25
7
 
26
8
  /**
27
9
  * A class is used to create a ticker element to add into a Pixi Application.
@@ -29,6 +11,7 @@ type TickerValue = Ticker$1;
29
11
  * This class should be extended and the fn method should be overridden.
30
12
  * You must use the {@link tickerDecorator} to register the ticker in the game.
31
13
  * In Ren'Py is a transform.
14
+ * @template TArgs The type of the arguments that you want to pass to the ticker.
32
15
  * @example
33
16
  * ```typescript
34
17
  * \@tickerDecorator() // this is equivalent to tickerDecorator("RotateTicker")
@@ -55,7 +38,7 @@ type TickerValue = Ticker$1;
55
38
  * }
56
39
  * ```
57
40
  */
58
- declare class TickerBase<TArgs extends TickerArgs> implements Ticker<TArgs> {
41
+ declare abstract class TickerBase<TArgs extends TickerArgs> implements Ticker$1<TArgs> {
59
42
  /**
60
43
  * @param args The arguments that you want to pass to the ticker.
61
44
  * @param duration The duration of the ticker in seconds. If is undefined, the step will end only when the animation is finished (if the animation doesn't have a goal to reach then it won't finish). @default undefined
@@ -69,6 +52,9 @@ declare class TickerBase<TArgs extends TickerArgs> implements Ticker<TArgs> {
69
52
  args: TArgs;
70
53
  duration?: number;
71
54
  priority?: UPDATE_PRIORITY;
55
+ protected ticker: Ticker;
56
+ protected tickerId?: string;
57
+ canvasElementAliases: string[];
72
58
  /**
73
59
  * The method that will be called every frame.
74
60
  * This method should be overridden and you can use {@link canvas.add()} to get the canvas element of the canvas, and edit them.
@@ -77,14 +63,16 @@ declare class TickerBase<TArgs extends TickerArgs> implements Ticker<TArgs> {
77
63
  * @param _alias The alias of the canvas elements that are connected to this ticker
78
64
  * @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link canvas.currentTickers}
79
65
  */
80
- fn(_ticker: TickerValue, _args: TArgs, _alias: string | string[], _tickerId: string): void;
81
- /**
82
- * This method is called when the ticker is added to the canvas.
83
- * @param alias The alias of the canvas elements that are connected to this ticker
84
- * @param tickerId The id of the ticker. You can use this to get the ticker from the {@link canvas.currentTickers}
85
- * @param options The options that you passed when you added the ticker
86
- */
87
- onEndOfTicker(_alias: string | string[], tickerId: string, args: TArgs): void;
66
+ abstract fn(_ticker: TickerValue, _args: TArgs, _alias: string | string[], _tickerId: string): void;
67
+ protected fnValue?: () => void;
68
+ complete(_options?: {
69
+ ignoreTickerSteps?: boolean;
70
+ }): void;
71
+ stop(): void;
72
+ start(id: string): void;
73
+ pause(): void;
74
+ play(): void;
75
+ get paused(): boolean;
88
76
  }
89
77
 
90
78
  type TickerProgrationType = TickerProgrationLinear | TickerProgrationExponential;
@@ -112,6 +100,37 @@ interface TickerProgrationExponential {
112
100
  type: "exponential";
113
101
  }
114
102
 
103
+ type CommonTickerProps = {
104
+ /**
105
+ * The alias to remove after the effect is done
106
+ * @default []
107
+ */
108
+ aliasToRemoveAfter?: string[] | string;
109
+ /**
110
+ * If true, the effect only starts if the canvas element have a texture
111
+ * @default false
112
+ */
113
+ startOnlyIfHaveTexture?: boolean;
114
+ /**
115
+ * The alias to resume after the effect is done
116
+ * @default []
117
+ */
118
+ tickerAliasToResume?: string[] | string;
119
+ /**
120
+ * The id of the ticker to resume after the effect is done
121
+ * @default []
122
+ */
123
+ tickerIdToResume?: string[] | string;
124
+ /**
125
+ * If set to `true`, the game will force the animation to complete before moving to the next step.
126
+ * @default false
127
+ */
128
+ forceCompleteBeforeNext?: boolean;
129
+ };
130
+
131
+ /**
132
+ * @deprecated
133
+ */
115
134
  type FadeAlphaTickerProps = {
116
135
  /**
117
136
  * @deprecated use speed instead
@@ -137,26 +156,12 @@ type FadeAlphaTickerProps = {
137
156
  * The progression of the speed
138
157
  */
139
158
  speedProgression?: TickerProgrationType;
140
- /**
141
- * The alias to remove after the fade is done
142
- * @default []
143
- */
144
- aliasToRemoveAfter?: string[] | string;
145
- /**
146
- * If true, the effect only starts if the canvas element have a texture
147
- * @default false
148
- */
149
- startOnlyIfHaveTexture?: boolean;
150
- /**
151
- * The alias to resume after the effect is done
152
- * @default []
153
- */
154
- tickerAliasToResume?: string[] | string;
155
- };
159
+ } & CommonTickerProps;
156
160
 
157
161
  /**
158
162
  * A ticker that fades the alpha of the canvas element of the canvas.
159
163
  * This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
164
+ * @deprecated Use {@link canvas.animate}
160
165
  * @example
161
166
  * ```typescript
162
167
  * let bunny = addImage("bunny1", "https://pixijs.com/assets/eggHead.png")
@@ -172,14 +177,18 @@ type FadeAlphaTickerProps = {
172
177
  */
173
178
  declare class FadeAlphaTicker extends TickerBase<FadeAlphaTickerProps> {
174
179
  constructor(args?: FadeAlphaTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
175
- fn(ticker: TickerValue, args: FadeAlphaTickerProps, aliases: string[], tickerId: string): void;
176
- onEndOfTicker(alias: string | string[], tickerId: string, args: FadeAlphaTickerProps, options?: {
177
- editAlpha?: boolean;
178
- }): void;
180
+ fn(ticker: TickerValue, args: FadeAlphaTickerProps, aliases: string[], _tickerId: string): void;
181
+ onComplete(alias: string | string[], _tickerId: string, args: FadeAlphaTickerProps): void;
179
182
  private getLimit;
180
183
  private speedConvert;
184
+ complete(options?: {
185
+ ignoreTickerSteps?: boolean;
186
+ }): void;
181
187
  }
182
188
 
189
+ /**
190
+ * @deprecated
191
+ */
183
192
  type MoveTickerProps = {
184
193
  /**
185
194
  * The speed of the movement (1 pixels per 0.1 second)
@@ -208,26 +217,12 @@ type MoveTickerProps = {
208
217
  * The progression of the speed
209
218
  */
210
219
  speedProgression?: TickerProgrationType;
211
- /**
212
- * The alias to remove after the fade is done
213
- * @default []
214
- */
215
- aliasToRemoveAfter?: string[] | string;
216
- /**
217
- * If true, the effect only starts if the canvas element have a texture
218
- * @default false
219
- */
220
- startOnlyIfHaveTexture?: boolean;
221
- /**
222
- * The alias to resume after the effect is done
223
- * @default []
224
- */
225
- tickerAliasToResume?: string[] | string;
226
- };
220
+ } & CommonTickerProps;
227
221
 
228
222
  /**
229
223
  * A ticker that moves the canvas element of the canvas.
230
224
  * This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
225
+ * @deprecated Use {@link canvas.animate}
231
226
  * @example
232
227
  * ```typescript
233
228
  * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
@@ -239,16 +234,18 @@ type MoveTickerProps = {
239
234
  * ```
240
235
  */
241
236
  declare class MoveTicker extends TickerBase<MoveTickerProps> {
242
- fn(ticker: TickerValue, args: MoveTickerProps, aliases: string[], tickerId: string): void;
243
- onEndOfTicker(alias: string | string[], tickerId: string, args: MoveTickerProps, options?: {
244
- editPosition: boolean;
245
- }): void;
237
+ fn(ticker: TickerValue, args: MoveTickerProps, aliases: string[], _tickerId: string): void;
238
+ onComplete(alias: string | string[], _tickerId: string, args: MoveTickerProps): void;
246
239
  private speedConvert;
240
+ complete(options?: {
241
+ ignoreTickerSteps?: boolean;
242
+ }): void;
247
243
  }
248
244
 
249
245
  /**
250
246
  * A ticker that rotates the canvas element of the canvas. For centre rotation, set the anchor of the canvas element to 0.5.
251
247
  * This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
248
+ * @deprecated Use {@link canvas.animate}
252
249
  * @example
253
250
  * ```typescript
254
251
  * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
@@ -263,16 +260,18 @@ declare class MoveTicker extends TickerBase<MoveTickerProps> {
263
260
  */
264
261
  declare class RotateTicker extends TickerBase<RotateTickerProps> {
265
262
  constructor(args?: RotateTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
266
- fn(ticker: TickerValue, args: RotateTickerProps, aliases: string[], tickerId: string): void;
267
- onEndOfTicker(alias: string | string[], tickerId: string, args: RotateTickerProps, options?: {
268
- editRotation?: boolean;
269
- }): void;
263
+ fn(ticker: TickerValue, args: RotateTickerProps, aliases: string[], _tickerId: string): void;
264
+ onComplete(alias: string | string[], _tickerId: string, args: RotateTickerProps): void;
270
265
  private speedConvert;
266
+ complete(options?: {
267
+ ignoreTickerSteps?: boolean;
268
+ }): void;
271
269
  }
272
270
 
273
271
  /**
274
272
  * A ticker that zooms the canvas element of the canvas.
275
273
  * This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
274
+ * @deprecated Use {@link canvas.animate}
276
275
  * @example
277
276
  * ```typescript
278
277
  * let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
@@ -286,12 +285,13 @@ declare class RotateTicker extends TickerBase<RotateTickerProps> {
286
285
  */
287
286
  declare class ZoomTicker extends TickerBase<ZoomTickerProps> {
288
287
  constructor(args?: ZoomTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
289
- fn(ticker: TickerValue, args: ZoomTickerProps, alias: string[], tickerId: string): void;
288
+ fn(ticker: TickerValue, args: ZoomTickerProps, alias: string[], _tickerId: string): void;
290
289
  private speedConvert;
291
- onEndOfTicker(alias: string | string[], tickerId: string, args: ZoomTickerProps, options?: {
292
- editScale?: boolean;
293
- }): void;
290
+ onComplete(alias: string | string[], _tickerId: string, args: ZoomTickerProps): void;
294
291
  private getLimit;
292
+ complete(options?: {
293
+ ignoreTickerSteps?: boolean;
294
+ }): void;
295
295
  }
296
296
 
297
297
  /**
@@ -301,20 +301,24 @@ declare class ZoomTicker extends TickerBase<ZoomTickerProps> {
301
301
  * @param name is th identifier of the label, by default is the name of the class
302
302
  * @returns
303
303
  */
304
- declare function tickerDecorator(name?: TickerIdType): (target: typeof TickerBase<any>) => void;
304
+ declare function tickerDecorator(name?: TickerIdType): (target: {
305
+ new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker$1<any>;
306
+ }) => void;
305
307
  declare namespace RegisteredTickers {
306
308
  /**
307
309
  * Register a ticker in the game.
308
310
  * @param target The class of the ticker.
309
311
  * @param name Name of the ticker, by default it will use the class name. If the name is already registered, it will show a warning
310
312
  */
311
- function add(target: typeof TickerBase<any>, name?: TickerIdType): void;
313
+ function add(target: {
314
+ new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker$1<any>;
315
+ }, name?: TickerIdType): void;
312
316
  /**
313
317
  * Get a ticker by the id.
314
318
  * @param canvasId The id of the ticker.
315
319
  * @returns The ticker type.
316
320
  */
317
- function get<T = typeof TickerBase<any>>(tickerId: TickerIdType): T | undefined;
321
+ function get<T = Ticker$1<any>>(tickerId: TickerIdType): T | undefined;
318
322
  /**
319
323
  * Get a ticker instance by the id.
320
324
  * @param tickerId The id of the ticker.
@@ -323,12 +327,14 @@ declare namespace RegisteredTickers {
323
327
  * @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
324
328
  * @returns The instance of the ticker
325
329
  */
326
- function getInstance<TArgs extends TickerArgs>(tickerId: TickerIdType, args: TArgs, duration?: number, priority?: UPDATE_PRIORITY): TickerBase<TArgs> | undefined;
330
+ function getInstance<TArgs extends TickerArgs>(tickerId: TickerIdType, args: TArgs, duration?: number, priority?: UPDATE_PRIORITY): Ticker$1<TArgs> | undefined;
327
331
  /**
328
332
  * Get a list of all tickers registered.
329
333
  * @returns An array of tickers.
330
334
  */
331
- function values(): (typeof TickerBase<any>)[];
335
+ function values(): {
336
+ new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker$1<any>;
337
+ }[];
332
338
  /**
333
339
  * Check if a ticker is registered.
334
340
  * @param id The id of the ticker.
@@ -337,12 +343,56 @@ declare namespace RegisteredTickers {
337
343
  function has(id: string): boolean;
338
344
  }
339
345
 
346
+ type ObjectSegmentWithTransition<O extends {} = {}> = [
347
+ O,
348
+ ObjectTarget<O>,
349
+ AnimationOptions & At & {
350
+ ticker?: Ticker;
351
+ }
352
+ ];
353
+ /**
354
+ * Animate a PixiJS component or components using [motion's animate](https://motion.dev/docs/animate) function.
355
+ * This function integrates with the PixiJS ticker to ensure smooth animations.
356
+ *
357
+ * Pixi’VN will **not** keep track of the animation state of this function (This feature is intended for animating PixiJS components used for UI.).
358
+ * If you want Pixi'VN to save the animation state in saves, use the {@link canvas.animate} function instead.
359
+ * @param components - The PixiJS component(s) to animate.
360
+ * @param keyframes - The keyframes to animate the component(s) with.
361
+ * @param options - Additional options for the animation, including duration, easing, and ticker.
362
+ * @returns An animation playback control object that can be used to start, stop, or control the animation.
363
+ * @template T - The type of PixiJS component(s) being animated.
364
+ */
365
+ declare function animate<T extends {}>(components: T | T[], keyframes: ObjectTarget<T>, options?: AnimationOptions & {
366
+ ticker?: Ticker;
367
+ }): AnimationPlaybackControlsWithThen;
368
+ /**
369
+ * Animate a sequence of PixiJS components with transitions using [motion's animate](https://motion.dev/docs/animate) function.
370
+ * This function allows for complex animations involving multiple components and transitions.
371
+ * It integrates with the PixiJS ticker to ensure smooth animations.
372
+ * This function is intended for animating PixiJS components used for UI.
373
+ *
374
+ * Pixi’VN will **not** keep track of the animation state of this function (This feature is intended for animating PixiJS components used for UI.).
375
+ * If you want Pixi'VN to save the animation state in saves, use the {@link canvas.animate} function instead
376
+ *
377
+ * @param sequence An array of segments to animate, where each segment is an array containing:
378
+ * - The PixiJS component to animate.
379
+ * - The keyframes to animate the component with.
380
+ * - An options object that can include animation options and a ticker.
381
+ * @param options Additional options for the sequence, such as duration and repeat count.
382
+ * @returns An animation playback control object that can be used to start, stop, or control the animation.
383
+ * @template T - The type of PixiJS component(s) being animated.
384
+ */
385
+ declare function animate<T extends {}>(sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[], options?: SequenceOptions): AnimationPlaybackControlsWithThen;
386
+
340
387
  interface TickerTimeoutHistory {
341
388
  aliases: string[];
342
389
  ticker: string;
343
390
  canBeDeletedBeforeEnd: boolean;
344
391
  }
345
392
 
393
+ /**
394
+ * @deprecated
395
+ */
346
396
  type RotateTickerProps = {
347
397
  /**
348
398
  * The speed of the rotation (360 degree per 10 second)
@@ -363,23 +413,11 @@ type RotateTickerProps = {
363
413
  * The progression of the speed
364
414
  */
365
415
  speedProgression?: TickerProgrationType;
366
- /**
367
- * The alias to remove after the fade is done
368
- * @default []
369
- */
370
- aliasToRemoveAfter?: string[] | string;
371
- /**
372
- * If true, the effect only starts if the canvas element have a texture
373
- * @default false
374
- */
375
- startOnlyIfHaveTexture?: boolean;
376
- /**
377
- * The alias to resume after the effect is done
378
- * @default []
379
- */
380
- tickerAliasToResume?: string[] | string;
381
- };
416
+ } & CommonTickerProps;
382
417
 
418
+ /**
419
+ * @deprecated
420
+ */
383
421
  type ZoomTickerProps = {
384
422
  /**
385
423
  * The speed of the zoom effect (100% zoom per 10 second)
@@ -410,21 +448,6 @@ type ZoomTickerProps = {
410
448
  * @default undefined
411
449
  */
412
450
  speedProgression?: TickerProgrationType;
413
- /**
414
- * The alias to remove after the effect is done
415
- * @default []
416
- */
417
- aliasToRemoveAfter?: string[] | string;
418
- /**
419
- * If true, the effect only starts if the canvas element have a texture
420
- * @default false
421
- */
422
- startOnlyIfHaveTexture?: boolean;
423
- /**
424
- * The alias to resume after the effect is done
425
- * @default []
426
- */
427
- tickerAliasToResume?: string[] | string;
428
451
  /**
429
452
  * Is a special prop used in the zoom in/out transition.
430
453
  * @default false
@@ -439,6 +462,6 @@ type ZoomTickerProps = {
439
462
  y: number;
440
463
  };
441
464
  };
442
- };
465
+ } & CommonTickerProps;
443
466
 
444
- export { FadeAlphaTicker, type FadeAlphaTickerProps, MoveTicker, type MoveTickerProps, RegisteredTickers, RotateTicker, type RotateTickerProps, type Ticker, TickerArgs, TickerBase, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, ZoomTicker, type ZoomTickerProps, tickerDecorator };
467
+ export { type CommonTickerProps, FadeAlphaTicker, type FadeAlphaTickerProps, MoveTicker, type MoveTickerProps, RegisteredTickers, RotateTicker, type RotateTickerProps, Ticker$1 as Ticker, TickerArgs, TickerBase, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickerValue, ZoomTicker, type ZoomTickerProps, animate, tickerDecorator };