@drincs/pixi-vn 1.3.13 → 1.3.15
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/{classes/index.d.cts → CachedMap-DZLvJAnA.d.cts} +1 -1
- package/dist/{classes/index.d.ts → CachedMap-DZLvJAnA.d.ts} +1 -1
- package/dist/{OpenedLabel-DxlOwJKw.d.ts → HistoryChoiceMenuOption-BjnxDyK5.d.cts} +47 -2
- package/dist/{OpenedLabel-Dgkgemkv.d.cts → HistoryChoiceMenuOption-ZdrL_kYX.d.ts} +47 -2
- package/dist/{StorageElementType-DTGcnkzF.d.ts → StorageElementType-dAIVJeiw.d.cts} +1 -1
- package/dist/{StorageElementType-DTGcnkzF.d.cts → StorageElementType-dAIVJeiw.d.ts} +1 -1
- package/dist/history.cjs +1 -0
- package/dist/{history/index.d.ts → history.d.cts} +14 -8
- package/dist/{history/index.d.cts → history.d.ts} +14 -8
- package/dist/history.mjs +1 -0
- package/dist/index.cjs +143 -143
- package/dist/index.d.cts +3076 -216
- package/dist/index.d.ts +3076 -216
- package/dist/index.mjs +143 -143
- package/dist/narration.cjs +2 -0
- package/dist/{index-_rD16ks5.d.ts → narration.d.cts} +27 -44
- package/dist/{index-Bl9hiHQR.d.cts → narration.d.ts} +27 -44
- package/dist/narration.mjs +2 -0
- package/dist/storage.cjs +1 -0
- package/dist/{storage/index.d.ts → storage.d.cts} +75 -6
- package/dist/{storage/index.d.cts → storage.d.ts} +75 -6
- package/dist/storage.mjs +1 -0
- package/dist/unifier.cjs +1 -0
- package/dist/unifier.d.cts +230 -0
- package/dist/unifier.d.ts +230 -0
- package/dist/unifier.mjs +1 -0
- package/package.json +29 -2
- package/dist/ContainerMemory-CrY9QSo2.d.cts +0 -106
- package/dist/ContainerMemory-DrijxCcD.d.ts +0 -106
- package/dist/HistoryChoiceMenuOption-Kj_P28ke.d.ts +0 -49
- package/dist/HistoryChoiceMenuOption-unaLLfKR.d.cts +0 -49
- package/dist/HistoryGameState-i_gx3rGM.d.ts +0 -12
- package/dist/HistoryGameState-qeIMl_DH.d.cts +0 -12
- package/dist/NarrationGameState-CqDh48n_.d.ts +0 -24
- package/dist/NarrationGameState-Cu-OYzph.d.cts +0 -24
- package/dist/SoundGameState-BG_iPwjt.d.cts +0 -85
- package/dist/SoundGameState-BG_iPwjt.d.ts +0 -85
- package/dist/StorageGameState-B2kz-u_2.d.cts +0 -19
- package/dist/StorageGameState-Cnfj75sk.d.ts +0 -19
- package/dist/StoredClassModel-CjdhvNgB.d.cts +0 -56
- package/dist/StoredClassModel-CjdhvNgB.d.ts +0 -56
- package/dist/TickersSequence-Cf1Vcu22.d.cts +0 -133
- package/dist/TickersSequence-Cf1Vcu22.d.ts +0 -133
- package/dist/canvas/index.cjs +0 -3316
- package/dist/canvas/index.d.cts +0 -8
- package/dist/canvas/index.d.ts +0 -8
- package/dist/canvas/index.mjs +0 -3316
- package/dist/canvas/tickers/index.cjs +0 -3316
- package/dist/canvas/tickers/index.d.cts +0 -467
- package/dist/canvas/tickers/index.d.ts +0 -467
- package/dist/canvas/tickers/index.mjs +0 -3316
- package/dist/character/index.cjs +0 -572
- package/dist/character/index.d.cts +0 -3
- package/dist/character/index.d.ts +0 -3
- package/dist/character/index.mjs +0 -572
- package/dist/classes/index.cjs +0 -1
- package/dist/classes/index.mjs +0 -1
- package/dist/history/index.cjs +0 -1
- package/dist/history/index.mjs +0 -1
- package/dist/index-B4F3XaWz.d.cts +0 -1767
- package/dist/index-Cax-mGq_.d.cts +0 -216
- package/dist/index-Cvdua0o-.d.ts +0 -216
- package/dist/index-Czfdktw9.d.ts +0 -93
- package/dist/index-DZ1shoNp.d.cts +0 -93
- package/dist/index-DvpfJ2VQ.d.ts +0 -1767
- package/dist/interfaces/index.cjs +0 -1
- package/dist/interfaces/index.d.cts +0 -55
- package/dist/interfaces/index.d.ts +0 -55
- package/dist/interfaces/index.mjs +0 -0
- package/dist/narration/index.cjs +0 -573
- package/dist/narration/index.d.cts +0 -8
- package/dist/narration/index.d.ts +0 -8
- package/dist/narration/index.mjs +0 -573
- package/dist/sound/index.cjs +0 -572
- package/dist/sound/index.d.cts +0 -3
- package/dist/sound/index.d.ts +0 -3
- package/dist/sound/index.mjs +0 -572
- package/dist/storage/index.cjs +0 -1
- package/dist/storage/index.mjs +0 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.d.cts +0 -8
- package/dist/utils/index.d.ts +0 -8
- package/dist/utils/index.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,47 +1,2947 @@
|
|
|
1
1
|
import * as _pixi_sound_lib_filters from '@pixi/sound/lib/filters';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Options, PlayOptions, Sound as Sound$1, IMediaInstance, SoundLibrary, IMediaContext, Filter, SoundMap, filters as filters$1 } from '@pixi/sound';
|
|
3
|
+
import * as historyUtils from '@drincs/pixi-vn/history';
|
|
4
|
+
import { StoredChoiceInterface, StorageElementType as StorageElementType$1, OpenedLabel as OpenedLabel$1 } from '@drincs/pixi-vn/history';
|
|
5
|
+
export * from '@drincs/pixi-vn/history';
|
|
6
|
+
import * as narrationUtils from '@drincs/pixi-vn/narration';
|
|
7
|
+
import { NarrationGameState } from '@drincs/pixi-vn/narration';
|
|
8
|
+
export * from '@drincs/pixi-vn/narration';
|
|
9
|
+
import * as storageUtils from '@drincs/pixi-vn/storage';
|
|
10
|
+
export * from '@drincs/pixi-vn/storage';
|
|
11
|
+
import { GameUnifier } from '@drincs/pixi-vn/unifier';
|
|
12
|
+
export * from '@drincs/pixi-vn/unifier';
|
|
13
|
+
import { ObjectTarget, AnimationOptions as AnimationOptions$1, AnimationPlaybackControlsWithThen, ObjectSegment as ObjectSegment$1, At, SequenceOptions as SequenceOptions$1 } from 'motion';
|
|
4
14
|
export { AnimationOptions as MotionAnimationOptions } from 'motion';
|
|
5
15
|
import * as pixi_js from 'pixi.js';
|
|
6
|
-
import {
|
|
16
|
+
import { Container as Container$1, ContainerChild as ContainerChild$1, Ticker as Ticker$1, UPDATE_PRIORITY, Application, Rectangle, ApplicationOptions, PointData, SpriteOptions as SpriteOptions$1, EventEmitter, ContainerOptions, TextOptions as TextOptions$1, AllFederatedEventMap, Sprite as Sprite$1, Texture, ContainerEvents, TextureSourceLike, TextureSource, ObservablePoint, Text as Text$1 } from 'pixi.js';
|
|
7
17
|
export { pixi_js as PIXI };
|
|
8
18
|
export { Assets, ContainerOptions, Rectangle, Texture, TextureSourceLike, Ticker as TickerValue, UPDATE_PRIORITY } from 'pixi.js';
|
|
9
19
|
export { AssetSrc, AssetsBundle, AssetsManifest, LoadParserName, ResolvedAsset, ResolvedSrc, UnresolvedAsset } from 'pixi.js/lib/assets/types';
|
|
10
|
-
import { C as CanvasManagerInterface, c as canvasUtils } from './index-DvpfJ2VQ.js';
|
|
11
|
-
export { $ as AnimationOptions, a0 as AnimationSequenceOptions, H as CanvasBaseInterface, b as CanvasEvent, a5 as CanvasEventNamesType, d as CanvasManagerStatic, e as Container, I as ImageContainer, K as ImageContainerMemory, B as ImageContainerOptions, f as ImageSprite, M as ImageSpriteMemory, D as ImageSpriteOptions, a1 as KeyframesType, L as Layer, W as MoveInOutProps, a2 as ObjectSegment, a3 as ObjectSegmentWithTransition, X as PushInOutProps, R as RegisteredCanvasComponents, i as RegisteredEvents, a4 as SequenceOptions, J as ShakeEffectProps, Y as ShowWithDissolveTransitionProps, Z as ShowWithFadeTransitionProps, S as Sprite, N as SpriteBaseMemory, O as SpriteMemory, E as SpriteOptions, T as Text, P as TextMemory, F as TextOptions, U as TextureMemory, V as VideoSprite, Q as VideoSpriteMemory, G as VideoSpriteOptions, _ as ZoomInOutProps, v as addImage, t as addImageCointainer, y as addVideo, a as canvas, g as canvasComponentDecorator, h as eventDecorator, x as getTexture, m as moveIn, j as moveOut, p as pushIn, k as pushOut, r as removeWithDissolve, l as removeWithFade, s as shakeEffect, w as showImage, u as showImageContainer, A as showVideo, n as showWithDissolve, o as showWithFade, z as zoomIn, q as zoomOut } from './index-DvpfJ2VQ.js';
|
|
12
|
-
import { c as characterUtils } from './index-Cvdua0o-.js';
|
|
13
|
-
export { C as CharacterBaseModel, b as CharacterInterface, a as CharacterStoredClass, R as RegisteredCharacters } from './index-Cvdua0o-.js';
|
|
14
|
-
export { CachedMap } from './classes/index.js';
|
|
15
|
-
import { filters as filters$1 } from '@pixi/sound';
|
|
16
|
-
import { P as PauseType, R as RepeatType } from './TickersSequence-Cf1Vcu22.js';
|
|
17
|
-
export { T as Ticker, a as TickerArgs, b as TickerHistory, c as TickerInfo, d as TickersSequence } from './TickersSequence-Cf1Vcu22.js';
|
|
18
|
-
import { HistoryManagerInterface } from './history/index.js';
|
|
19
|
-
export { HistoryManagerStatic, stepHistory } from './history/index.js';
|
|
20
|
-
import { GameState } from './interfaces/index.js';
|
|
21
|
-
export { GameStepStateData } from './interfaces/index.js';
|
|
22
|
-
import { S as StepLabelType, a as StepLabelPropsType, N as NarrationManagerInterface, L as LabelAbstract, n as narrationUtils } from './index-_rD16ks5.js';
|
|
23
|
-
export { C as ChoiceInterface, I as InputInfo, e as Label, g as LabelProps, k as LabelSteps, j as NarrationManagerStatic, R as RegisteredLabels, h as StepLabelProps, i as StepLabelResult, l as StepLabelResultType, b as narration, c as newChoiceOption, d as newCloseChoiceOption, f as newLabel } from './index-_rD16ks5.js';
|
|
24
|
-
import { StorageManagerInterface } from './storage/index.js';
|
|
25
|
-
export { StorageManagerStatic, storage } from './storage/index.js';
|
|
26
|
-
import { GameStepState, HistoryInfo, CharacterInterface } from '@drincs/pixi-vn';
|
|
27
|
-
import { S as StorageElementType } from './StorageElementType-DTGcnkzF.js';
|
|
28
|
-
export { a as StorageObjectType } from './StorageElementType-DTGcnkzF.js';
|
|
29
|
-
import { createExportableElement } from './utils/index.js';
|
|
30
20
|
import { Devtools } from '@pixi/devtools';
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
21
|
+
import { CharacterInterface as CharacterInterface$1, GameStepState } from '@drincs/pixi-vn';
|
|
22
|
+
import { LRUCache } from 'lru-cache';
|
|
23
|
+
import deepDiff from 'deep-diff';
|
|
24
|
+
import { Difference } from 'microdiff';
|
|
25
|
+
|
|
26
|
+
interface SoundOptions extends Omit<Options, "complete" | "loaded" | "sprites" | "source"> {
|
|
27
|
+
}
|
|
28
|
+
interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class Sound extends Sound$1 {
|
|
32
|
+
alias?: string;
|
|
33
|
+
pause(): this;
|
|
34
|
+
resume(): this;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
stop(): this;
|
|
37
|
+
play(options?: string | SoundPlayOptions): IMediaInstance | Promise<IMediaInstance>;
|
|
38
|
+
/**
|
|
39
|
+
* https://github.com/pixijs/sound/blob/main/src/Sound.ts#L235
|
|
40
|
+
*/
|
|
41
|
+
static from(source: string | string[] | SoundOptions | ArrayBuffer | HTMLAudioElement | AudioBuffer): Sound;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type DistortionFilter = {
|
|
45
|
+
type: "DistortionFilter";
|
|
46
|
+
amount?: number;
|
|
47
|
+
};
|
|
48
|
+
type EqualizerFilter = {
|
|
49
|
+
type: "EqualizerFilter";
|
|
50
|
+
f32?: number;
|
|
51
|
+
f64?: number;
|
|
52
|
+
f125?: number;
|
|
53
|
+
f250?: number;
|
|
54
|
+
f500?: number;
|
|
55
|
+
f1k?: number;
|
|
56
|
+
f2k?: number;
|
|
57
|
+
f4k?: number;
|
|
58
|
+
f8k?: number;
|
|
59
|
+
f16k?: number;
|
|
60
|
+
};
|
|
61
|
+
type MonoFilter = {
|
|
62
|
+
type: "MonoFilter";
|
|
63
|
+
};
|
|
64
|
+
type ReverbFilter = {
|
|
65
|
+
type: "ReverbFilter";
|
|
66
|
+
seconds?: number;
|
|
67
|
+
decay?: number;
|
|
68
|
+
reverse?: boolean;
|
|
69
|
+
};
|
|
70
|
+
type StereoFilter = {
|
|
71
|
+
type: "StereoFilter";
|
|
72
|
+
pan?: number;
|
|
73
|
+
};
|
|
74
|
+
type StreamFilter = {
|
|
75
|
+
type: "StreamFilter";
|
|
76
|
+
};
|
|
77
|
+
type TelephoneFilter = {
|
|
78
|
+
type: "TelephoneFilter";
|
|
79
|
+
};
|
|
80
|
+
type SoundFilterMemory = DistortionFilter | EqualizerFilter | MonoFilter | ReverbFilter | StereoFilter | StreamFilter | TelephoneFilter;
|
|
81
|
+
|
|
82
|
+
interface ExportedSound {
|
|
83
|
+
options: SoundOptions;
|
|
84
|
+
filters?: SoundFilterMemory[];
|
|
85
|
+
}
|
|
86
|
+
interface SoundPlay {
|
|
87
|
+
stepIndex: number;
|
|
88
|
+
paused: boolean;
|
|
89
|
+
options?: SoundPlayOptions | string;
|
|
90
|
+
}
|
|
91
|
+
interface ExportedSoundPlay extends SoundPlay {
|
|
92
|
+
sound: ExportedSound;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Interface exported sounds
|
|
96
|
+
*/
|
|
97
|
+
interface SoundGameState {
|
|
98
|
+
soundAliasesOrder: string[];
|
|
99
|
+
filters?: SoundFilterMemory[];
|
|
100
|
+
soundsPlaying: {
|
|
101
|
+
[key: string]: ExportedSoundPlay;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* @deprecated
|
|
105
|
+
*/
|
|
106
|
+
playInStepIndex?: {
|
|
107
|
+
[key: string]: SoundPlay;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* @deprecated
|
|
111
|
+
*/
|
|
112
|
+
sounds?: ExportedSoundOld;
|
|
113
|
+
}
|
|
114
|
+
interface ExportedSoundOld {
|
|
115
|
+
[key: string]: {
|
|
116
|
+
options: SoundOptions;
|
|
117
|
+
filters?: SoundFilterMemory[];
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare class SoundManager extends SoundLibrary {
|
|
122
|
+
constructor();
|
|
123
|
+
get context(): IMediaContext;
|
|
124
|
+
get filtersAll(): Filter[];
|
|
125
|
+
set filtersAll(filtersAll: Filter[]);
|
|
126
|
+
get supported(): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* https://github.com/pixijs/sound/blob/main/src/SoundLibrary.ts#L187
|
|
129
|
+
*/
|
|
130
|
+
private getOptions;
|
|
131
|
+
add(alias: string, options: SoundOptions | string): Sound;
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated: Use `add(alias: string, options: Options | string | ArrayBuffer | AudioBuffer | HTMLAudioElement | Sound): Sound;` instead.
|
|
134
|
+
*/
|
|
135
|
+
add(map: any, globalOptions?: SoundOptions): SoundMap;
|
|
136
|
+
get useLegacy(): boolean;
|
|
137
|
+
set useLegacy(legacy: boolean);
|
|
138
|
+
get disableAutoPause(): boolean;
|
|
139
|
+
set disableAutoPause(autoPause: boolean);
|
|
140
|
+
remove(alias: string): this;
|
|
141
|
+
get volumeAll(): number;
|
|
142
|
+
set volumeAll(volume: number);
|
|
143
|
+
get speedAll(): number;
|
|
144
|
+
set speedAll(speed: number);
|
|
145
|
+
togglePauseAll(): boolean;
|
|
146
|
+
pauseAll(): this;
|
|
147
|
+
resumeAll(): this;
|
|
148
|
+
toggleMuteAll(): boolean;
|
|
149
|
+
muteAll(): this;
|
|
150
|
+
unmuteAll(): this;
|
|
151
|
+
removeAll(): this;
|
|
152
|
+
stopAll(): this;
|
|
153
|
+
exists(alias: string, assert?: boolean): boolean;
|
|
154
|
+
isPlaying(): boolean;
|
|
155
|
+
find(alias: string): Sound;
|
|
156
|
+
play(alias: string, options?: SoundPlayOptions | string): IMediaInstance | Promise<IMediaInstance>;
|
|
157
|
+
stop(alias: string): Sound;
|
|
158
|
+
pause(alias: string): Sound;
|
|
159
|
+
resume(alias: string): Sound;
|
|
160
|
+
volume(alias: string, volume?: number): number;
|
|
161
|
+
speed(alias: string, speed?: number): number;
|
|
162
|
+
duration(alias: string): number;
|
|
163
|
+
close(): this;
|
|
164
|
+
clear(): void;
|
|
165
|
+
export(): SoundGameState;
|
|
166
|
+
removeOldSoundAndExport(): SoundGameState;
|
|
167
|
+
restore(data: object): void;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
type Layer = Container$1<ContainerChild$1>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* is a string that represents a ticker id.
|
|
174
|
+
* It is used to {@link canvas.tickers} to get the ticker class.
|
|
175
|
+
*/
|
|
176
|
+
type TickerIdType = string;
|
|
177
|
+
|
|
178
|
+
interface TickerArgs {
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
type TickerValue = Ticker$1;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A class is used to create a ticker element to add into a Pixi Application.
|
|
185
|
+
* You can use {@link canvas.addTicker()} to add this element into the application.
|
|
186
|
+
* This class should be extended and the fn method should be overridden.
|
|
187
|
+
* You must use the {@link tickerDecorator} to register the ticker in the game.
|
|
188
|
+
* In Ren'Py is a transform.
|
|
189
|
+
* @template TArgs The type of the arguments that you want to pass to the ticker.
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* \@tickerDecorator() // this is equivalent to tickerDecorator("RotateTicker")
|
|
193
|
+
* export class RotateTicker extends TickerBase<{ speed?: number }> {
|
|
194
|
+
* override fn(
|
|
195
|
+
* t: TickerValue, // the ticker that is calling this method
|
|
196
|
+
* args: { // the arguments that you passed when you added the ticker
|
|
197
|
+
* speed?: number,
|
|
198
|
+
* },
|
|
199
|
+
* aliases: string[], // the aliases of the canvas elements that are connected to this ticker
|
|
200
|
+
* tickerId: string, // the id of the ticker. You can use this to get the ticker from the canvas.currentTickers
|
|
201
|
+
* ): void {
|
|
202
|
+
* let speed = args.speed === undefined ? 0.1 : args.speed
|
|
203
|
+
* aliases.forEach((alias) => {
|
|
204
|
+
* let element = canvas.find(alias)
|
|
205
|
+
* if (element && element instanceof Container) {
|
|
206
|
+
* if (clockwise)
|
|
207
|
+
* element.rotation += speed * t.deltaTime
|
|
208
|
+
* else
|
|
209
|
+
* element.rotation -= speed * t.deltaTime
|
|
210
|
+
* }
|
|
211
|
+
* })
|
|
212
|
+
* }
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare abstract class TickerBase<TArgs extends TickerArgs> implements Ticker<TArgs> {
|
|
217
|
+
/**
|
|
218
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
219
|
+
* @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
|
|
220
|
+
* @param priority The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
221
|
+
*/
|
|
222
|
+
constructor(args: TArgs, duration?: number, priority?: UPDATE_PRIORITY);
|
|
223
|
+
/**
|
|
224
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link RegisteredTickers.getInstance}
|
|
225
|
+
*/
|
|
226
|
+
id: TickerIdType;
|
|
227
|
+
args: TArgs;
|
|
228
|
+
duration?: number;
|
|
229
|
+
priority?: UPDATE_PRIORITY;
|
|
230
|
+
protected ticker: Ticker$1;
|
|
231
|
+
protected tickerId?: string;
|
|
232
|
+
canvasElementAliases: string[];
|
|
233
|
+
/**
|
|
234
|
+
* The method that will be called every frame.
|
|
235
|
+
* This method should be overridden and you can use {@link canvas.add()} to get the canvas element of the canvas, and edit them.
|
|
236
|
+
* @param _ticker The ticker that is calling this method
|
|
237
|
+
* @param _args The arguments that you passed when you added the ticker
|
|
238
|
+
* @param _alias The alias of the canvas elements that are connected to this ticker
|
|
239
|
+
* @param _tickerId The id of the ticker. You can use this to get the ticker from the {@link canvas.currentTickers}
|
|
240
|
+
*/
|
|
241
|
+
abstract fn(_ticker: TickerValue, _args: TArgs, _alias: string | string[], _tickerId: string): void;
|
|
242
|
+
protected fnValue?: () => void;
|
|
243
|
+
complete(_options?: {
|
|
244
|
+
ignoreTickerSteps?: boolean;
|
|
245
|
+
}): void;
|
|
246
|
+
stop(): void;
|
|
247
|
+
start(id: string): void;
|
|
248
|
+
pause(): void;
|
|
249
|
+
play(): void;
|
|
250
|
+
get paused(): boolean;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
type TickerProgrationType = TickerProgrationLinear | TickerProgrationExponential;
|
|
254
|
+
|
|
255
|
+
interface TickerProgrationLinear {
|
|
256
|
+
/**
|
|
257
|
+
* The amount of the speed to increase every frame.
|
|
258
|
+
*/
|
|
259
|
+
amt: number;
|
|
260
|
+
/**
|
|
261
|
+
* The limit of the effect
|
|
262
|
+
*/
|
|
263
|
+
limit?: number;
|
|
264
|
+
type: "linear";
|
|
265
|
+
}
|
|
266
|
+
interface TickerProgrationExponential {
|
|
267
|
+
/**
|
|
268
|
+
* The percentage of the speed to increase every frame. if the percentage is 0.1, the speed will increase by 10% every frame.
|
|
269
|
+
*/
|
|
270
|
+
percentage: number;
|
|
271
|
+
/**
|
|
272
|
+
* The limit of the effect
|
|
273
|
+
*/
|
|
274
|
+
limit?: number;
|
|
275
|
+
type: "exponential";
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
type CommonTickerProps = {
|
|
279
|
+
/**
|
|
280
|
+
* The alias to remove after the effect is done
|
|
281
|
+
* @default []
|
|
282
|
+
*/
|
|
283
|
+
aliasToRemoveAfter?: string[] | string;
|
|
284
|
+
/**
|
|
285
|
+
* If true, the effect only starts if the canvas element have a texture
|
|
286
|
+
* @default false
|
|
287
|
+
*/
|
|
288
|
+
startOnlyIfHaveTexture?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* The alias to resume after the effect is done
|
|
291
|
+
* @default []
|
|
292
|
+
*/
|
|
293
|
+
tickerAliasToResume?: string[] | string;
|
|
294
|
+
/**
|
|
295
|
+
* The id of the ticker to resume after the effect is done
|
|
296
|
+
* @default []
|
|
297
|
+
*/
|
|
298
|
+
tickerIdToResume?: string[] | string;
|
|
299
|
+
/**
|
|
300
|
+
* If set to `true`, the game will force the animation to complete before moving to the next step.
|
|
301
|
+
* @default false
|
|
302
|
+
*/
|
|
303
|
+
forceCompleteBeforeNext?: boolean;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @deprecated
|
|
308
|
+
*/
|
|
309
|
+
type FadeAlphaTickerProps = {
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated use speed instead
|
|
312
|
+
* @default 1
|
|
313
|
+
*/
|
|
314
|
+
duration?: number;
|
|
315
|
+
/**
|
|
316
|
+
* The speed of the effect (1 alpha per 10 second)
|
|
317
|
+
* @default 5
|
|
318
|
+
*/
|
|
319
|
+
speed?: number;
|
|
320
|
+
/**
|
|
321
|
+
* The type of the fade
|
|
322
|
+
* @default "hide"
|
|
323
|
+
*/
|
|
324
|
+
type?: "hide" | "show";
|
|
325
|
+
/**
|
|
326
|
+
* The limit of the fade
|
|
327
|
+
* @default type === "hide" ? 0 : 1
|
|
328
|
+
*/
|
|
329
|
+
limit?: number;
|
|
330
|
+
/**
|
|
331
|
+
* The progression of the speed
|
|
332
|
+
*/
|
|
333
|
+
speedProgression?: TickerProgrationType;
|
|
334
|
+
} & CommonTickerProps;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* A ticker that fades the alpha of the canvas element of the canvas.
|
|
338
|
+
* This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
|
|
339
|
+
* @deprecated Use {@link canvas.animate}
|
|
340
|
+
* @example
|
|
341
|
+
* ```typescript
|
|
342
|
+
* let bunny = addImage("bunny1", "https://pixijs.com/assets/eggHead.png")
|
|
343
|
+
* await bunny.load()
|
|
344
|
+
* canvas.add("bunny", bunny);
|
|
345
|
+
* // ...
|
|
346
|
+
* const ticker = new FadeAlphaTicker({
|
|
347
|
+
* duration: 4, // 4 seconds
|
|
348
|
+
* type: "hide",
|
|
349
|
+
* }),
|
|
350
|
+
* canvas.addTicker("bunny", ticker)
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
declare class FadeAlphaTicker extends TickerBase<FadeAlphaTickerProps> {
|
|
354
|
+
constructor(args?: FadeAlphaTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
|
|
355
|
+
fn(ticker: TickerValue, args: FadeAlphaTickerProps, aliases: string[], _tickerId: string): void;
|
|
356
|
+
onComplete(alias: string | string[], _tickerId: string, args: FadeAlphaTickerProps): void;
|
|
357
|
+
private getLimit;
|
|
358
|
+
private speedConvert;
|
|
359
|
+
complete(options?: {
|
|
360
|
+
ignoreTickerSteps?: boolean;
|
|
361
|
+
}): void;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @deprecated
|
|
366
|
+
*/
|
|
367
|
+
type MoveTickerProps = {
|
|
368
|
+
/**
|
|
369
|
+
* The speed of the movement (1 pixels per 0.1 second)
|
|
370
|
+
* @default 10
|
|
371
|
+
*/
|
|
372
|
+
speed?: number | {
|
|
373
|
+
x: number;
|
|
374
|
+
y: number;
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* The destination of the movement
|
|
378
|
+
*/
|
|
379
|
+
destination: {
|
|
380
|
+
/**
|
|
381
|
+
* The type of the destination. Possible values are "pixel", "percentage" and "align":
|
|
382
|
+
* - "pixel": The destination is in pixel
|
|
383
|
+
* - "percentage": The destination is in percentage
|
|
384
|
+
* - "align": The destination is in align
|
|
385
|
+
* @default "pixel"
|
|
386
|
+
*/
|
|
387
|
+
type?: "pixel" | "percentage" | "align";
|
|
388
|
+
y: number;
|
|
389
|
+
x: number;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* The progression of the speed
|
|
393
|
+
*/
|
|
394
|
+
speedProgression?: TickerProgrationType;
|
|
395
|
+
} & CommonTickerProps;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* A ticker that moves the canvas element of the canvas.
|
|
399
|
+
* This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
|
|
400
|
+
* @deprecated Use {@link canvas.animate}
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
404
|
+
* canvas.add("alien", alien);
|
|
405
|
+
* const ticker = new MoveTicker({
|
|
406
|
+
* speed: 0.1,
|
|
407
|
+
* destination: { x: 100, y: 100 },
|
|
408
|
+
* }),
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
declare class MoveTicker extends TickerBase<MoveTickerProps> {
|
|
412
|
+
fn(ticker: TickerValue, args: MoveTickerProps, aliases: string[], _tickerId: string): void;
|
|
413
|
+
onComplete(alias: string | string[], _tickerId: string, args: MoveTickerProps): void;
|
|
414
|
+
private speedConvert;
|
|
415
|
+
complete(options?: {
|
|
416
|
+
ignoreTickerSteps?: boolean;
|
|
417
|
+
}): void;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* A ticker that rotates the canvas element of the canvas. For centre rotation, set the anchor of the canvas element to 0.5.
|
|
422
|
+
* This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
|
|
423
|
+
* @deprecated Use {@link canvas.animate}
|
|
424
|
+
* @example
|
|
425
|
+
* ```typescript
|
|
426
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
427
|
+
* alien.anchor.set(0.5);
|
|
428
|
+
* canvas.add("alien", alien);
|
|
429
|
+
* const ticker = new RotateTicker({
|
|
430
|
+
* speed: 0.1,
|
|
431
|
+
* clockwise: true,
|
|
432
|
+
* }),
|
|
433
|
+
* canvas.addTicker("alien", ticker)
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
declare class RotateTicker extends TickerBase<RotateTickerProps> {
|
|
437
|
+
constructor(args?: RotateTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
|
|
438
|
+
fn(ticker: TickerValue, args: RotateTickerProps, aliases: string[], _tickerId: string): void;
|
|
439
|
+
onComplete(alias: string | string[], _tickerId: string, args: RotateTickerProps): void;
|
|
440
|
+
private speedConvert;
|
|
441
|
+
complete(options?: {
|
|
442
|
+
ignoreTickerSteps?: boolean;
|
|
443
|
+
}): void;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* A ticker that zooms the canvas element of the canvas.
|
|
448
|
+
* This ticker can be used on all canvas elements that extend the {@link PixiContainer} class.
|
|
449
|
+
* @deprecated Use {@link canvas.animate}
|
|
450
|
+
* @example
|
|
451
|
+
* ```typescript
|
|
452
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
453
|
+
* alien.anchor.set(0.5);
|
|
454
|
+
* canvas.add("alien", alien);
|
|
455
|
+
* const ticker = new ZoomTicker({
|
|
456
|
+
* speed: 0.1,
|
|
457
|
+
* }),
|
|
458
|
+
* canvas.addTicker("alien", ticker)
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
461
|
+
declare class ZoomTicker extends TickerBase<ZoomTickerProps> {
|
|
462
|
+
constructor(args?: ZoomTickerProps, duration?: number, priority?: UPDATE_PRIORITY);
|
|
463
|
+
fn(ticker: TickerValue, args: ZoomTickerProps, alias: string[], _tickerId: string): void;
|
|
464
|
+
private speedConvert;
|
|
465
|
+
onComplete(alias: string | string[], _tickerId: string, args: ZoomTickerProps): void;
|
|
466
|
+
private getLimit;
|
|
467
|
+
complete(options?: {
|
|
468
|
+
ignoreTickerSteps?: boolean;
|
|
469
|
+
}): void;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
interface Ticker<TArgs extends TickerArgs> {
|
|
473
|
+
/**
|
|
474
|
+
* Arguments to pass to the ticker
|
|
475
|
+
*/
|
|
476
|
+
args: TArgs;
|
|
477
|
+
/**
|
|
478
|
+
* Duration in seconds to run the ticker
|
|
479
|
+
*/
|
|
480
|
+
duration?: number;
|
|
481
|
+
/**
|
|
482
|
+
* Priority of the ticker
|
|
483
|
+
*/
|
|
484
|
+
priority?: UPDATE_PRIORITY;
|
|
485
|
+
/**
|
|
486
|
+
* Get the id of the ticker. This variable is used in the system to get the ticker by id, {@link RegisteredTickers.getInstance}
|
|
487
|
+
*/
|
|
488
|
+
id: TickerIdType;
|
|
489
|
+
/**
|
|
490
|
+
* The aliases of the canvas elements that are connected to this ticker
|
|
491
|
+
*/
|
|
492
|
+
canvasElementAliases: string[];
|
|
493
|
+
/**
|
|
494
|
+
* Completes the animation and applies the final state.
|
|
495
|
+
*/
|
|
496
|
+
complete: (options?: {
|
|
497
|
+
ignoreTickerSteps?: boolean;
|
|
498
|
+
}) => Promise<void> | void;
|
|
499
|
+
/**
|
|
500
|
+
* Stops the animation at its current state, and prevents it from resuming when the animation is played again.
|
|
501
|
+
*/
|
|
502
|
+
stop: () => void;
|
|
503
|
+
/**
|
|
504
|
+
* Starts the ticker. This will start the ticker and begin the animation.
|
|
505
|
+
* @param id The id of the ticker.
|
|
506
|
+
*/
|
|
507
|
+
start: (id: string) => void;
|
|
508
|
+
/**
|
|
509
|
+
* Pauses the animation.
|
|
510
|
+
*/
|
|
511
|
+
pause: () => void;
|
|
512
|
+
/**
|
|
513
|
+
* Plays the animation.
|
|
514
|
+
*/
|
|
515
|
+
play: () => void;
|
|
516
|
+
/**
|
|
517
|
+
* Checks if the ticker is paused.
|
|
518
|
+
* @returns true if the ticker is paused, false otherwise.
|
|
519
|
+
*/
|
|
520
|
+
readonly paused: boolean;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Is a decorator that register a ticker in the game.
|
|
525
|
+
* Is a required decorator for use the ticker in the game.
|
|
526
|
+
* Thanks to this decoration the game has the possibility of updating the tickers to the latest modification and saving the game.
|
|
527
|
+
* @param name is th identifier of the label, by default is the name of the class
|
|
528
|
+
* @returns
|
|
529
|
+
*/
|
|
530
|
+
declare function tickerDecorator(name?: TickerIdType): (target: {
|
|
531
|
+
new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker<any>;
|
|
532
|
+
}) => void;
|
|
533
|
+
declare namespace RegisteredTickers {
|
|
534
|
+
/**
|
|
535
|
+
* Register a ticker in the game.
|
|
536
|
+
* @param target The class of the ticker.
|
|
537
|
+
* @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
|
|
538
|
+
*/
|
|
539
|
+
function add(target: {
|
|
540
|
+
new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker<any>;
|
|
541
|
+
}, name?: TickerIdType): void;
|
|
542
|
+
/**
|
|
543
|
+
* Get a ticker by the id.
|
|
544
|
+
* @param canvasId The id of the ticker.
|
|
545
|
+
* @returns The ticker type.
|
|
546
|
+
*/
|
|
547
|
+
function get<T = Ticker<any>>(tickerId: TickerIdType): T | undefined;
|
|
548
|
+
/**
|
|
549
|
+
* Get a ticker instance by the id.
|
|
550
|
+
* @param tickerId The id of the ticker.
|
|
551
|
+
* @param args The arguments that you want to pass to the ticker.
|
|
552
|
+
* @param duration The duration of the ticker. If is undefined, the ticker will be called every frame.
|
|
553
|
+
* @param priority The priority of the ticker. If is undefined, the priority will be UPDATE_PRIORITY.NORMAL.
|
|
554
|
+
* @returns The instance of the ticker
|
|
555
|
+
*/
|
|
556
|
+
function getInstance<TArgs extends TickerArgs>(tickerId: TickerIdType, args: TArgs, duration?: number, priority?: UPDATE_PRIORITY): Ticker<TArgs> | undefined;
|
|
557
|
+
/**
|
|
558
|
+
* Get a list of all tickers registered.
|
|
559
|
+
* @returns An array of tickers.
|
|
560
|
+
*/
|
|
561
|
+
function values(): {
|
|
562
|
+
new (args: any, duration?: number, priority?: UPDATE_PRIORITY): Ticker<any>;
|
|
563
|
+
}[];
|
|
564
|
+
/**
|
|
565
|
+
* Check if a ticker is registered.
|
|
566
|
+
* @param id The id of the ticker.
|
|
567
|
+
* @returns True if the ticker is registered, false otherwise.
|
|
568
|
+
*/
|
|
569
|
+
function has(id: string): boolean;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
type ObjectSegmentWithTransition$1<O extends {} = {}> = [
|
|
573
|
+
O,
|
|
574
|
+
ObjectTarget<O>,
|
|
575
|
+
AnimationOptions$1 & At & {
|
|
576
|
+
ticker?: Ticker$1;
|
|
577
|
+
}
|
|
578
|
+
];
|
|
579
|
+
/**
|
|
580
|
+
* Animate a PixiJS component or components using [motion's animate](https://motion.dev/docs/animate) function.
|
|
581
|
+
* This function integrates with the PixiJS ticker to ensure smooth animations.
|
|
582
|
+
*
|
|
583
|
+
* Pixi’VN will **not** keep track of the animation state of this function (This feature is intended for animating PixiJS components used for UI.).
|
|
584
|
+
* If you want Pixi'VN to save the animation state in saves, use the {@link canvas.animate} function instead.
|
|
585
|
+
* @param components - The PixiJS component(s) to animate.
|
|
586
|
+
* @param keyframes - The keyframes to animate the component(s) with.
|
|
587
|
+
* @param options - Additional options for the animation, including duration, easing, and ticker.
|
|
588
|
+
* @returns An animation playback control object that can be used to start, stop, or control the animation.
|
|
589
|
+
* @template T - The type of PixiJS component(s) being animated.
|
|
590
|
+
*/
|
|
591
|
+
declare function animate<T extends {}>(components: T | T[], keyframes: ObjectTarget<T>, options?: AnimationOptions$1 & {
|
|
592
|
+
ticker?: Ticker$1;
|
|
593
|
+
}): AnimationPlaybackControlsWithThen;
|
|
594
|
+
/**
|
|
595
|
+
* Animate a sequence of PixiJS components with transitions using [motion's animate](https://motion.dev/docs/animate) function.
|
|
596
|
+
* This function allows for complex animations involving multiple components and transitions.
|
|
597
|
+
* It integrates with the PixiJS ticker to ensure smooth animations.
|
|
598
|
+
* This function is intended for animating PixiJS components used for UI.
|
|
599
|
+
*
|
|
600
|
+
* Pixi’VN will **not** keep track of the animation state of this function (This feature is intended for animating PixiJS components used for UI.).
|
|
601
|
+
* If you want Pixi'VN to save the animation state in saves, use the {@link canvas.animate} function instead
|
|
602
|
+
*
|
|
603
|
+
* @param sequence An array of segments to animate, where each segment is an array containing:
|
|
604
|
+
* - The PixiJS component to animate.
|
|
605
|
+
* - The keyframes to animate the component with.
|
|
606
|
+
* - An options object that can include animation options and a ticker.
|
|
607
|
+
* @param options Additional options for the sequence, such as duration and repeat count.
|
|
608
|
+
* @returns An animation playback control object that can be used to start, stop, or control the animation.
|
|
609
|
+
* @template T - The type of PixiJS component(s) being animated.
|
|
610
|
+
*/
|
|
611
|
+
declare function animate<T extends {}>(sequence: (ObjectSegment$1<T> | ObjectSegmentWithTransition$1<T>)[], options?: SequenceOptions$1): AnimationPlaybackControlsWithThen;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* TickerHistory is a class that contains the name of a class and the arguments that were used to create it.
|
|
615
|
+
*/
|
|
616
|
+
interface TickerInfo<TArgs extends TickerArgs> {
|
|
617
|
+
/**
|
|
618
|
+
* If this ticker was created by steps
|
|
619
|
+
*/
|
|
620
|
+
createdByTicketSteps?: {
|
|
621
|
+
canvasElementAlias: string;
|
|
622
|
+
id: string;
|
|
623
|
+
};
|
|
624
|
+
ticker: Ticker<TArgs>;
|
|
625
|
+
}
|
|
626
|
+
interface TickerHistory<TArgs extends TickerArgs> {
|
|
627
|
+
id: TickerIdType;
|
|
628
|
+
args: TArgs;
|
|
629
|
+
/**
|
|
630
|
+
* The aliases of the canvas elements that are connected to this ticker
|
|
631
|
+
*/
|
|
632
|
+
canvasElementAliases: string[];
|
|
633
|
+
priority?: UPDATE_PRIORITY;
|
|
634
|
+
duration?: number;
|
|
635
|
+
paused?: boolean;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
type PauseType = {
|
|
639
|
+
/**
|
|
640
|
+
* The type of the value
|
|
641
|
+
*/
|
|
642
|
+
type: "pause";
|
|
643
|
+
/**
|
|
644
|
+
* Duration in seconds
|
|
645
|
+
*/
|
|
646
|
+
duration: number;
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
type RepeatType = "repeat";
|
|
650
|
+
|
|
651
|
+
interface TickersStep<TArgs extends TickerArgs> {
|
|
652
|
+
/**
|
|
653
|
+
* Ticker class name
|
|
654
|
+
*/
|
|
655
|
+
ticker: string;
|
|
656
|
+
/**
|
|
657
|
+
* Duration in seconds. If is undefined, the step will end only when the animation is finished.
|
|
658
|
+
*/
|
|
659
|
+
duration?: number;
|
|
660
|
+
/**
|
|
661
|
+
* Arguments to pass to the ticker
|
|
662
|
+
*/
|
|
663
|
+
args: TArgs;
|
|
664
|
+
/**
|
|
665
|
+
* Priority of the ticker
|
|
666
|
+
*/
|
|
667
|
+
priority?: UPDATE_PRIORITY;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* The steps of the tickers
|
|
671
|
+
*/
|
|
672
|
+
interface TickersSequence {
|
|
673
|
+
/**
|
|
674
|
+
* The step number
|
|
675
|
+
*/
|
|
676
|
+
currentStepNumber: number;
|
|
677
|
+
/**
|
|
678
|
+
* The steps of the tickers
|
|
679
|
+
*/
|
|
680
|
+
steps: (TickersStep<any> | RepeatType | PauseType)[];
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
interface TickerTimeoutHistory {
|
|
684
|
+
aliases: string[];
|
|
685
|
+
ticker: string;
|
|
686
|
+
canBeDeletedBeforeEnd: boolean;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* @deprecated
|
|
691
|
+
*/
|
|
692
|
+
type RotateTickerProps = {
|
|
693
|
+
/**
|
|
694
|
+
* The speed of the rotation (360 degree per 10 second)
|
|
695
|
+
* @default 1
|
|
696
|
+
*/
|
|
697
|
+
speed?: number;
|
|
698
|
+
/**
|
|
699
|
+
* The direction of the rotation
|
|
700
|
+
* @default true
|
|
701
|
+
*/
|
|
702
|
+
clockwise?: boolean;
|
|
703
|
+
/**
|
|
704
|
+
* The limit of the rotation, is specified in degree
|
|
705
|
+
* @default undefined
|
|
706
|
+
*/
|
|
707
|
+
limit?: number;
|
|
708
|
+
/**
|
|
709
|
+
* The progression of the speed
|
|
710
|
+
*/
|
|
711
|
+
speedProgression?: TickerProgrationType;
|
|
712
|
+
} & CommonTickerProps;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* @deprecated
|
|
716
|
+
*/
|
|
717
|
+
type ZoomTickerProps = {
|
|
718
|
+
/**
|
|
719
|
+
* The speed of the zoom effect (100% zoom per 10 second)
|
|
720
|
+
* @default 10
|
|
721
|
+
*/
|
|
722
|
+
speed?: number | {
|
|
723
|
+
x: number;
|
|
724
|
+
y: number;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* The type of the zoom effect
|
|
728
|
+
* @default "zoom"
|
|
729
|
+
*/
|
|
730
|
+
type?: "zoom" | "unzoom";
|
|
731
|
+
/**
|
|
732
|
+
* The limit of the effect
|
|
733
|
+
* @default type === "zoom" ? Infinity : 0
|
|
734
|
+
*/
|
|
735
|
+
limit?: number | {
|
|
736
|
+
x: number;
|
|
737
|
+
y: number;
|
|
738
|
+
};
|
|
739
|
+
/**
|
|
740
|
+
* The progression of the speed.
|
|
741
|
+
* There are two types of progression: linear and exponential.
|
|
742
|
+
* - Linear: The speed will increase by the amount of `amt` every frame.
|
|
743
|
+
* - Exponential: The speed will increase by the percentage of the current speed every frame.
|
|
744
|
+
* @default undefined
|
|
745
|
+
*/
|
|
746
|
+
speedProgression?: TickerProgrationType;
|
|
747
|
+
/**
|
|
748
|
+
* Is a special prop used in the zoom in/out transition.
|
|
749
|
+
* @default false
|
|
750
|
+
*/
|
|
751
|
+
isZoomInOut?: {
|
|
752
|
+
pivot: {
|
|
753
|
+
x: number;
|
|
754
|
+
y: number;
|
|
755
|
+
};
|
|
756
|
+
position: {
|
|
757
|
+
x: number;
|
|
758
|
+
y: number;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
} & CommonTickerProps;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* This class is used to create a canvas element to add into a Pixi Application.
|
|
765
|
+
* You can use {@link canvas.add()} to add this element into the application.
|
|
766
|
+
* This class should be implemented and the memory method should be overridden.
|
|
767
|
+
* You must use the {@link canvasComponentDecorator} to register the canvas in the game.
|
|
768
|
+
* In Ren'Py is a displayable.
|
|
769
|
+
* @example
|
|
770
|
+
* ```typescript
|
|
771
|
+
* \@canvasComponentDecorator() // this is equivalent to canvasComponentDecorator("CanvasExample")
|
|
772
|
+
* export class CanvasExample extends Container implements CanvasBaseItem<ICanvasExampleMemory> {
|
|
773
|
+
* get memory(): ICanvasExampleMemory {
|
|
774
|
+
* return {
|
|
775
|
+
* pixivnId: "CanvasExample",
|
|
776
|
+
* // ... other properties
|
|
777
|
+
* }
|
|
778
|
+
* }
|
|
779
|
+
* set memory(value: ICanvasExampleMemory) {
|
|
780
|
+
* // ... set other properties
|
|
781
|
+
* }
|
|
782
|
+
* }
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
declare class CanvasBaseItem<T2 extends CanvasBaseItemMemory> {
|
|
786
|
+
/**
|
|
787
|
+
* This method return the memory of the canvas element.
|
|
788
|
+
*/
|
|
789
|
+
get memory(): T2;
|
|
790
|
+
/**
|
|
791
|
+
* This method set the memory of the canvas element.
|
|
792
|
+
*/
|
|
793
|
+
set memory(_value: T2);
|
|
794
|
+
/**
|
|
795
|
+
* This method set the memory of the canvas element. Is equivalent to the {@link CanvasBaseItem.memory} method, but this method is async.
|
|
796
|
+
*/
|
|
797
|
+
setMemory(_value: T2): Promise<void> | void;
|
|
798
|
+
/**
|
|
799
|
+
* Get the id of the canvas element. This variable is used in the system to get the canvas element by id, {@link getCanvasElementInstanceById}
|
|
800
|
+
*/
|
|
801
|
+
pixivnId: string;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Interface for the canvas base memory
|
|
806
|
+
*/
|
|
807
|
+
interface CanvasBaseItemMemory {
|
|
808
|
+
pixivnId: string;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
interface CanvasBaseInterface<T2 extends CanvasBaseItemMemory> extends CanvasBaseItem<T2>, Container$1 {
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
interface MotionComponentExtension {
|
|
815
|
+
pivot?: number;
|
|
816
|
+
pivotX?: number;
|
|
817
|
+
pivotY?: number;
|
|
818
|
+
scale?: number;
|
|
819
|
+
scaleX?: number;
|
|
820
|
+
scaleY?: number;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
type AnimationOptions = Omit<AnimationOptions$1, "onComplete" | "onPlay" | "onStop" | "onUpdate" | "onRepeat"> & Omit<CommonTickerProps, "startOnlyIfHaveTexture">;
|
|
824
|
+
|
|
825
|
+
type KeyframesType<T> = ObjectTarget<T> & MotionComponentExtension;
|
|
826
|
+
type AnimationSequenceOptions = Omit<AnimationOptions$1, "onComplete" | "onPlay" | "onStop" | "onUpdate" | "onRepeat">;
|
|
827
|
+
type SequenceOptions = SequenceOptions$1 & Omit<CommonTickerProps, "startOnlyIfHaveTexture">;
|
|
828
|
+
type ObjectSegment<O extends CanvasBaseInterface<any>> = [ObjectTarget<O>];
|
|
829
|
+
type ObjectSegmentWithTransition<O extends CanvasBaseInterface<any>> = [ObjectTarget<O>, AnimationOptions & At];
|
|
830
|
+
|
|
831
|
+
type PauseTickerType = {
|
|
832
|
+
/**
|
|
833
|
+
* Ticker ids excluded
|
|
834
|
+
*/
|
|
835
|
+
tickerIdsExcluded?: string[];
|
|
836
|
+
/**
|
|
837
|
+
* Ticker ids included
|
|
838
|
+
*/
|
|
839
|
+
tickerIdsIncluded?: string[];
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Interface exported canvas
|
|
844
|
+
*/
|
|
845
|
+
interface CanvasGameState {
|
|
846
|
+
tickers: {
|
|
847
|
+
[id: string]: TickerHistory<any>;
|
|
848
|
+
};
|
|
849
|
+
tickersSteps: {
|
|
850
|
+
[alias: string]: {
|
|
851
|
+
[tickerId: string]: TickersSequence;
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
elements: {
|
|
855
|
+
[alias: string]: CanvasBaseItemMemory;
|
|
856
|
+
};
|
|
857
|
+
stage: Partial<ContainerMemory>;
|
|
858
|
+
elementAliasesOrder: string[];
|
|
859
|
+
/**
|
|
860
|
+
* @deprecated
|
|
861
|
+
*/
|
|
862
|
+
tickersOnPause: {
|
|
863
|
+
[alias: string]: PauseTickerType;
|
|
864
|
+
};
|
|
865
|
+
tickersToCompleteOnStepEnd: {
|
|
866
|
+
tikersIds: {
|
|
867
|
+
id: string;
|
|
868
|
+
}[];
|
|
869
|
+
stepAlias: {
|
|
870
|
+
id: string;
|
|
871
|
+
alias: string;
|
|
872
|
+
}[];
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
interface CanvasManagerInterface {
|
|
877
|
+
/**
|
|
878
|
+
* The PIXI Application instance.
|
|
879
|
+
* It not recommended to use this property directly.
|
|
880
|
+
*/
|
|
881
|
+
readonly app: Application;
|
|
882
|
+
/**
|
|
883
|
+
* The PIXI Container that contains all the canvas elements.
|
|
884
|
+
*
|
|
885
|
+
*/
|
|
886
|
+
readonly gameLayer: Container$1;
|
|
887
|
+
/**
|
|
888
|
+
* If the manager is initialized.
|
|
889
|
+
*/
|
|
890
|
+
readonly isInitialized: boolean;
|
|
891
|
+
/**
|
|
892
|
+
* @deprecated Use {@link width} instead.
|
|
893
|
+
*/
|
|
894
|
+
canvasWidth: number;
|
|
895
|
+
/**
|
|
896
|
+
* The width of the canvas.
|
|
897
|
+
*/
|
|
898
|
+
width: number;
|
|
899
|
+
/**
|
|
900
|
+
* @deprecated Use {@link height} instead.
|
|
901
|
+
*/
|
|
902
|
+
canvasHeight: number;
|
|
903
|
+
/**
|
|
904
|
+
* The height of the canvas.
|
|
905
|
+
*/
|
|
906
|
+
height: number;
|
|
907
|
+
/**
|
|
908
|
+
* The screen of the canvas ({@link Application.screen}).
|
|
909
|
+
*/
|
|
910
|
+
readonly screen: Rectangle;
|
|
911
|
+
/**
|
|
912
|
+
* Initialize the PixiJS Application and the interface div.
|
|
913
|
+
* This method should be called before any other method.
|
|
914
|
+
* @param element The html element where I will put the canvas. Example: document.body
|
|
915
|
+
* @param width The width of the canvas
|
|
916
|
+
* @param height The height of the canvas
|
|
917
|
+
* @param options The options of PixiJS Application
|
|
918
|
+
* @param devtoolsOptions The options of the devtools. You can read more about it in the [PixiJS Devtools documentation](https://pixijs.io/devtools/docs/plugin/)
|
|
919
|
+
* @example
|
|
920
|
+
* ```typescript
|
|
921
|
+
* const body = document.body
|
|
922
|
+
* if (!body) {
|
|
923
|
+
* throw new Error('body element not found')
|
|
924
|
+
* }
|
|
925
|
+
* await canvas.init(body, {
|
|
926
|
+
* width: 1920,
|
|
927
|
+
* height: 1080,
|
|
928
|
+
* backgroundColor: "#303030"
|
|
929
|
+
* })
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
init(element: HTMLElement, options: Partial<ApplicationOptions> & {
|
|
933
|
+
width: number;
|
|
934
|
+
height: number;
|
|
935
|
+
}, devtoolsOptions?: Devtools): Promise<void>;
|
|
936
|
+
/**
|
|
937
|
+
* The children of the canvas.
|
|
938
|
+
*/
|
|
939
|
+
readonly children: ContainerChild$1[];
|
|
940
|
+
/**
|
|
941
|
+
* Copy the properties of an old canvas element to a new canvas element.
|
|
942
|
+
* @param oldAlias Old alias
|
|
943
|
+
* @param newAlias New alias
|
|
944
|
+
* @returns
|
|
945
|
+
*/
|
|
946
|
+
copyCanvasElementProperty<T extends CanvasBaseItemMemory>(oldAlias: T | CanvasBaseInterface<T> | string, newAlias: CanvasBaseInterface<T> | string): Promise<void>;
|
|
947
|
+
/**
|
|
948
|
+
* Transfer the tickers from an old alias to a new alias.
|
|
949
|
+
* @param oldAlias Old alias
|
|
950
|
+
* @param newAlias New alias
|
|
951
|
+
* @param mode If "move", the old alias will be removed from the ticker. If "duplicate", the old alias will be kept in the ticker.
|
|
952
|
+
*/
|
|
953
|
+
transferTickers(oldAlias: string, newAlias: string, mode?: "move" | "duplicate"): void;
|
|
954
|
+
/**
|
|
955
|
+
* Add a canvas element to the canvas.
|
|
956
|
+
* If there is a canvas element with the same alias, all "style", zIndex, and {@link TickerBase} will be transferred to the new canvas element,
|
|
957
|
+
* and the old canvas element will be removed.
|
|
958
|
+
* @param alias The alias of the canvas element.
|
|
959
|
+
* @param canvasComponent The canvas elements to be added.
|
|
960
|
+
* @param options The options of the canvas element.
|
|
961
|
+
* @example
|
|
962
|
+
* ```typescript
|
|
963
|
+
* const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
|
|
964
|
+
* const sprite = Sprite.from(texture);
|
|
965
|
+
* canvas.add("bunny", sprite);
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
add(alias: string, canvasComponent: CanvasBaseInterface<any>, options?: {
|
|
969
|
+
/**
|
|
970
|
+
* If there is a canvas element with the same alias, the "style" of the old canvas element will be imported to the new canvas element.
|
|
971
|
+
* @default false
|
|
972
|
+
*/
|
|
973
|
+
ignoreOldStyle?: boolean;
|
|
974
|
+
/**
|
|
975
|
+
* The zIndex of the canvas element.
|
|
976
|
+
* @default undefined
|
|
977
|
+
*/
|
|
978
|
+
zIndex?: number;
|
|
979
|
+
}): void;
|
|
980
|
+
/**
|
|
981
|
+
* Remove a canvas element from the canvas.
|
|
982
|
+
* And remove all tickers that are not connected to any canvas element.
|
|
983
|
+
* @param alias The alias of the canvas element to be removed.
|
|
984
|
+
* @param options The options of the canvas element.
|
|
985
|
+
* @returns
|
|
986
|
+
* @example
|
|
987
|
+
* ```typescript
|
|
988
|
+
* canvas.remove("bunny");
|
|
989
|
+
* ```
|
|
990
|
+
*/
|
|
991
|
+
remove(alias: string | string[], options?: {
|
|
992
|
+
/**
|
|
993
|
+
* If true, the tickers that are connected to the canvas element will not be removed.
|
|
994
|
+
* @default false
|
|
995
|
+
*/
|
|
996
|
+
ignoreTickers?: boolean;
|
|
997
|
+
}): void;
|
|
998
|
+
/**
|
|
999
|
+
* Get a canvas element by the alias.
|
|
1000
|
+
* @param alias The alias of the canvas element.
|
|
1001
|
+
* @returns The canvas element.
|
|
1002
|
+
* @example
|
|
1003
|
+
* ```typescript
|
|
1004
|
+
* const sprite = canvas.find<Sprite>("bunny");
|
|
1005
|
+
* ```
|
|
1006
|
+
*/
|
|
1007
|
+
find<T extends CanvasBaseInterface<any>>(alias: string): T | undefined;
|
|
1008
|
+
/**
|
|
1009
|
+
* Check if a DisplayObject is on the canvas.
|
|
1010
|
+
* @param pixiElement The DisplayObject to be checked.
|
|
1011
|
+
* @returns If the DisplayObject is on the canvas.
|
|
1012
|
+
*/
|
|
1013
|
+
canvasElementIsOnCanvas<T extends Container$1>(pixiElement: T): boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Remove all canvas elements from the canvas.
|
|
1016
|
+
*/
|
|
1017
|
+
removeAll(): void;
|
|
1018
|
+
/**
|
|
1019
|
+
* Edit the alias of a canvas element. The tickers that are connected to the canvas element will be transferred.
|
|
1020
|
+
* @param oldAlias The old alias of the canvas element.
|
|
1021
|
+
* @param newAlias The new alias of the canvas element.
|
|
1022
|
+
* @param options The options of the canvas element.
|
|
1023
|
+
*/
|
|
1024
|
+
editAlias(oldAlias: string, newAlias: string, options?: {
|
|
1025
|
+
/**
|
|
1026
|
+
* If true, the tickers that are connected to the canvas element will not be transferred.
|
|
1027
|
+
* @default false
|
|
1028
|
+
*/
|
|
1029
|
+
ignoreTickers?: boolean;
|
|
1030
|
+
}): void;
|
|
1031
|
+
/** Edit Tickers Methods */
|
|
1032
|
+
/**
|
|
1033
|
+
* Currently tickers that are running.
|
|
1034
|
+
*/
|
|
1035
|
+
readonly currentTickers: {
|
|
1036
|
+
[id: string]: TickerInfo<any>;
|
|
1037
|
+
};
|
|
1038
|
+
/**
|
|
1039
|
+
* The steps of the tickers
|
|
1040
|
+
*/
|
|
1041
|
+
readonly currentTickersSteps: {
|
|
1042
|
+
[alias: string]: {
|
|
1043
|
+
[tickerId: string]: TickersSequence;
|
|
1044
|
+
};
|
|
1045
|
+
};
|
|
1046
|
+
/**
|
|
1047
|
+
* Find a ticker by its id.
|
|
1048
|
+
* @param tickerId The id of the ticker.
|
|
1049
|
+
* @param args The args of the ticker.
|
|
1050
|
+
* @returns The ticker if found, undefined otherwise.
|
|
1051
|
+
*/
|
|
1052
|
+
findTicker<TArgs extends TickerArgs>(tickerId: string, args?: TArgs): Ticker<TArgs> | undefined;
|
|
1053
|
+
/**
|
|
1054
|
+
* Run a ticker. You can run multiple addTicker with the same alias and different tickerClasses.
|
|
1055
|
+
* If you run a ticker with the same alias and tickerClass, the old ticker will be removed.
|
|
1056
|
+
* If already exists a sequence of tickers with the same alias, it will be removed.
|
|
1057
|
+
* @param canvasElementAlias The alias of the canvas element that will use the ticker.
|
|
1058
|
+
* @param ticker The ticker class to be run.
|
|
1059
|
+
* @returns The id of the ticker.
|
|
1060
|
+
* @example
|
|
1061
|
+
* ```typescript
|
|
1062
|
+
* canvas.addTicker("alien", new RotateTicker({ speed: 0.2 }))
|
|
1063
|
+
* ```
|
|
1064
|
+
*/
|
|
1065
|
+
addTicker<TArgs extends TickerArgs>(canvasElementAlias: string | string[], ticker: Ticker<TArgs>): string | undefined;
|
|
1066
|
+
/**
|
|
1067
|
+
* Run a sequence of tickers.
|
|
1068
|
+
* @param alias The alias of canvas element that will use the tickers.
|
|
1069
|
+
* @param steps The steps of the tickers.
|
|
1070
|
+
* @param currentStepNumber The current step number. It is used to continue the sequence of tickers.
|
|
1071
|
+
* @returns The id of tickers.
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```typescript
|
|
1074
|
+
* canvas.addTickersSequence("alien", [
|
|
1075
|
+
* new RotateTicker({ speed: 0.1, clockwise: true }, 2), // 2 seconds
|
|
1076
|
+
* Pause(1), // 1 second
|
|
1077
|
+
* new RotateTicker({ speed: 0.2, clockwise: false }, 2),
|
|
1078
|
+
* Repeat,
|
|
1079
|
+
* ])
|
|
1080
|
+
* ```
|
|
1081
|
+
*/
|
|
1082
|
+
addTickersSequence(alias: string, steps: (Ticker<any> | RepeatType | PauseType)[], currentStepNumber?: number): string | undefined;
|
|
1083
|
+
/**
|
|
1084
|
+
* Remove a connection between a canvas element and a ticker.
|
|
1085
|
+
* And remove the ticker if there is no canvas element connected to it.
|
|
1086
|
+
* @param alias The alias of the canvas element that will use the ticker.
|
|
1087
|
+
* @param ticker The ticker class to be removed.
|
|
1088
|
+
* @example
|
|
1089
|
+
* ```typescript
|
|
1090
|
+
* canvas.unlinkComponentFromTicker("alien", RotateTicker)
|
|
1091
|
+
* ```
|
|
1092
|
+
* @deprecated
|
|
1093
|
+
*/
|
|
1094
|
+
unlinkComponentFromTicker(alias: string | string[], ticker?: {
|
|
1095
|
+
new (): Ticker<any>;
|
|
1096
|
+
} | string): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* Remove all tickers from the canvas.
|
|
1099
|
+
*/
|
|
1100
|
+
removeAllTickers(): void;
|
|
1101
|
+
/**
|
|
1102
|
+
* Remove a ticker by the id.
|
|
1103
|
+
* @param tickerId The id of the ticker.
|
|
1104
|
+
*/
|
|
1105
|
+
removeTicker(tickerId: string | string[]): void;
|
|
1106
|
+
/**
|
|
1107
|
+
* Pause a ticker. If a paused ticker have a time to be removed, it will be removed after the time.
|
|
1108
|
+
* @param filters The filters to pause the ticker.
|
|
1109
|
+
* @returns The ids of the paused tickers.
|
|
1110
|
+
*/
|
|
1111
|
+
pauseTicker(filters: {
|
|
1112
|
+
/**
|
|
1113
|
+
* The alias of the canvas element that will use the ticker.
|
|
1114
|
+
* Will pause all tickers that are connected to this canvas element.
|
|
1115
|
+
*/
|
|
1116
|
+
canvasAlias: string;
|
|
1117
|
+
/**
|
|
1118
|
+
* Ticker ids excluded from the pause. If not provided, all tickers will be paused.
|
|
1119
|
+
*/
|
|
1120
|
+
tickerIdsExcluded?: string[];
|
|
1121
|
+
} | {
|
|
1122
|
+
/**
|
|
1123
|
+
* The id of the ticker to be paused. If provided, only this ticker will be paused.
|
|
1124
|
+
*/
|
|
1125
|
+
id: string | string[];
|
|
1126
|
+
}): string[];
|
|
1127
|
+
/**
|
|
1128
|
+
* Resume a ticker.
|
|
1129
|
+
* @param filters The filters to resume the ticker.
|
|
1130
|
+
*/
|
|
1131
|
+
resumeTicker(filters: {
|
|
1132
|
+
/**
|
|
1133
|
+
* The alias of the canvas element that will use the ticker.
|
|
1134
|
+
* Will resume all tickers that are connected to this canvas element.
|
|
1135
|
+
*/
|
|
1136
|
+
canvasAlias: string;
|
|
1137
|
+
} | {
|
|
1138
|
+
/**
|
|
1139
|
+
* The id of the ticker to be resumed. If provided, only this ticker will be resumed.
|
|
1140
|
+
*/
|
|
1141
|
+
id: string | string[];
|
|
1142
|
+
}): void;
|
|
1143
|
+
/**
|
|
1144
|
+
* Check if a ticker is paused.
|
|
1145
|
+
* @param alias The alias of the canvas element that will use the ticker.
|
|
1146
|
+
* @param tickerId The ticker that will be checked.
|
|
1147
|
+
* @returns If the ticker is paused.
|
|
1148
|
+
*/
|
|
1149
|
+
isTickerPaused(alias: string, tickerId?: string): boolean;
|
|
1150
|
+
/**
|
|
1151
|
+
* Add a ticker that must be completed before the next step.
|
|
1152
|
+
* This method is used for example into a transition between scenes.
|
|
1153
|
+
* @param step The step that the ticker must be completed before the next step.
|
|
1154
|
+
*/
|
|
1155
|
+
completeTickerOnStepEnd(step: {
|
|
1156
|
+
/**
|
|
1157
|
+
* The id of the step.
|
|
1158
|
+
*/
|
|
1159
|
+
id: string;
|
|
1160
|
+
/**
|
|
1161
|
+
* If is a sequence of tickers, the alias of the sequence of tickers.
|
|
1162
|
+
*/
|
|
1163
|
+
alias?: string;
|
|
1164
|
+
}): void;
|
|
1165
|
+
/**
|
|
1166
|
+
* This method force the completion of the tickers that are running.
|
|
1167
|
+
* This funcions is called in the next step.
|
|
1168
|
+
* @param id The id of the ticker. If the alias provided, the id is the id of the sequence of tickers.
|
|
1169
|
+
* @param alias The alias of the sequence of tickers.
|
|
1170
|
+
*/
|
|
1171
|
+
forceCompletionOfTicker(id: string, alias?: string): Promise<void>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Animate a Pixi’VN component or components using [motion's animate](https://motion.dev/docs/animate) function.
|
|
1174
|
+
* This function integrates with the PixiJS ticker to ensure smooth animations.
|
|
1175
|
+
*
|
|
1176
|
+
* Pixi’VN will keep track of the animation state of this function.
|
|
1177
|
+
* So Pixi’VN will save the animation state in saves.
|
|
1178
|
+
* @param components - The PixiJS component(s) to animate.
|
|
1179
|
+
* @param keyframes - The keyframes to animate the component(s) with.
|
|
1180
|
+
* @param options - Additional options for the animation, including duration, easing, and ticker.
|
|
1181
|
+
* @param priority - The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
1182
|
+
* @returns The id of tickers.
|
|
1183
|
+
* @template T - The type of Pixi’VN component(s) being animated.
|
|
1184
|
+
*/
|
|
1185
|
+
animate<T extends CanvasBaseInterface<any>>(components: T | string | (string | T)[], keyframes: KeyframesType<T>, options?: AnimationOptions, priority?: UPDATE_PRIORITY): string | undefined;
|
|
1186
|
+
/**
|
|
1187
|
+
* Animate a Pixi’VN component or components using [motion's animate](https://motion.dev/docs/animate) function.
|
|
1188
|
+
* This function integrates with the PixiJS ticker to ensure smooth animations.
|
|
1189
|
+
*
|
|
1190
|
+
* Pixi’VN will keep track of the animation state of this function.
|
|
1191
|
+
* So Pixi’VN will save the animation state in saves.
|
|
1192
|
+
* @param components - The PixiJS component(s) to animate.
|
|
1193
|
+
* @param sequence - The sequence of keyframes to animate the component(s) with.
|
|
1194
|
+
* @param options - Additional options for the animation, including duration, easing, and ticker.
|
|
1195
|
+
* @param priority - The priority of the ticker. @default UPDATE_PRIORITY.NORMAL
|
|
1196
|
+
* @returns The id of tickers.
|
|
1197
|
+
* @template T - The type of Pixi’VN component(s) being animated.
|
|
1198
|
+
*/
|
|
1199
|
+
animate<T extends CanvasBaseInterface<any>>(components: T | string, sequence: (ObjectSegment<T> | ObjectSegmentWithTransition<T>)[], options?: SequenceOptions, priority?: UPDATE_PRIORITY): string | undefined;
|
|
1200
|
+
/**
|
|
1201
|
+
* Add a layer to the canvas.
|
|
1202
|
+
* @param label The label of the layer.
|
|
1203
|
+
* @param layer The layer to be added.
|
|
1204
|
+
* @returns The layer.
|
|
1205
|
+
* @example
|
|
1206
|
+
* ```typescript
|
|
1207
|
+
* const uiLayer = new Container();
|
|
1208
|
+
* canvas.addLayer("ui", uiLayer);
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
addLayer(label: string, layer: Container$1): Layer | undefined;
|
|
1212
|
+
/**
|
|
1213
|
+
* Get a layer from the canvas.
|
|
1214
|
+
* @param label The label of the layer.
|
|
1215
|
+
* @returns The layer.
|
|
1216
|
+
* @example
|
|
1217
|
+
* ```typescript
|
|
1218
|
+
* const uiLayer = canvas.getLayer("ui");
|
|
1219
|
+
* ```
|
|
1220
|
+
*/
|
|
1221
|
+
getLayer(label: string): Layer | null;
|
|
1222
|
+
/**
|
|
1223
|
+
* Remove a layer from the canvas.
|
|
1224
|
+
* @param label The label of the layer to be removed.
|
|
1225
|
+
* @example
|
|
1226
|
+
* ```typescript
|
|
1227
|
+
* canvas.removeLayer("ui");
|
|
1228
|
+
* ```
|
|
1229
|
+
*/
|
|
1230
|
+
removeLayer(label: string): void;
|
|
1231
|
+
/**
|
|
1232
|
+
* Add a HTML layer to the canvas.
|
|
1233
|
+
* @param id The id of the layer.
|
|
1234
|
+
* @param element The html element to be added.
|
|
1235
|
+
* @param style The style of the layer. @default { position: "absolute", pointerEvents: "none" }.
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```tsx
|
|
1238
|
+
* const root = document.getElementById('root')
|
|
1239
|
+
* if (!root) {
|
|
1240
|
+
* throw new Error('root element not found')
|
|
1241
|
+
* }
|
|
1242
|
+
* const htmlLayer = canvas.addHtmlLayer("ui", root, {
|
|
1243
|
+
* position: "absolute",
|
|
1244
|
+
* pointerEvents: "none"
|
|
1245
|
+
* })
|
|
1246
|
+
* const reactRoot = createRoot(htmlLayer)
|
|
1247
|
+
* reactRoot.render(
|
|
1248
|
+
* <App />
|
|
1249
|
+
* )
|
|
1250
|
+
* ```
|
|
1251
|
+
*/
|
|
1252
|
+
addHtmlLayer(id: string, element: HTMLElement, style?: Pick<CSSStyleDeclaration, "position" | "pointerEvents">): HTMLDivElement;
|
|
1253
|
+
/**
|
|
1254
|
+
* Get a HTML layer from the canvas.
|
|
1255
|
+
* @param id The id of the layer to be removed.
|
|
1256
|
+
*/
|
|
1257
|
+
removeHtmlLayer(id: string): void;
|
|
1258
|
+
/**
|
|
1259
|
+
* Get a HTML layer from the canvas.
|
|
1260
|
+
* @param id The id of the layer.
|
|
1261
|
+
*/
|
|
1262
|
+
getHtmlLayer(id: string): HTMLElement | undefined;
|
|
1263
|
+
/**
|
|
1264
|
+
* Extract the canvas as an image.
|
|
1265
|
+
* @returns The image as a base64 string.
|
|
1266
|
+
*/
|
|
1267
|
+
extractImage(): Promise<string>;
|
|
1268
|
+
/**
|
|
1269
|
+
* Clear the canvas and the tickers.
|
|
1270
|
+
*/
|
|
1271
|
+
clear(): void;
|
|
1272
|
+
/**
|
|
1273
|
+
* Export the canvas and the tickers to an object.
|
|
1274
|
+
* @returns The object.
|
|
1275
|
+
*/
|
|
1276
|
+
export(): CanvasGameState;
|
|
1277
|
+
/**
|
|
1278
|
+
* Restore the canvas and the tickers from an object.
|
|
1279
|
+
* @param data The object.
|
|
1280
|
+
*/
|
|
1281
|
+
restore(data: object): Promise<void>;
|
|
1282
|
+
/**
|
|
1283
|
+
* @deprecated Use {@link onTickerComplete}
|
|
1284
|
+
*/
|
|
1285
|
+
onEndOfTicker(tickerId: string, options: {
|
|
1286
|
+
aliasToRemoveAfter: string[];
|
|
1287
|
+
tickerAliasToResume: string[];
|
|
1288
|
+
tickerIdToResume: string[];
|
|
1289
|
+
ignoreTickerSteps?: boolean;
|
|
1290
|
+
}): void;
|
|
1291
|
+
onTickerComplete(tickerId: string, options: {
|
|
1292
|
+
aliasToRemoveAfter: string[];
|
|
1293
|
+
tickerAliasToResume: string[];
|
|
1294
|
+
tickerIdToResume: string[];
|
|
1295
|
+
ignoreTickerSteps?: boolean;
|
|
1296
|
+
stopTicker?: boolean;
|
|
1297
|
+
}): void;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
interface AdditionalPositionsExtensionProps {
|
|
1301
|
+
/**
|
|
1302
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1303
|
+
* For example:
|
|
1304
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1305
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1306
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1307
|
+
*
|
|
1308
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1309
|
+
*/
|
|
1310
|
+
align?: Partial<PointData> | number;
|
|
1311
|
+
/**
|
|
1312
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1313
|
+
* For example:
|
|
1314
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1315
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1316
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1317
|
+
*
|
|
1318
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1319
|
+
*/
|
|
1320
|
+
xAlign?: number;
|
|
1321
|
+
/**
|
|
1322
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1323
|
+
* For example:
|
|
1324
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1325
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1326
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1327
|
+
*
|
|
1328
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1329
|
+
*/
|
|
1330
|
+
yAlign?: number;
|
|
1331
|
+
/**
|
|
1332
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1333
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1334
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1335
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1336
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1337
|
+
*
|
|
1338
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1339
|
+
*/
|
|
1340
|
+
percentagePosition?: Partial<PointData> | number;
|
|
1341
|
+
/**
|
|
1342
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1343
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1344
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1345
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1346
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1347
|
+
*
|
|
1348
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1349
|
+
*/
|
|
1350
|
+
percentageX?: number;
|
|
1351
|
+
/**
|
|
1352
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1353
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1354
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1355
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1356
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1357
|
+
*
|
|
1358
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1359
|
+
*/
|
|
1360
|
+
percentageY?: number;
|
|
1361
|
+
/**
|
|
1362
|
+
* @deprecated Use {@link align} instead.
|
|
1363
|
+
*/
|
|
1364
|
+
xPercentagePosition?: number;
|
|
1365
|
+
/**
|
|
1366
|
+
* @deprecated Use {@link align} instead.
|
|
1367
|
+
*/
|
|
1368
|
+
yPercentagePosition?: number;
|
|
1369
|
+
}
|
|
1370
|
+
declare class AdditionalPositionsExtension {
|
|
1371
|
+
/**
|
|
1372
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1373
|
+
* For example:
|
|
1374
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1375
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1376
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1377
|
+
*
|
|
1378
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1379
|
+
*/
|
|
1380
|
+
set align(_value: Partial<PointData> | number);
|
|
1381
|
+
get align(): Partial<PointData> | number;
|
|
1382
|
+
/**
|
|
1383
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1384
|
+
* For example:
|
|
1385
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1386
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1387
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1388
|
+
*
|
|
1389
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1390
|
+
*/
|
|
1391
|
+
set xAlign(_value: number);
|
|
1392
|
+
get xAlign(): number;
|
|
1393
|
+
/**
|
|
1394
|
+
* is a way to set the position of the element in the canvas. compared to position, align, it is a percentage used to determine the proximity from the edges of the canvas.
|
|
1395
|
+
* For example:
|
|
1396
|
+
* - if you set align to 0.5, the element will be in the center of the canvas.
|
|
1397
|
+
* - if you set align to 0, the left end and a top end of the element will be in the left end and top end of the canvas.
|
|
1398
|
+
* - if you set align to 1, the right end and a bottom end of the element will be in the right end and bottom end of the canvas.
|
|
1399
|
+
*
|
|
1400
|
+
* **Important:** The {@link PixiContainer.pivot} field does not affect the alignment.
|
|
1401
|
+
*/
|
|
1402
|
+
set yAlign(_value: number);
|
|
1403
|
+
get yAlign(): number;
|
|
1404
|
+
/**
|
|
1405
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1406
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1407
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1408
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1409
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1410
|
+
*
|
|
1411
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1412
|
+
*/
|
|
1413
|
+
set percentagePosition(_value: Partial<PointData> | number);
|
|
1414
|
+
get percentagePosition(): Partial<PointData> | number;
|
|
1415
|
+
/**
|
|
1416
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1417
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1418
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1419
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1420
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1421
|
+
*
|
|
1422
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1423
|
+
*/
|
|
1424
|
+
set percentageX(_value: number);
|
|
1425
|
+
get percentageX(): number;
|
|
1426
|
+
/**
|
|
1427
|
+
* @deprecated Use {@link align} instead.
|
|
1428
|
+
*/
|
|
1429
|
+
set xPercentagePosition(_value: number);
|
|
1430
|
+
get xPercentagePosition(): number;
|
|
1431
|
+
/**
|
|
1432
|
+
* is a way to set the position of the element in the canvas calculated in percentage.
|
|
1433
|
+
* For example, if you set the {@link PixiContainer.pivot} to 0.5, and:
|
|
1434
|
+
* - if you set percentagePosition to 0.5, the element will be in the center of the canvas.
|
|
1435
|
+
* - If you set percentagePosition to 0, the center of the element will be in the left end and top end of the canvas.
|
|
1436
|
+
* - If you set percentagePosition to 1, the center of the element will be in the right end and bottom end of the canvas.
|
|
1437
|
+
*
|
|
1438
|
+
* **Important:** The {@link PixiContainer.pivot} field does affect the percentagePosition.
|
|
1439
|
+
*/
|
|
1440
|
+
set percentageY(_value: number);
|
|
1441
|
+
get percentageY(): number;
|
|
1442
|
+
/**
|
|
1443
|
+
* @deprecated Use {@link align} instead.
|
|
1444
|
+
*/
|
|
1445
|
+
set yPercentagePosition(_value: number);
|
|
1446
|
+
get yPercentagePosition(): number;
|
|
1447
|
+
get positionType(): "pixel" | "percentage" | "align";
|
|
1448
|
+
get positionInfo(): {
|
|
1449
|
+
x: number;
|
|
1450
|
+
y: number;
|
|
1451
|
+
type: "pixel" | "percentage" | "align";
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
interface AnchorExtensionProps {
|
|
1456
|
+
anchor?: PointData | number;
|
|
1457
|
+
}
|
|
1458
|
+
declare class AnchorExtension extends Container$1 {
|
|
1459
|
+
/**
|
|
1460
|
+
* The anchor sets the origin point of the imageContainer. The default value is taken from the {@link Texture}
|
|
1461
|
+
* and passed to the constructor.
|
|
1462
|
+
*
|
|
1463
|
+
* The default is `(0,0)`, this means the imageContainer's origin is the top left.
|
|
1464
|
+
*
|
|
1465
|
+
* Setting the anchor to `(0.5,0.5)` means the imageContainer's origin is centered.
|
|
1466
|
+
*
|
|
1467
|
+
* Setting the anchor to `(1,1)` would mean the imageContainer's origin point will be the bottom right corner.
|
|
1468
|
+
*
|
|
1469
|
+
* If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
|
|
1470
|
+
* @example
|
|
1471
|
+
* import { ImageContainer } from '@drincs/pixi-vn';
|
|
1472
|
+
*
|
|
1473
|
+
* const imageContainer = new ImageContainer();
|
|
1474
|
+
* imageContainer.anchor = 0.5;
|
|
1475
|
+
*/
|
|
1476
|
+
get anchor(): PointData;
|
|
1477
|
+
set anchor(_value: PointData | number);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
type ContainerChild = Container$1 & CanvasBaseItem<any>;
|
|
1481
|
+
|
|
1482
|
+
interface SpriteOptions extends Omit<SpriteOptions$1, "on"> {
|
|
1483
|
+
/**
|
|
1484
|
+
* Add a listener for a given event.
|
|
1485
|
+
* Unlike {@link onEvent}, this method does **not track the event association in the current game state**, so it will not be included in saves.
|
|
1486
|
+
*/
|
|
1487
|
+
on?: <T extends EventEmitter.EventNames<string | symbol>>(event: T, fn: EventEmitter.EventListener<string | symbol, T>, context?: any) => this;
|
|
1488
|
+
}
|
|
1489
|
+
interface TextOptions extends Omit<TextOptions$1, "on"> {
|
|
1490
|
+
/**
|
|
1491
|
+
* Add a listener for a given event.
|
|
1492
|
+
* Unlike {@link onEvent}, this method does **not track the event association in the current game state**, so it will not be included in saves.
|
|
1493
|
+
*/
|
|
1494
|
+
on?: <T extends EventEmitter.EventNames<string | symbol>>(event: T, fn: EventEmitter.EventListener<string | symbol, T>, context?: any) => this;
|
|
1495
|
+
}
|
|
1496
|
+
interface ImageContainerOptions<C extends ContainerChild = ContainerChild> extends ContainerOptions<C>, AnchorExtensionProps, AdditionalPositionsExtensionProps {
|
|
1497
|
+
}
|
|
1498
|
+
interface ImageSpriteOptions extends SpriteOptions, AdditionalPositionsExtensionProps {
|
|
1499
|
+
}
|
|
1500
|
+
interface VideoSpriteOptions extends ImageSpriteOptions {
|
|
1501
|
+
loop?: boolean;
|
|
1502
|
+
paused?: boolean;
|
|
1503
|
+
currentTime?: number;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
type EventIdType = string;
|
|
1507
|
+
|
|
1508
|
+
/**
|
|
1509
|
+
* Interface for texture memory
|
|
1510
|
+
*/
|
|
1511
|
+
interface TextureMemory {
|
|
1512
|
+
/**
|
|
1513
|
+
* @deprecated
|
|
1514
|
+
*/
|
|
1515
|
+
image?: string;
|
|
1516
|
+
alias?: string;
|
|
1517
|
+
url: string;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
interface SpriteBaseMemory extends SpriteOptions$1, CanvasBaseItemMemory {
|
|
1521
|
+
/**
|
|
1522
|
+
* @deprecated
|
|
1523
|
+
*/
|
|
1524
|
+
textureImage?: TextureMemory;
|
|
1525
|
+
textureData: TextureMemory;
|
|
1526
|
+
onEvents: {
|
|
1527
|
+
[name: string]: EventIdType;
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Interface for the canvas sprite memory
|
|
1532
|
+
*/
|
|
1533
|
+
interface SpriteMemory extends SpriteBaseMemory {
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* The memory of the image. It uses for save the state of the image.
|
|
1538
|
+
*/
|
|
1539
|
+
interface ImageSpriteMemory extends SpriteBaseMemory, AdditionalPositionsExtensionProps {
|
|
1540
|
+
/**
|
|
1541
|
+
* @deprecated use SpriteBaseMemory.textureAlias
|
|
1542
|
+
*/
|
|
1543
|
+
imageLink?: string;
|
|
1544
|
+
loadIsStarted: boolean;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* The memory of the video. It uses for save the state of the video.
|
|
1549
|
+
*/
|
|
1550
|
+
interface VideoSpriteMemory extends ImageSpriteMemory {
|
|
1551
|
+
loop: boolean;
|
|
1552
|
+
paused: boolean;
|
|
1553
|
+
currentTime: number;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* CanvasEventNamesType is a type that is used to define the event names for the canvas.
|
|
1558
|
+
*/
|
|
1559
|
+
type CanvasEventNamesType = keyof AllFederatedEventMap;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* CanvasEvent is a class that is used to create a pixi event, and connect it to a canvas element, with on().
|
|
1563
|
+
* This class should be extended and the fn method should be overridden.
|
|
1564
|
+
* You must use the {@link eventDecorator} to register the event in the game.
|
|
1565
|
+
* @example
|
|
1566
|
+
* ```typescript
|
|
1567
|
+
* \@eventDecorator() // this is equivalent to eventDecorator("EventTest")
|
|
1568
|
+
* export class EventTest extends CanvasEvent<Sprite> {
|
|
1569
|
+
* override fn(event: CanvasEventNamesType, sprite: Sprite): void {
|
|
1570
|
+
* if (event === 'pointerdown') {
|
|
1571
|
+
* sprite.scale.x *= 1.25;
|
|
1572
|
+
* sprite.scale.y *= 1.25;
|
|
1573
|
+
* }
|
|
1574
|
+
* }
|
|
1575
|
+
* }
|
|
1576
|
+
* ```
|
|
1577
|
+
*/
|
|
1578
|
+
declare class CanvasEvent<C> {
|
|
1579
|
+
constructor();
|
|
1580
|
+
fn(_event: CanvasEventNamesType, _element: C): void;
|
|
1581
|
+
/**
|
|
1582
|
+
* Get the id of the event. This variable is used in the system to get the event by id, {@link RegisteredEvents.getInstance}.
|
|
1583
|
+
*/
|
|
1584
|
+
id: EventIdType;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
/**
|
|
1588
|
+
* This class is a extension of the [PIXI.Sprite class](https://pixijs.com/8.x/examples/sprite/basic), it has the same properties and methods,
|
|
1589
|
+
* but it has the ability to be saved and loaded by the Pixi’VN library.
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```typescript
|
|
1592
|
+
* const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
|
|
1593
|
+
* const sprite = Sprite.from(texture);
|
|
1594
|
+
*
|
|
1595
|
+
* sprite.anchor.set(0.5);
|
|
1596
|
+
* sprite.x = canvas.screen.width / 2;
|
|
1597
|
+
* sprite.y = canvas.screen.height / 2;
|
|
1598
|
+
*
|
|
1599
|
+
* sprite.eventMode = 'static';
|
|
1600
|
+
* sprite.cursor = 'pointer';
|
|
1601
|
+
* sprite.onEvent('pointerdown', EventTest);
|
|
1602
|
+
*
|
|
1603
|
+
* canvas.add("bunny", sprite);
|
|
1604
|
+
* ```
|
|
1605
|
+
*/
|
|
1606
|
+
declare class Sprite<Memory extends SpriteOptions$1 & CanvasBaseItemMemory = SpriteMemory> extends Sprite$1 implements CanvasBaseItem<Memory | SpriteMemory> {
|
|
1607
|
+
constructor(options?: SpriteOptions | Omit<Texture, "on">);
|
|
1608
|
+
pixivnId: string;
|
|
1609
|
+
private _textureAlias?;
|
|
1610
|
+
get textureAlias(): string;
|
|
1611
|
+
set textureAlias(value: string);
|
|
1612
|
+
get memory(): Memory | SpriteMemory;
|
|
1613
|
+
set memory(_value: Memory | SpriteMemory);
|
|
1614
|
+
setMemory(value: Memory | SpriteMemory): Promise<void>;
|
|
1615
|
+
private _onEvents;
|
|
1616
|
+
get onEvents(): {
|
|
1617
|
+
[name: string]: string;
|
|
1618
|
+
};
|
|
1619
|
+
/**
|
|
1620
|
+
* is same function as on(), but it keeps in memory the children.
|
|
1621
|
+
* @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
|
|
1622
|
+
* @param eventClass The class that extends CanvasEvent.
|
|
1623
|
+
* @returns
|
|
1624
|
+
* @example
|
|
1625
|
+
* ```typescript
|
|
1626
|
+
* \@eventDecorator()
|
|
1627
|
+
* export class EventTest extends CanvasEvent<Sprite> {
|
|
1628
|
+
* override fn(event: CanvasEventNamesType, sprite: Sprite): void {
|
|
1629
|
+
* if (event === 'pointerdown') {
|
|
1630
|
+
* sprite.scale.x *= 1.25;
|
|
1631
|
+
* sprite.scale.y *= 1.25;
|
|
1632
|
+
* }
|
|
1633
|
+
* }
|
|
1634
|
+
* }
|
|
1635
|
+
* ```
|
|
1636
|
+
*
|
|
1637
|
+
* ```typescript
|
|
1638
|
+
* let sprite = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
1639
|
+
* await sprite.load()
|
|
1640
|
+
*
|
|
1641
|
+
* sprite.eventMode = 'static';
|
|
1642
|
+
* sprite.cursor = 'pointer';
|
|
1643
|
+
* sprite.onEvent('pointerdown', EventTest);
|
|
1644
|
+
*
|
|
1645
|
+
* canvas.add("bunny", sprite);
|
|
1646
|
+
* ```
|
|
1647
|
+
*/
|
|
1648
|
+
onEvent<T extends typeof CanvasEvent<typeof this>>(event: CanvasEventNamesType, eventClass: T): this;
|
|
1649
|
+
/**
|
|
1650
|
+
* Add a listener for a given event.
|
|
1651
|
+
* Unlike {@link onEvent}, this method does **not track the event association in the current game state**, so it will not be included in saves.
|
|
1652
|
+
*/
|
|
1653
|
+
on<T extends keyof ContainerEvents<ContainerChild$1> | keyof {
|
|
1654
|
+
[K: symbol]: any;
|
|
1655
|
+
[K: {} & string]: any;
|
|
1656
|
+
}>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild$1> & {
|
|
1657
|
+
[K: symbol]: any;
|
|
1658
|
+
[K: {} & string]: any;
|
|
1659
|
+
}>[Extract<T, keyof ContainerEvents<ContainerChild$1> | keyof {
|
|
1660
|
+
[K: symbol]: any;
|
|
1661
|
+
[K: {} & string]: any;
|
|
1662
|
+
}>]) => void, context?: any): this;
|
|
1663
|
+
static from(source: Texture | TextureSourceLike, skipCache?: boolean): Sprite<any>;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* This class is a extension of the {@link Sprite} class, it has the same properties and methods,
|
|
1668
|
+
* but it has some features that make texture management easier.
|
|
1669
|
+
* You need to use {@link ImageSprite.load()} to show the image in the canvas.
|
|
1670
|
+
* This class is used for functions like {@link addImage} and {@link showWithDissolve}.
|
|
1671
|
+
* @example
|
|
1672
|
+
* ```typescript
|
|
1673
|
+
* let alien = new ImageSprite({
|
|
1674
|
+
* anchor: { x: 0.5, y: 0.5 },
|
|
1675
|
+
* x: 100,
|
|
1676
|
+
* y: 100,
|
|
1677
|
+
* }, 'https://pixijs.com/assets/eggHead.png')
|
|
1678
|
+
* await alien.load()
|
|
1679
|
+
* canvas.add("alien", alien)
|
|
1680
|
+
* ```
|
|
1681
|
+
* @example
|
|
1682
|
+
* ```typescript
|
|
1683
|
+
* let alien = addImage("alien", 'https://pixijs.com/assets/eggHead.png')
|
|
1684
|
+
* alien.anchor.set(0.5);
|
|
1685
|
+
* alien.x = 100
|
|
1686
|
+
* alien.y = 100
|
|
1687
|
+
* await alien.load()
|
|
1688
|
+
* ```
|
|
1689
|
+
*/
|
|
1690
|
+
declare class ImageSprite<Memory extends ImageSpriteMemory = ImageSpriteMemory> extends Sprite<Memory> implements AdditionalPositionsExtension {
|
|
1691
|
+
pixivnId: string;
|
|
1692
|
+
constructor(options?: ImageSpriteOptions | Omit<Texture, "on"> | undefined, textureAlias?: string);
|
|
1693
|
+
get memory(): ImageSpriteMemory;
|
|
1694
|
+
set memory(_value: ImageSpriteMemory);
|
|
1695
|
+
setMemory(value: ImageSpriteMemory): Promise<void>;
|
|
1696
|
+
static from(source: Texture | TextureSourceLike, skipCache?: boolean): ImageSprite<ImageSpriteMemory>;
|
|
1697
|
+
private _loadIsStarted;
|
|
1698
|
+
get loadIsStarted(): boolean;
|
|
1699
|
+
/**
|
|
1700
|
+
* Load the image from the link and set the texture of the sprite.
|
|
1701
|
+
* @returns A promise that resolves when the image is loaded.
|
|
1702
|
+
*/
|
|
1703
|
+
load(): Promise<void>;
|
|
1704
|
+
set texture(value: Texture<TextureSource<any>>);
|
|
1705
|
+
get texture(): Texture<TextureSource<any>>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Check if the texture is empty.
|
|
1708
|
+
* @returns A boolean that is true if the texture is empty.
|
|
1709
|
+
*/
|
|
1710
|
+
get haveEmptyTexture(): boolean;
|
|
1711
|
+
/** AdditionalPositions */
|
|
1712
|
+
private _align;
|
|
1713
|
+
set align(value: Partial<PointData> | number);
|
|
1714
|
+
get align(): Partial<PointData> | number;
|
|
1715
|
+
set xAlign(value: number);
|
|
1716
|
+
get xAlign(): number;
|
|
1717
|
+
set yAlign(value: number);
|
|
1718
|
+
get yAlign(): number;
|
|
1719
|
+
private _percentagePosition;
|
|
1720
|
+
set percentagePosition(value: Partial<PointData> | number);
|
|
1721
|
+
get percentagePosition(): Partial<PointData> | number;
|
|
1722
|
+
get percentageX(): number;
|
|
1723
|
+
set percentageX(_value: number);
|
|
1724
|
+
get percentageY(): number;
|
|
1725
|
+
set percentageY(_value: number);
|
|
1726
|
+
set xPercentagePosition(_value: number);
|
|
1727
|
+
get xPercentagePosition(): number;
|
|
1728
|
+
set yPercentagePosition(_value: number);
|
|
1729
|
+
get yPercentagePosition(): number;
|
|
1730
|
+
get positionType(): "pixel" | "percentage" | "align";
|
|
1731
|
+
get positionInfo(): {
|
|
1732
|
+
x: number;
|
|
1733
|
+
y: number;
|
|
1734
|
+
type: "pixel" | "percentage" | "align";
|
|
1735
|
+
};
|
|
1736
|
+
set positionInfo(value: {
|
|
1737
|
+
x: number;
|
|
1738
|
+
y: number;
|
|
1739
|
+
type?: "pixel" | "percentage" | "align";
|
|
1740
|
+
});
|
|
1741
|
+
private reloadPosition;
|
|
1742
|
+
get position(): ObservablePoint;
|
|
1743
|
+
set position(value: ObservablePoint);
|
|
1744
|
+
get x(): number;
|
|
1745
|
+
set x(value: number);
|
|
1746
|
+
get y(): number;
|
|
1747
|
+
set y(value: number);
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* This class is a extension of the {@link ImageSprite} class, it has the same properties and methods,
|
|
1752
|
+
* but it has some features that make video management easier.
|
|
1753
|
+
* You need to use {@link VideoSprite.load()} to show the video in the canvas.
|
|
1754
|
+
* This class is used for functions like {@link addVideo} and {@link showWithDissolve}.
|
|
1755
|
+
* @example
|
|
1756
|
+
* ```typescript
|
|
1757
|
+
* let film = new VideoSprite({
|
|
1758
|
+
* x: 100,
|
|
1759
|
+
* y: 100,
|
|
1760
|
+
* }, 'https://pixijs.com/assets/video.mp4')
|
|
1761
|
+
* await film.load()
|
|
1762
|
+
* canvas.add("film", film)
|
|
1763
|
+
* ```
|
|
1764
|
+
* @example
|
|
1765
|
+
* ```typescript
|
|
1766
|
+
* let film = addVideo("film", 'https://pixijs.com/assets/video.mp4')
|
|
1767
|
+
* film.currentTime = 2
|
|
1768
|
+
* await film.load()
|
|
1769
|
+
* ```
|
|
1770
|
+
*/
|
|
1771
|
+
declare class VideoSprite extends ImageSprite<VideoSpriteMemory> {
|
|
1772
|
+
constructor(options?: VideoSpriteOptions | Texture | undefined, textureAlias?: string);
|
|
1773
|
+
pixivnId: string;
|
|
1774
|
+
get memory(): VideoSpriteMemory;
|
|
1775
|
+
set memory(_value: VideoSpriteMemory);
|
|
1776
|
+
setMemory(value: VideoSpriteMemory): Promise<void>;
|
|
1777
|
+
static from(source: Texture | TextureSourceLike, skipCache?: boolean): VideoSprite;
|
|
1778
|
+
load(): Promise<void>;
|
|
1779
|
+
private _looop;
|
|
1780
|
+
/**
|
|
1781
|
+
* Set to true if you want the video to loop.
|
|
1782
|
+
*/
|
|
1783
|
+
get loop(): boolean;
|
|
1784
|
+
set loop(value: boolean);
|
|
1785
|
+
private _paused;
|
|
1786
|
+
/**
|
|
1787
|
+
* Set to true if you want the video to be paused.
|
|
1788
|
+
*/
|
|
1789
|
+
get paused(): boolean;
|
|
1790
|
+
set paused(value: boolean);
|
|
1791
|
+
/**
|
|
1792
|
+
* Pause the video.
|
|
1793
|
+
*/
|
|
1794
|
+
pause(): void;
|
|
1795
|
+
/**
|
|
1796
|
+
* Play the video.
|
|
1797
|
+
*/
|
|
1798
|
+
play(): void;
|
|
1799
|
+
private _currentTime;
|
|
1800
|
+
/**
|
|
1801
|
+
* The current time of the video.
|
|
1802
|
+
*/
|
|
1803
|
+
get currentTime(): number;
|
|
1804
|
+
set currentTime(value: number);
|
|
1805
|
+
/**
|
|
1806
|
+
* Restart the video.
|
|
1807
|
+
*/
|
|
1808
|
+
restart(): void;
|
|
1809
|
+
/**
|
|
1810
|
+
* The duration of the video.
|
|
1811
|
+
*/
|
|
1812
|
+
get duration(): number | undefined;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Interface for the canvas container memory
|
|
1817
|
+
*/
|
|
1818
|
+
interface ContainerMemory<C extends ContainerChild = ContainerChild> extends ContainerOptions<C>, CanvasBaseItemMemory {
|
|
1819
|
+
elements: CanvasBaseItemMemory[];
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* Interface for the canvas container memory
|
|
1824
|
+
*/
|
|
1825
|
+
interface ImageContainerMemory extends ContainerMemory<ImageSprite>, AdditionalPositionsExtensionProps {
|
|
1826
|
+
elements: ImageSpriteMemory[];
|
|
1827
|
+
anchor?: PointData;
|
|
1828
|
+
loadIsStarted: boolean;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* This class is a extension of the [PIXI.Container class](https://pixijs.com/8.x/examples/basic/container), it has the same properties and methods,
|
|
1833
|
+
* but it has the ability to be saved and loaded by the Pixi’VN library.
|
|
1834
|
+
* @example
|
|
1835
|
+
* ```typescript
|
|
1836
|
+
* const container = new Container();
|
|
1837
|
+
* canvas.add(container);
|
|
1838
|
+
* const texture = await Assets.load('https://pixijs.com/assets/bunny.png');
|
|
1839
|
+
* for (let i = 0; i < 25; i++)
|
|
1840
|
+
* {
|
|
1841
|
+
* const bunny = new Sprite(texture);
|
|
1842
|
+
* bunny.x = (i % 5) * 40;
|
|
1843
|
+
* bunny.y = Math.floor(i / 5) * 40;
|
|
1844
|
+
* container.addChild(bunny);
|
|
1845
|
+
* }
|
|
1846
|
+
* ```
|
|
1847
|
+
*/
|
|
1848
|
+
declare class Container<C extends ContainerChild = ContainerChild, Memory extends ContainerMemory = ContainerMemory> extends Container$1<C> implements CanvasBaseItem<Memory> {
|
|
1849
|
+
constructor(options?: ContainerOptions<C>);
|
|
1850
|
+
pixivnId: string;
|
|
1851
|
+
get memory(): Memory;
|
|
1852
|
+
set memory(_value: Memory);
|
|
1853
|
+
setMemory(value: Memory): Promise<void>;
|
|
1854
|
+
protected importChildren(value: Memory): Promise<void>;
|
|
1855
|
+
private _onEvents;
|
|
1856
|
+
get onEvents(): {
|
|
1857
|
+
[name: string]: string;
|
|
1858
|
+
};
|
|
1859
|
+
/**
|
|
1860
|
+
* is same function as on(), but it keeps in memory the children.
|
|
1861
|
+
* @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
|
|
1862
|
+
* @param eventClass The class that extends CanvasEvent.
|
|
1863
|
+
* @returns
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```typescript
|
|
1866
|
+
* \@eventDecorator()
|
|
1867
|
+
* export class EventTest extends CanvasEvent<Container> {
|
|
1868
|
+
* override fn(event: CanvasEventNamesType, container: Container): void {
|
|
1869
|
+
* if (event === 'pointerdown') {
|
|
1870
|
+
* container.scale.x *= 1.25;
|
|
1871
|
+
* container.scale.y *= 1.25;
|
|
1872
|
+
* }
|
|
1873
|
+
* }
|
|
1874
|
+
* }
|
|
1875
|
+
* ```
|
|
1876
|
+
*
|
|
1877
|
+
* ```typescript
|
|
1878
|
+
* const container = new Container();
|
|
1879
|
+
*
|
|
1880
|
+
* container.eventMode = 'static';
|
|
1881
|
+
* container.cursor = 'pointer';
|
|
1882
|
+
* container.onEvent('pointerdown', EventTest);
|
|
1883
|
+
*
|
|
1884
|
+
* canvas.add("container", container);
|
|
1885
|
+
* ```
|
|
1886
|
+
*/
|
|
1887
|
+
onEvent<T extends CanvasEventNamesType, T2 extends typeof CanvasEvent<typeof this>>(event: T, eventClass: T2): this;
|
|
1888
|
+
/**
|
|
1889
|
+
* Add a listener for a given event.
|
|
1890
|
+
* Unlike {@link onEvent}, this method does **not track the event association in the current game state**, so it will not be included in saves.
|
|
1891
|
+
*/
|
|
1892
|
+
on<T extends keyof ContainerEvents<ContainerChild> | keyof {
|
|
1893
|
+
[K: symbol]: any;
|
|
1894
|
+
[K: {} & string]: any;
|
|
1895
|
+
}>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild> & {
|
|
1896
|
+
[K: symbol]: any;
|
|
1897
|
+
[K: {} & string]: any;
|
|
1898
|
+
}>[Extract<T, keyof ContainerEvents<ContainerChild> | keyof {
|
|
1899
|
+
[K: symbol]: any;
|
|
1900
|
+
[K: {} & string]: any;
|
|
1901
|
+
}>]) => void, context?: any): this;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
/**
|
|
1905
|
+
* This class is a extension of the {@link Container}, it has the same properties and methods,
|
|
1906
|
+
* but this container is composed only of {@link ImageSprite} and introduces the {@link ImageContainer.load} functionality
|
|
1907
|
+
* @example
|
|
1908
|
+
* ```typescript
|
|
1909
|
+
* const liamBodyImageUrl = 'https://example.com/assets/liam/body.png';
|
|
1910
|
+
* const liamHeadImageUrl = 'https://example.com/assets/liam/head.png';
|
|
1911
|
+
* const container = new ImageContainer(undefined, [liamBodyImageUrl, liamHeadImageUrl]);
|
|
1912
|
+
* await container.load()
|
|
1913
|
+
* canvas.add(container);
|
|
1914
|
+
* ```
|
|
1915
|
+
*/
|
|
1916
|
+
declare class ImageContainer extends Container<ImageSprite, ImageContainerMemory> implements AnchorExtension, AdditionalPositionsExtension {
|
|
1917
|
+
constructor(options?: ImageContainerOptions<ImageSprite>, textureAliases?: string[]);
|
|
1918
|
+
get memory(): ImageContainerMemory;
|
|
1919
|
+
set memory(_value: ImageContainerMemory);
|
|
1920
|
+
setMemory(value: ImageContainerMemory): Promise<void>;
|
|
1921
|
+
pixivnId: string;
|
|
1922
|
+
private _loadIsStarted;
|
|
1923
|
+
get loadIsStarted(): boolean;
|
|
1924
|
+
/**
|
|
1925
|
+
* Load the children images.
|
|
1926
|
+
* @returns A promise that resolves when the images are loaded.
|
|
1927
|
+
*/
|
|
1928
|
+
load(): Promise<void>;
|
|
1929
|
+
/**
|
|
1930
|
+
* The texture of the first child.
|
|
1931
|
+
* If there is no child, it returns a new {@link Texture}.
|
|
1932
|
+
*/
|
|
1933
|
+
get texture(): Texture<pixi_js.TextureSource<any>>;
|
|
1934
|
+
/**
|
|
1935
|
+
* Check if there is a child with the empty texture.
|
|
1936
|
+
* @returns A boolean that is true if there is a child with the empty texture.
|
|
1937
|
+
*/
|
|
1938
|
+
get haveEmptyTexture(): boolean;
|
|
1939
|
+
/** Anchor */
|
|
1940
|
+
private _anchor?;
|
|
1941
|
+
get anchor(): PointData;
|
|
1942
|
+
set anchor(value: PointData | number);
|
|
1943
|
+
private reloadAnchor;
|
|
1944
|
+
get pivot(): ObservablePoint;
|
|
1945
|
+
set pivot(value: ObservablePoint);
|
|
1946
|
+
/** AdditionalPositions */
|
|
1947
|
+
private _align;
|
|
1948
|
+
set align(value: Partial<PointData> | number);
|
|
1949
|
+
get align(): Partial<PointData> | number;
|
|
1950
|
+
set xAlign(value: number);
|
|
1951
|
+
get xAlign(): number;
|
|
1952
|
+
set yAlign(value: number);
|
|
1953
|
+
get yAlign(): number;
|
|
1954
|
+
private _percentagePosition;
|
|
1955
|
+
set percentagePosition(value: Partial<PointData> | number);
|
|
1956
|
+
get percentagePosition(): Partial<PointData> | number;
|
|
1957
|
+
set percentageX(_value: number);
|
|
1958
|
+
get percentageX(): number;
|
|
1959
|
+
set xPercentagePosition(_value: number);
|
|
1960
|
+
get xPercentagePosition(): number;
|
|
1961
|
+
set yPercentagePosition(_value: number);
|
|
1962
|
+
get yPercentagePosition(): number;
|
|
1963
|
+
set percentageY(_value: number);
|
|
1964
|
+
get percentageY(): number;
|
|
1965
|
+
get positionType(): "pixel" | "percentage" | "align";
|
|
1966
|
+
get positionInfo(): {
|
|
1967
|
+
x: number;
|
|
1968
|
+
y: number;
|
|
1969
|
+
type: "pixel" | "percentage" | "align";
|
|
1970
|
+
};
|
|
1971
|
+
set positionInfo(value: {
|
|
1972
|
+
x: number;
|
|
1973
|
+
y: number;
|
|
1974
|
+
type?: "pixel" | "percentage" | "align";
|
|
1975
|
+
});
|
|
1976
|
+
private reloadPosition;
|
|
1977
|
+
get position(): ObservablePoint;
|
|
1978
|
+
set position(value: ObservablePoint);
|
|
1979
|
+
get x(): number;
|
|
1980
|
+
set x(value: number);
|
|
1981
|
+
get y(): number;
|
|
1982
|
+
set y(value: number);
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/**
|
|
1986
|
+
* This class is responsible for managing the canvas, the tickers, the events, and the window size and the children of the window.
|
|
1987
|
+
*/
|
|
1988
|
+
declare class CanvasManagerStatic {
|
|
1989
|
+
private constructor();
|
|
1990
|
+
private static _app;
|
|
1991
|
+
static get app(): Application<pixi_js.Renderer>;
|
|
1992
|
+
static get gameLayer(): Container$1<pixi_js.ContainerChild>;
|
|
1993
|
+
/**
|
|
1994
|
+
* This is the div that have same size of the canvas.
|
|
1995
|
+
* This is useful to put interface elements.
|
|
1996
|
+
* You can use React or other framework to put elements in this div.
|
|
1997
|
+
*/
|
|
1998
|
+
static htmlLayers: HTMLElement[];
|
|
1999
|
+
static canvasWidth: number;
|
|
2000
|
+
static canvasHeight: number;
|
|
2001
|
+
static _isInitialized: boolean;
|
|
2002
|
+
static init(element: HTMLElement, width: number, height: number, options?: Partial<ApplicationOptions>, devtoolsOptions?: Devtools): Promise<void>;
|
|
2003
|
+
/**
|
|
2004
|
+
* Add the canvas into a html element.
|
|
2005
|
+
* @param element it is the html element where I will put the canvas. Example: document.body
|
|
2006
|
+
*/
|
|
2007
|
+
private static addCanvasIntoHTMLElement;
|
|
2008
|
+
static addHtmlLayer(id: string, element: HTMLElement, style?: Pick<CSSStyleDeclaration, "position" | "pointerEvents">): HTMLDivElement;
|
|
2009
|
+
static removeHtmlLayer(id: string): void;
|
|
2010
|
+
static getHtmlLayer(id: string): HTMLElement | undefined;
|
|
2011
|
+
/**
|
|
2012
|
+
* This method returns the scale of the screen.
|
|
2013
|
+
*/
|
|
2014
|
+
private static get screenScale();
|
|
2015
|
+
/**
|
|
2016
|
+
* This method returns the width of the screen enlarged by the scale.
|
|
2017
|
+
*/
|
|
2018
|
+
private static get screenWidth();
|
|
2019
|
+
/**
|
|
2020
|
+
* This method returns the height of the screen enlarged by the scale.
|
|
2021
|
+
*/
|
|
2022
|
+
private static get screenHeight();
|
|
2023
|
+
/**
|
|
2024
|
+
* This method returns the horizontal margin of the screen.
|
|
2025
|
+
*/
|
|
2026
|
+
private static get horizontalMargin();
|
|
2027
|
+
/**
|
|
2028
|
+
* This method returns the vertical margin of the screen.
|
|
2029
|
+
*/
|
|
2030
|
+
private static get verticalMargin();
|
|
2031
|
+
/**
|
|
2032
|
+
* This method is called when the screen is resized.
|
|
2033
|
+
*/
|
|
2034
|
+
private static resize;
|
|
2035
|
+
/**
|
|
2036
|
+
* The order of the elements in the canvas, is determined by the zIndex.
|
|
2037
|
+
*/
|
|
2038
|
+
static get childrenAliasesOrder(): string[];
|
|
2039
|
+
/** Edit Tickers Methods */
|
|
2040
|
+
static get currentTickersWithoutCreatedBySteps(): {
|
|
2041
|
+
[k: string]: TickerHistory<any>;
|
|
2042
|
+
};
|
|
2043
|
+
static _currentTickers: {
|
|
2044
|
+
[id: string]: TickerInfo<any>;
|
|
2045
|
+
};
|
|
2046
|
+
static _currentTickersSequence: {
|
|
2047
|
+
[alias: string]: {
|
|
2048
|
+
[tickerId: string]: TickersSequence;
|
|
2049
|
+
};
|
|
2050
|
+
};
|
|
2051
|
+
static _currentTickersTimeouts: {
|
|
2052
|
+
[timeout: string]: TickerTimeoutHistory;
|
|
2053
|
+
};
|
|
2054
|
+
static _tickersToCompleteOnStepEnd: {
|
|
2055
|
+
tikersIds: {
|
|
2056
|
+
id: string;
|
|
2057
|
+
}[];
|
|
2058
|
+
stepAlias: {
|
|
2059
|
+
id: string;
|
|
2060
|
+
alias: string;
|
|
2061
|
+
}[];
|
|
2062
|
+
};
|
|
2063
|
+
/**
|
|
2064
|
+
* @deprecated
|
|
2065
|
+
*/
|
|
2066
|
+
static _tickersOnPause: {
|
|
2067
|
+
[aliasOrId: string]: PauseTickerType;
|
|
2068
|
+
};
|
|
2069
|
+
static generateTickerId(tickerData: TickerInfo<any> | TickersSequence): string;
|
|
2070
|
+
static addTickerTimeoutInfo(aliases: string | string[], ticker: string, timeout: string, canBeDeletedBeforeEnd: boolean): void;
|
|
2071
|
+
static removeTickerTimeoutInfo(timeout: NodeJS.Timeout | string): void;
|
|
2072
|
+
static removeTickerTimeout(timeout: NodeJS.Timeout | string): void;
|
|
2073
|
+
static removeTickerTimeoutsByAlias(alias: string, checkCanBeDeletedBeforeEnd: boolean): void;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* Interface for the canvas text memory
|
|
2078
|
+
*/
|
|
2079
|
+
interface TextMemory extends TextOptions$1, CanvasBaseItemMemory {
|
|
2080
|
+
onEvents: {
|
|
2081
|
+
[name: string]: EventIdType;
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* This class is a extension of the [PIXI.Text class](https://pixijs.com/8.x/examples/text/pixi-text), it has the same properties and methods,
|
|
2087
|
+
* but it has the ability to be saved and loaded by the Pixi’VN library.
|
|
2088
|
+
* @example
|
|
2089
|
+
* ```typescript
|
|
2090
|
+
* const text = new Text();
|
|
2091
|
+
* text.text = "Hello World"
|
|
2092
|
+
* canvas.add("text", text);
|
|
2093
|
+
* ```
|
|
2094
|
+
*/
|
|
2095
|
+
declare class Text extends Text$1 implements CanvasBaseItem<TextMemory> {
|
|
2096
|
+
constructor(options?: TextOptions);
|
|
2097
|
+
pixivnId: string;
|
|
2098
|
+
get memory(): TextMemory;
|
|
2099
|
+
set memory(_value: TextMemory);
|
|
2100
|
+
setMemory(value: TextMemory): Promise<void>;
|
|
2101
|
+
private _onEvents;
|
|
2102
|
+
get onEvents(): {
|
|
2103
|
+
[name: string]: string;
|
|
2104
|
+
};
|
|
2105
|
+
/**
|
|
2106
|
+
* is same function as on(), but it keeps in memory the children.
|
|
2107
|
+
* @param event The event type, e.g., 'click', 'mousedown', 'mouseup', 'pointerdown', etc.
|
|
2108
|
+
* @param eventClass The class that extends CanvasEvent.
|
|
2109
|
+
* @returns
|
|
2110
|
+
* @example
|
|
2111
|
+
* ```typescript
|
|
2112
|
+
* \@eventDecorator()
|
|
2113
|
+
* export class EventTest extends CanvasEvent<Text> {
|
|
2114
|
+
* override fn(event: CanvasEventNamesType, text: Text): void {
|
|
2115
|
+
* if (event === 'pointerdown') {
|
|
2116
|
+
* text.scale.x *= 1.25;
|
|
2117
|
+
* text.scale.y *= 1.25;
|
|
2118
|
+
* }
|
|
2119
|
+
* }
|
|
2120
|
+
* }
|
|
2121
|
+
* ```
|
|
2122
|
+
*
|
|
2123
|
+
* ```typescript
|
|
2124
|
+
* const text = new Text();
|
|
2125
|
+
* text.text = "Hello World"
|
|
2126
|
+
*
|
|
2127
|
+
* text.eventMode = 'static';
|
|
2128
|
+
* text.cursor = 'pointer';
|
|
2129
|
+
* text.onEvent('pointerdown', EventTest);
|
|
2130
|
+
*
|
|
2131
|
+
* canvas.add("text", text);
|
|
2132
|
+
* ```
|
|
2133
|
+
*/
|
|
2134
|
+
onEvent<T extends typeof CanvasEvent<typeof this>>(event: CanvasEventNamesType, eventClass: T): this;
|
|
2135
|
+
/**
|
|
2136
|
+
* Add a listener for a given event.
|
|
2137
|
+
* Unlike {@link onEvent}, this method does **not track the event association in the current game state**, so it will not be included in saves.
|
|
2138
|
+
*/
|
|
2139
|
+
on<T extends keyof ContainerEvents<ContainerChild$1> | keyof {
|
|
2140
|
+
[K: symbol]: any;
|
|
2141
|
+
[K: {} & string]: any;
|
|
2142
|
+
}>(event: T, fn: (...args: EventEmitter.ArgumentMap<ContainerEvents<ContainerChild$1> & {
|
|
2143
|
+
[K: symbol]: any;
|
|
2144
|
+
[K: {} & string]: any;
|
|
2145
|
+
}>[Extract<T, keyof ContainerEvents<ContainerChild$1> | keyof {
|
|
2146
|
+
[K: symbol]: any;
|
|
2147
|
+
[K: {} & string]: any;
|
|
2148
|
+
}>]) => void, context?: any): this;
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
type CanvasElementAliasType = string;
|
|
2152
|
+
|
|
2153
|
+
/**
|
|
2154
|
+
* Is a decorator that register a canvas component in the game.
|
|
2155
|
+
* @param name Name of the canvas component, by default it will use the class name. If the name is already registered, it will show a warning
|
|
2156
|
+
* @returns
|
|
2157
|
+
*/
|
|
2158
|
+
declare function canvasComponentDecorator(name?: CanvasElementAliasType): (target: typeof CanvasBaseItem<any>) => void;
|
|
2159
|
+
declare namespace RegisteredCanvasComponents {
|
|
2160
|
+
/**
|
|
2161
|
+
* Register a canvas component in the game.
|
|
2162
|
+
* @param target The class of the canvas component.
|
|
2163
|
+
* @param name Name of the canvas component, by default it will use the class name. If the name is already registered, it will show a warning
|
|
2164
|
+
*/
|
|
2165
|
+
function add(target: typeof CanvasBaseItem<any>, name?: CanvasElementAliasType): void;
|
|
2166
|
+
/**
|
|
2167
|
+
* Get a canvas component by the id.
|
|
2168
|
+
* @param canvasId The id of the canvas component.
|
|
2169
|
+
* @returns The canvas component type.
|
|
2170
|
+
*/
|
|
2171
|
+
function get<T extends typeof CanvasBaseItem<any>>(canvasId: CanvasElementAliasType): T | undefined;
|
|
2172
|
+
/**
|
|
2173
|
+
* Get a list of all canvas components registered.
|
|
2174
|
+
* @returns An array of canvas components.
|
|
2175
|
+
*/
|
|
2176
|
+
function values(): (typeof CanvasBaseItem<any>)[];
|
|
2177
|
+
/**
|
|
2178
|
+
* Check if a canvas component is registered.
|
|
2179
|
+
* @param id The id of the canvas component.
|
|
2180
|
+
* @returns True if the canvas component is registered, false otherwise.
|
|
2181
|
+
*/
|
|
2182
|
+
function has(id: string): boolean;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* Is a decorator that register a event in the game.
|
|
2187
|
+
* Is a required decorator for use the event in the game.
|
|
2188
|
+
* Thanks to this decoration the game has the possibility of updating the events to the latest modification and saving the game.
|
|
2189
|
+
* @param name is th identifier of the event, by default is the name of the class
|
|
2190
|
+
* @returns
|
|
2191
|
+
*/
|
|
2192
|
+
declare function eventDecorator(name?: EventIdType): (target: typeof CanvasEvent<any>) => void;
|
|
2193
|
+
declare namespace RegisteredEvents {
|
|
2194
|
+
/**
|
|
2195
|
+
* Register a event in the game.
|
|
2196
|
+
* @param target The class of the event.
|
|
2197
|
+
* @param name Name of the event, by default it will use the class name. If the name is already registered, it will show a warning
|
|
2198
|
+
*/
|
|
2199
|
+
function add(target: typeof CanvasEvent<CanvasEventNamesType>, name?: EventIdType): void;
|
|
2200
|
+
/**
|
|
2201
|
+
* Get a event by the id.
|
|
2202
|
+
* @param canvasId The id of the event.
|
|
2203
|
+
* @returns The event type.
|
|
2204
|
+
*/
|
|
2205
|
+
function get<T = typeof CanvasEvent<CanvasBaseInterface<any>>>(eventId: EventIdType): T | undefined;
|
|
2206
|
+
/**
|
|
2207
|
+
* Get a event instance by the id.
|
|
2208
|
+
* @param eventId The id of the event.
|
|
2209
|
+
* @returns The event instance.
|
|
2210
|
+
*/
|
|
2211
|
+
function getInstance<T = CanvasEvent<CanvasBaseInterface<any>>>(eventId: EventIdType): T | undefined;
|
|
2212
|
+
/**
|
|
2213
|
+
* Get a list of all events registered.
|
|
2214
|
+
* @returns An array of events.
|
|
2215
|
+
*/
|
|
2216
|
+
function values(): (typeof CanvasEvent<CanvasEventNamesType>)[];
|
|
2217
|
+
/**
|
|
2218
|
+
* Check if a event is registered.
|
|
2219
|
+
* @param id The id of the event.
|
|
2220
|
+
* @returns True if the event is registered, false otherwise
|
|
2221
|
+
*/
|
|
2222
|
+
function has(id: string): boolean;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Shake the canvas element.
|
|
2227
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2228
|
+
* @param alias
|
|
2229
|
+
* @param options
|
|
2230
|
+
* @param priority
|
|
2231
|
+
* @returns
|
|
2232
|
+
*/
|
|
2233
|
+
declare function shakeEffect(alias: string, options?: ShakeEffectProps, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2234
|
+
|
|
2235
|
+
interface BaseTransitionProps {
|
|
2236
|
+
/**
|
|
2237
|
+
* If true, the transition will be completed before the next step.
|
|
2238
|
+
* For example, if the transition is a dissolve transition, the "alpha" of the texture will be 1 before the next step.
|
|
2239
|
+
* @default true
|
|
2240
|
+
*/
|
|
2241
|
+
forceCompleteBeforeNext?: boolean;
|
|
2242
|
+
}
|
|
2243
|
+
interface ShowWithDissolveTransitionProps extends BaseTransitionProps, AnimationOptions {
|
|
2244
|
+
}
|
|
2245
|
+
interface ShowWithFadeTransitionProps extends BaseTransitionProps, AnimationOptions {
|
|
2246
|
+
}
|
|
2247
|
+
interface MoveInOutProps extends BaseTransitionProps, AnimationOptions {
|
|
2248
|
+
/**
|
|
2249
|
+
* The direction of the movement.
|
|
2250
|
+
* @default "right"
|
|
2251
|
+
*/
|
|
2252
|
+
direction?: "up" | "down" | "left" | "right";
|
|
2253
|
+
}
|
|
2254
|
+
interface ZoomInOutProps extends BaseTransitionProps, AnimationOptions {
|
|
2255
|
+
/**
|
|
2256
|
+
* The direction of the zoom effect.
|
|
2257
|
+
* @default "right"
|
|
2258
|
+
*/
|
|
2259
|
+
direction?: "up" | "down" | "left" | "right";
|
|
2260
|
+
}
|
|
2261
|
+
interface PushInOutProps extends BaseTransitionProps, AnimationOptions {
|
|
2262
|
+
/**
|
|
2263
|
+
* The direction of the push effect.
|
|
2264
|
+
* @default "right"
|
|
2265
|
+
*/
|
|
2266
|
+
direction?: "up" | "down" | "left" | "right";
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
type TComponent = CanvasBaseInterface<any> | string | string[] | {
|
|
2270
|
+
value: string;
|
|
2271
|
+
options: ImageSpriteOptions;
|
|
2272
|
+
} | {
|
|
2273
|
+
value: string[];
|
|
2274
|
+
options: ImageContainerOptions;
|
|
2275
|
+
};
|
|
2276
|
+
/**
|
|
2277
|
+
* Show a image in the canvas with a disolve effect.
|
|
2278
|
+
* Disolve effect is a effect that the image is shown with a fade in.
|
|
2279
|
+
* If exist a image with the same alias, then the image is replaced and the first image is removed after the effect is done.
|
|
2280
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2281
|
+
* @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas.
|
|
2282
|
+
* If imageUrl is an array, then the {@link ImageContainer} is added to the canvas.
|
|
2283
|
+
* If you don't provide the component, then the alias is used as the url.
|
|
2284
|
+
* @param props The properties of the effect
|
|
2285
|
+
* @param priority The priority of the effect
|
|
2286
|
+
* @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded.
|
|
2287
|
+
*/
|
|
2288
|
+
declare function showWithDissolve(alias: string, component?: TComponent, props?: ShowWithDissolveTransitionProps, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2289
|
+
/**
|
|
2290
|
+
* Remove a image from the canvas with a disolve effect.
|
|
2291
|
+
* Disolve effect is a effect that the image is removed with a fade out.
|
|
2292
|
+
* This function is equivalent to {@link removeWithFade}.
|
|
2293
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2294
|
+
* @param props The properties of the effect
|
|
2295
|
+
* @param priority The priority of the effect
|
|
2296
|
+
* @returns The ids of the tickers that are used in the effect.
|
|
2297
|
+
*/
|
|
2298
|
+
declare function removeWithDissolve(alias: string, props?: ShowWithDissolveTransitionProps, priority?: UPDATE_PRIORITY): string[] | undefined;
|
|
2299
|
+
/**
|
|
2300
|
+
* Show a image in the canvas with a fade effect.
|
|
2301
|
+
* Fade effect is a effect that the image is shown with a fade in.
|
|
2302
|
+
* If exist a image with the same alias, the existing image is removed with a fade transition, and after the effect is done, the new image is shown with a fade transition.
|
|
2303
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2304
|
+
* @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas.
|
|
2305
|
+
* If imageUrl is an array, then the {@link ImageContainer} is added to the canvas.
|
|
2306
|
+
* If you don't provide the component, then the alias is used as the url.
|
|
2307
|
+
* @param props The properties of the effect
|
|
2308
|
+
* @param priority The priority of the effect
|
|
2309
|
+
* @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded.
|
|
2310
|
+
*/
|
|
2311
|
+
declare function showWithFade(alias: string, component?: TComponent, props?: ShowWithFadeTransitionProps, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2312
|
+
/**
|
|
2313
|
+
* Remove a image from the canvas with a fade effect.
|
|
2314
|
+
* Fade effect is a effect that the image is removed with a fade out.
|
|
2315
|
+
* This function is equivalent to {@link removeWithDissolve}.
|
|
2316
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2317
|
+
* @param props The properties of the effect
|
|
2318
|
+
* @param priority The priority of the effect
|
|
2319
|
+
* @returns The ids of the tickers that are used in the effect.
|
|
2320
|
+
*/
|
|
2321
|
+
declare function removeWithFade(alias: string, props?: ShowWithFadeTransitionProps, priority?: UPDATE_PRIORITY): string[] | undefined;
|
|
2322
|
+
/**
|
|
2323
|
+
* Show a image in the canvas with a move effect. The image is moved from outside the canvas to the x and y position of the image.
|
|
2324
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2325
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2326
|
+
* @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas.
|
|
2327
|
+
* If imageUrl is an array, then the {@link ImageContainer} is added to the canvas.
|
|
2328
|
+
* If you don't provide the component, then the alias is used as the url.
|
|
2329
|
+
* @param props The properties of the effect
|
|
2330
|
+
* @param priority The priority of the effect
|
|
2331
|
+
* @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded.
|
|
2332
|
+
*/
|
|
2333
|
+
declare function moveIn(alias: string, component?: TComponent, props?: MoveInOutProps & {
|
|
2334
|
+
/**
|
|
2335
|
+
* If true, then the old component is removed with a move out, after the new image is moved in.
|
|
2336
|
+
* @default false
|
|
2337
|
+
*/
|
|
2338
|
+
removeOldComponentWithMoveOut?: boolean;
|
|
2339
|
+
}, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Remove a image from the canvas with a move effect. The image is moved from the x and y position of the image to outside the canvas.
|
|
2342
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2343
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2344
|
+
* @param props The properties of the effect
|
|
2345
|
+
* @param priority The priority of the effect
|
|
2346
|
+
* @returns The ids of the tickers that are used in the effect.
|
|
2347
|
+
*/
|
|
2348
|
+
declare function moveOut(alias: string, props?: MoveInOutProps, priority?: UPDATE_PRIORITY): string[] | undefined;
|
|
2349
|
+
/**
|
|
2350
|
+
* Show a image in the canvas with a zoom effect. The image is zoomed in from the center of the canvas.
|
|
2351
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2352
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2353
|
+
* @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas.
|
|
2354
|
+
* If imageUrl is an array, then the {@link ImageContainer} is added to the canvas.
|
|
2355
|
+
* If you don't provide the component, then the alias is used as the url.
|
|
2356
|
+
* @param props The properties of the effect
|
|
2357
|
+
* @param priority The priority of the effect
|
|
2358
|
+
* @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded.
|
|
2359
|
+
*/
|
|
2360
|
+
declare function zoomIn(alias: string, component?: TComponent, props?: ZoomInOutProps & {
|
|
2361
|
+
/**
|
|
2362
|
+
* If true, then the old component is removed with a zoom out, after the new image is zoomed in.
|
|
2363
|
+
* @default false
|
|
2364
|
+
*/
|
|
2365
|
+
removeOldComponentWithZoomOut?: boolean;
|
|
2366
|
+
}, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2367
|
+
/**
|
|
2368
|
+
* Remove a image from the canvas with a zoom effect. The image is zoomed out to the center of the canvas.
|
|
2369
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2370
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2371
|
+
* @param props The properties of the effect
|
|
2372
|
+
* @param priority The priority of the effect
|
|
2373
|
+
* @returns The ids of the tickers that are used in the effect.
|
|
2374
|
+
*/
|
|
2375
|
+
declare function zoomOut(alias: string, props?: ZoomInOutProps, priority?: UPDATE_PRIORITY): string[] | undefined;
|
|
2376
|
+
/**
|
|
2377
|
+
* Show a image in the canvas with a push effect. The new image is pushed in from the inside of the canvas and the old image is pushed out to the outside of the canvas.
|
|
2378
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2379
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2380
|
+
* @param component The imageUrl, array of imageUrl or the canvas component. If imageUrl is a video, then the {@link VideoSprite} is added to the canvas.
|
|
2381
|
+
* If imageUrl is an array, then the {@link ImageContainer} is added to the canvas.
|
|
2382
|
+
* If you don't provide the component, then the alias is used as the url.
|
|
2383
|
+
* @param props The properties of the effect
|
|
2384
|
+
* @param priority The priority of the effect
|
|
2385
|
+
* @returns A promise that contains the ids of the tickers that are used in the effect. The promise is resolved when the image is loaded.
|
|
2386
|
+
*/
|
|
2387
|
+
declare function pushIn(alias: string, component?: TComponent, props?: PushInOutProps, priority?: UPDATE_PRIORITY): Promise<string[] | undefined>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Remove a image from the canvas with a push effect. The image is pushed out to the outside of the canvas.
|
|
2390
|
+
* If there is a/more ticker(s) with the same alias, then the ticker(s) is/are paused.
|
|
2391
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2392
|
+
* @param props The properties of the effect
|
|
2393
|
+
* @param priority The priority of the effect
|
|
2394
|
+
* @returns The ids of the tickers that are used in the effect.
|
|
2395
|
+
*/
|
|
2396
|
+
declare function pushOut(alias: string, props?: PushInOutProps, priority?: UPDATE_PRIORITY): string[] | undefined;
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* Add a list of images in the container, after that, the images are added to the canvas.
|
|
2400
|
+
* Is the same that {@link showImageContainer}, but the image is not shown.
|
|
2401
|
+
* If you want to show the image, then you need to use the function {@link ImageSprite.load()}.
|
|
2402
|
+
* @param alias is the unique alias of the image. You can use this alias to refer to this image
|
|
2403
|
+
* @param imageUrls is the url of the image. If you don't provide the url, then the alias is used as the url.
|
|
2404
|
+
* @param options The options of the image.
|
|
2405
|
+
* @returns the container of the image.
|
|
2406
|
+
* @example
|
|
2407
|
+
* ```typescript
|
|
2408
|
+
* let bunny = addImageContainer("bunny", ["https://pixijs.com/assets/bunny-body.png", "https://pixijs.com/assets/bunny-eyes.png"])
|
|
2409
|
+
* await bunny.load()
|
|
2410
|
+
* ```
|
|
2411
|
+
*/
|
|
2412
|
+
declare function addImageCointainer(alias: string, imageUrls: string[], options?: ImageContainerOptions<ImageSprite>): ImageContainer;
|
|
2413
|
+
/**
|
|
2414
|
+
* Add a list of images in the container, after that, the images are added and shown in the canvas.
|
|
2415
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2416
|
+
* @param imageUrls The url of the image.
|
|
2417
|
+
* @param options The options of the image.
|
|
2418
|
+
* @returns A promise that is resolved when the image is loaded.
|
|
2419
|
+
* @example
|
|
2420
|
+
* ```typescript
|
|
2421
|
+
* let bunny = showImageContainer("bunny", ["https://pixijs.com/assets/bunny-body.png", "https://pixijs.com/assets/bunny-eyes.png"])
|
|
2422
|
+
* ```
|
|
2423
|
+
*/
|
|
2424
|
+
declare function showImageContainer(alias: string, imageUrls: string[], options?: ImageContainerOptions<ImageSprite>): Promise<ImageContainer>;
|
|
2425
|
+
|
|
2426
|
+
/**
|
|
2427
|
+
* Add a image in the canvas.
|
|
2428
|
+
* Is the same that {@link showImage}, but the image is not shown.
|
|
2429
|
+
* If you want to show the image, then you need to use the function {@link ImageSprite.load()}.
|
|
2430
|
+
* @param alias is the unique alias of the image. You can use this alias to refer to this image
|
|
2431
|
+
* @param imageUrl is the url of the image. If you don't provide the url, then the alias is used as the url.
|
|
2432
|
+
* @param options The options of the image.
|
|
2433
|
+
* @returns the container of the image.
|
|
2434
|
+
* @example
|
|
2435
|
+
* ```typescript
|
|
2436
|
+
* let bunny1 = addImage("bunny1", "https://pixijs.com/assets/bunny1.png")
|
|
2437
|
+
* await bunny1.load()
|
|
2438
|
+
* Assets.add({ alias: "bunny2", src: "https://pixijs.com/assets/bunny2.png" })
|
|
2439
|
+
* let bunny2 = addImage("bunny2")
|
|
2440
|
+
* await bunny2.load()
|
|
2441
|
+
* ```
|
|
2442
|
+
*/
|
|
2443
|
+
declare function addImage(alias: string, imageUrl?: string, options?: ImageSpriteOptions): ImageSprite;
|
|
2444
|
+
/**
|
|
2445
|
+
* Add and show a image in the canvas. This function is a combination of {@link addImage} and {@link loadImage}.
|
|
2446
|
+
* @param alias The unique alias of the image. You can use this alias to refer to this image
|
|
2447
|
+
* @param imageUrl The url of the image.
|
|
2448
|
+
* @param options The options of the image.
|
|
2449
|
+
* @returns A promise that is resolved when the image is loaded.
|
|
2450
|
+
* @example
|
|
2451
|
+
* ```typescript
|
|
2452
|
+
* let bunny1 = showImage("bunny1", "https://pixijs.com/assets/bunny1.png")
|
|
2453
|
+
* Assets.add({ alias: "bunny2", src: "https://pixijs.com/assets/bunny2.png" })
|
|
2454
|
+
* let bunny2 = showImage("bunny2")
|
|
2455
|
+
* ```
|
|
2456
|
+
*/
|
|
2457
|
+
declare function showImage(alias: string, imageUrl?: string, options?: ImageSpriteOptions): Promise<ImageSprite>;
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Get a texture from a url.
|
|
2461
|
+
* @param textureAlias is the url of the file.
|
|
2462
|
+
* @returns the texture of the image or video, or a text with the error.
|
|
2463
|
+
*/
|
|
2464
|
+
declare function getTexture(textureAlias?: string): Promise<Texture | void>;
|
|
2465
|
+
|
|
2466
|
+
/**
|
|
2467
|
+
* Add a video in the canvas.
|
|
2468
|
+
* Is the same that {@link showVideo}, but the video is not shown.
|
|
2469
|
+
* If you want to show the video, then you need to use the function {@link VideoSprite.load()}.
|
|
2470
|
+
* @param alias is the unique alias of the video. You can use this alias to refer to this video
|
|
2471
|
+
* @param videoUrl is the url of the video. If you don't provide the url, then the alias is used as the url.
|
|
2472
|
+
* @param options The options of the video.
|
|
2473
|
+
* @returns the container of the video.
|
|
2474
|
+
* @example
|
|
2475
|
+
* ```typescript
|
|
2476
|
+
* let video1 = addVideo("video1", "https://pixijs.com/assets/video1.mp4")
|
|
2477
|
+
* await video1.load()
|
|
2478
|
+
* Assets.add({ alias: "video2", src: "https://pixijs.com/assets/video2.png" })
|
|
2479
|
+
* let video2 = addVideo("video2")
|
|
2480
|
+
* await video2.load()
|
|
2481
|
+
* ```
|
|
2482
|
+
*/
|
|
2483
|
+
declare function addVideo(alias: string, videoUrl?: string, options?: VideoSpriteOptions): VideoSprite;
|
|
2484
|
+
/**
|
|
2485
|
+
* Add and show a video in the canvas. This function is a combination of {@link addVideo} and {@link loadVideo}.
|
|
2486
|
+
* @param alias The unique alias of the video. You can use this alias to refer to this video
|
|
2487
|
+
* @param videoUrl The url of the video.
|
|
2488
|
+
* @param options The options of the video.
|
|
2489
|
+
* @returns A promise that is resolved when the video is loaded.
|
|
2490
|
+
* @example
|
|
2491
|
+
* ```typescript
|
|
2492
|
+
* let video1 = showVideo("video1", "https://pixijs.com/assets/video1.mp4")
|
|
2493
|
+
* Assets.add({ alias: "video2", src: "https://pixijs.com/assets/video2.png" })
|
|
2494
|
+
* let video2 = showVideo("video2")
|
|
2495
|
+
* ```
|
|
2496
|
+
*/
|
|
2497
|
+
declare function showVideo(alias: string, videoUrl?: string, options?: VideoSpriteOptions): Promise<VideoSprite>;
|
|
2498
|
+
|
|
2499
|
+
interface ShakeEffectProps extends BaseTransitionProps, AnimationOptions {
|
|
2500
|
+
/**
|
|
2501
|
+
* The number of shocks. **Must be at least 3**.
|
|
2502
|
+
* @default 10
|
|
2503
|
+
*/
|
|
2504
|
+
shocksNumber?: number;
|
|
2505
|
+
/**
|
|
2506
|
+
* The type of the shake effect
|
|
2507
|
+
* @default "horizontal"
|
|
2508
|
+
*/
|
|
2509
|
+
shakeType?: "horizontal" | "vertical";
|
|
2510
|
+
/**
|
|
2511
|
+
* The maximum size of the shock.
|
|
2512
|
+
* For horizontal type, it is the maximum size of the x axis.
|
|
2513
|
+
* For vertical type, it is the maximum size of the y axis.
|
|
2514
|
+
* @default 10
|
|
2515
|
+
*/
|
|
2516
|
+
maxShockSize?: number;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
declare const canvas: CanvasManagerInterface;
|
|
2520
|
+
|
|
2521
|
+
type canvasUtils_AnimationOptions = AnimationOptions;
|
|
2522
|
+
type canvasUtils_AnimationSequenceOptions = AnimationSequenceOptions;
|
|
2523
|
+
type canvasUtils_CanvasBaseInterface<T2 extends CanvasBaseItemMemory> = CanvasBaseInterface<T2>;
|
|
2524
|
+
type canvasUtils_CanvasBaseItem<T2 extends CanvasBaseItemMemory> = CanvasBaseItem<T2>;
|
|
2525
|
+
declare const canvasUtils_CanvasBaseItem: typeof CanvasBaseItem;
|
|
2526
|
+
type canvasUtils_CanvasBaseItemMemory = CanvasBaseItemMemory;
|
|
2527
|
+
type canvasUtils_CanvasEvent<C> = CanvasEvent<C>;
|
|
2528
|
+
declare const canvasUtils_CanvasEvent: typeof CanvasEvent;
|
|
2529
|
+
type canvasUtils_CanvasEventNamesType = CanvasEventNamesType;
|
|
2530
|
+
type canvasUtils_CanvasGameState = CanvasGameState;
|
|
2531
|
+
type canvasUtils_CanvasManagerInterface = CanvasManagerInterface;
|
|
2532
|
+
type canvasUtils_CanvasManagerStatic = CanvasManagerStatic;
|
|
2533
|
+
declare const canvasUtils_CanvasManagerStatic: typeof CanvasManagerStatic;
|
|
2534
|
+
type canvasUtils_CommonTickerProps = CommonTickerProps;
|
|
2535
|
+
type canvasUtils_Container<C extends ContainerChild = ContainerChild, Memory extends ContainerMemory = ContainerMemory> = Container<C, Memory>;
|
|
2536
|
+
declare const canvasUtils_Container: typeof Container;
|
|
2537
|
+
type canvasUtils_ContainerChild = ContainerChild;
|
|
2538
|
+
type canvasUtils_ContainerMemory<C extends ContainerChild = ContainerChild> = ContainerMemory<C>;
|
|
2539
|
+
type canvasUtils_FadeAlphaTicker = FadeAlphaTicker;
|
|
2540
|
+
declare const canvasUtils_FadeAlphaTicker: typeof FadeAlphaTicker;
|
|
2541
|
+
type canvasUtils_FadeAlphaTickerProps = FadeAlphaTickerProps;
|
|
2542
|
+
type canvasUtils_ImageContainer = ImageContainer;
|
|
2543
|
+
declare const canvasUtils_ImageContainer: typeof ImageContainer;
|
|
2544
|
+
type canvasUtils_ImageContainerMemory = ImageContainerMemory;
|
|
2545
|
+
type canvasUtils_ImageContainerOptions<C extends ContainerChild = ContainerChild> = ImageContainerOptions<C>;
|
|
2546
|
+
type canvasUtils_ImageSprite<Memory extends ImageSpriteMemory = ImageSpriteMemory> = ImageSprite<Memory>;
|
|
2547
|
+
declare const canvasUtils_ImageSprite: typeof ImageSprite;
|
|
2548
|
+
type canvasUtils_ImageSpriteMemory = ImageSpriteMemory;
|
|
2549
|
+
type canvasUtils_ImageSpriteOptions = ImageSpriteOptions;
|
|
2550
|
+
type canvasUtils_KeyframesType<T> = KeyframesType<T>;
|
|
2551
|
+
type canvasUtils_Layer = Layer;
|
|
2552
|
+
type canvasUtils_MoveInOutProps = MoveInOutProps;
|
|
2553
|
+
type canvasUtils_MoveTicker = MoveTicker;
|
|
2554
|
+
declare const canvasUtils_MoveTicker: typeof MoveTicker;
|
|
2555
|
+
type canvasUtils_MoveTickerProps = MoveTickerProps;
|
|
2556
|
+
type canvasUtils_ObjectSegment<O extends CanvasBaseInterface<any>> = ObjectSegment<O>;
|
|
2557
|
+
type canvasUtils_ObjectSegmentWithTransition<O extends CanvasBaseInterface<any>> = ObjectSegmentWithTransition<O>;
|
|
2558
|
+
type canvasUtils_PauseType = PauseType;
|
|
2559
|
+
type canvasUtils_PushInOutProps = PushInOutProps;
|
|
2560
|
+
declare const canvasUtils_RegisteredCanvasComponents: typeof RegisteredCanvasComponents;
|
|
2561
|
+
declare const canvasUtils_RegisteredEvents: typeof RegisteredEvents;
|
|
2562
|
+
declare const canvasUtils_RegisteredTickers: typeof RegisteredTickers;
|
|
2563
|
+
type canvasUtils_RepeatType = RepeatType;
|
|
2564
|
+
type canvasUtils_RotateTicker = RotateTicker;
|
|
2565
|
+
declare const canvasUtils_RotateTicker: typeof RotateTicker;
|
|
2566
|
+
type canvasUtils_RotateTickerProps = RotateTickerProps;
|
|
2567
|
+
type canvasUtils_SequenceOptions = SequenceOptions;
|
|
2568
|
+
type canvasUtils_ShakeEffectProps = ShakeEffectProps;
|
|
2569
|
+
type canvasUtils_ShowWithDissolveTransitionProps = ShowWithDissolveTransitionProps;
|
|
2570
|
+
type canvasUtils_ShowWithFadeTransitionProps = ShowWithFadeTransitionProps;
|
|
2571
|
+
type canvasUtils_Sprite<Memory extends SpriteOptions$1 & CanvasBaseItemMemory = SpriteMemory> = Sprite<Memory>;
|
|
2572
|
+
declare const canvasUtils_Sprite: typeof Sprite;
|
|
2573
|
+
type canvasUtils_SpriteBaseMemory = SpriteBaseMemory;
|
|
2574
|
+
type canvasUtils_SpriteMemory = SpriteMemory;
|
|
2575
|
+
type canvasUtils_SpriteOptions = SpriteOptions;
|
|
2576
|
+
type canvasUtils_Text = Text;
|
|
2577
|
+
declare const canvasUtils_Text: typeof Text;
|
|
2578
|
+
type canvasUtils_TextMemory = TextMemory;
|
|
2579
|
+
type canvasUtils_TextOptions = TextOptions;
|
|
2580
|
+
type canvasUtils_TextureMemory = TextureMemory;
|
|
2581
|
+
type canvasUtils_Ticker<TArgs extends TickerArgs> = Ticker<TArgs>;
|
|
2582
|
+
type canvasUtils_TickerArgs = TickerArgs;
|
|
2583
|
+
type canvasUtils_TickerBase<TArgs extends TickerArgs> = TickerBase<TArgs>;
|
|
2584
|
+
declare const canvasUtils_TickerBase: typeof TickerBase;
|
|
2585
|
+
type canvasUtils_TickerHistory<TArgs extends TickerArgs> = TickerHistory<TArgs>;
|
|
2586
|
+
type canvasUtils_TickerInfo<TArgs extends TickerArgs> = TickerInfo<TArgs>;
|
|
2587
|
+
type canvasUtils_TickerProgrationExponential = TickerProgrationExponential;
|
|
2588
|
+
type canvasUtils_TickerProgrationLinear = TickerProgrationLinear;
|
|
2589
|
+
type canvasUtils_TickerProgrationType = TickerProgrationType;
|
|
2590
|
+
type canvasUtils_TickerTimeoutHistory = TickerTimeoutHistory;
|
|
2591
|
+
type canvasUtils_TickerValue = TickerValue;
|
|
2592
|
+
type canvasUtils_TickersSequence = TickersSequence;
|
|
2593
|
+
type canvasUtils_VideoSprite = VideoSprite;
|
|
2594
|
+
declare const canvasUtils_VideoSprite: typeof VideoSprite;
|
|
2595
|
+
type canvasUtils_VideoSpriteMemory = VideoSpriteMemory;
|
|
2596
|
+
type canvasUtils_VideoSpriteOptions = VideoSpriteOptions;
|
|
2597
|
+
type canvasUtils_ZoomInOutProps = ZoomInOutProps;
|
|
2598
|
+
type canvasUtils_ZoomTicker = ZoomTicker;
|
|
2599
|
+
declare const canvasUtils_ZoomTicker: typeof ZoomTicker;
|
|
2600
|
+
type canvasUtils_ZoomTickerProps = ZoomTickerProps;
|
|
2601
|
+
declare const canvasUtils_addImage: typeof addImage;
|
|
2602
|
+
declare const canvasUtils_addImageCointainer: typeof addImageCointainer;
|
|
2603
|
+
declare const canvasUtils_addVideo: typeof addVideo;
|
|
2604
|
+
declare const canvasUtils_animate: typeof animate;
|
|
2605
|
+
declare const canvasUtils_canvas: typeof canvas;
|
|
2606
|
+
declare const canvasUtils_canvasComponentDecorator: typeof canvasComponentDecorator;
|
|
2607
|
+
declare const canvasUtils_eventDecorator: typeof eventDecorator;
|
|
2608
|
+
declare const canvasUtils_getTexture: typeof getTexture;
|
|
2609
|
+
declare const canvasUtils_moveIn: typeof moveIn;
|
|
2610
|
+
declare const canvasUtils_moveOut: typeof moveOut;
|
|
2611
|
+
declare const canvasUtils_pushIn: typeof pushIn;
|
|
2612
|
+
declare const canvasUtils_pushOut: typeof pushOut;
|
|
2613
|
+
declare const canvasUtils_removeWithDissolve: typeof removeWithDissolve;
|
|
2614
|
+
declare const canvasUtils_removeWithFade: typeof removeWithFade;
|
|
2615
|
+
declare const canvasUtils_shakeEffect: typeof shakeEffect;
|
|
2616
|
+
declare const canvasUtils_showImage: typeof showImage;
|
|
2617
|
+
declare const canvasUtils_showImageContainer: typeof showImageContainer;
|
|
2618
|
+
declare const canvasUtils_showVideo: typeof showVideo;
|
|
2619
|
+
declare const canvasUtils_showWithDissolve: typeof showWithDissolve;
|
|
2620
|
+
declare const canvasUtils_showWithFade: typeof showWithFade;
|
|
2621
|
+
declare const canvasUtils_tickerDecorator: typeof tickerDecorator;
|
|
2622
|
+
declare const canvasUtils_zoomIn: typeof zoomIn;
|
|
2623
|
+
declare const canvasUtils_zoomOut: typeof zoomOut;
|
|
2624
|
+
declare namespace canvasUtils {
|
|
2625
|
+
export { type canvasUtils_AnimationOptions as AnimationOptions, type canvasUtils_AnimationSequenceOptions as AnimationSequenceOptions, type canvasUtils_CanvasBaseInterface as CanvasBaseInterface, canvasUtils_CanvasBaseItem as CanvasBaseItem, type canvasUtils_CanvasBaseItemMemory as CanvasBaseItemMemory, canvasUtils_CanvasEvent as CanvasEvent, type canvasUtils_CanvasEventNamesType as CanvasEventNamesType, type canvasUtils_CanvasGameState as CanvasGameState, type canvasUtils_CanvasManagerInterface as CanvasManagerInterface, canvasUtils_CanvasManagerStatic as CanvasManagerStatic, type canvasUtils_CommonTickerProps as CommonTickerProps, canvasUtils_Container as Container, type canvasUtils_ContainerChild as ContainerChild, type canvasUtils_ContainerMemory as ContainerMemory, canvasUtils_FadeAlphaTicker as FadeAlphaTicker, type canvasUtils_FadeAlphaTickerProps as FadeAlphaTickerProps, canvasUtils_ImageContainer as ImageContainer, type canvasUtils_ImageContainerMemory as ImageContainerMemory, type canvasUtils_ImageContainerOptions as ImageContainerOptions, canvasUtils_ImageSprite as ImageSprite, type canvasUtils_ImageSpriteMemory as ImageSpriteMemory, type canvasUtils_ImageSpriteOptions as ImageSpriteOptions, type canvasUtils_KeyframesType as KeyframesType, type canvasUtils_Layer as Layer, type canvasUtils_MoveInOutProps as MoveInOutProps, canvasUtils_MoveTicker as MoveTicker, type canvasUtils_MoveTickerProps as MoveTickerProps, type canvasUtils_ObjectSegment as ObjectSegment, type canvasUtils_ObjectSegmentWithTransition as ObjectSegmentWithTransition, pixi_js as PIXI, type canvasUtils_PauseType as PauseType, type canvasUtils_PushInOutProps as PushInOutProps, canvasUtils_RegisteredCanvasComponents as RegisteredCanvasComponents, canvasUtils_RegisteredEvents as RegisteredEvents, canvasUtils_RegisteredTickers as RegisteredTickers, type canvasUtils_RepeatType as RepeatType, canvasUtils_RotateTicker as RotateTicker, type canvasUtils_RotateTickerProps as RotateTickerProps, type canvasUtils_SequenceOptions as SequenceOptions, type canvasUtils_ShakeEffectProps as ShakeEffectProps, type canvasUtils_ShowWithDissolveTransitionProps as ShowWithDissolveTransitionProps, type canvasUtils_ShowWithFadeTransitionProps as ShowWithFadeTransitionProps, canvasUtils_Sprite as Sprite, type canvasUtils_SpriteBaseMemory as SpriteBaseMemory, type canvasUtils_SpriteMemory as SpriteMemory, type canvasUtils_SpriteOptions as SpriteOptions, canvasUtils_Text as Text, type canvasUtils_TextMemory as TextMemory, type canvasUtils_TextOptions as TextOptions, type canvasUtils_TextureMemory as TextureMemory, type canvasUtils_Ticker as Ticker, type canvasUtils_TickerArgs as TickerArgs, canvasUtils_TickerBase as TickerBase, type canvasUtils_TickerHistory as TickerHistory, type canvasUtils_TickerInfo as TickerInfo, type canvasUtils_TickerProgrationExponential as TickerProgrationExponential, type canvasUtils_TickerProgrationLinear as TickerProgrationLinear, type canvasUtils_TickerProgrationType as TickerProgrationType, type canvasUtils_TickerTimeoutHistory as TickerTimeoutHistory, type canvasUtils_TickerValue as TickerValue, type canvasUtils_TickersSequence as TickersSequence, canvasUtils_VideoSprite as VideoSprite, type canvasUtils_VideoSpriteMemory as VideoSpriteMemory, type canvasUtils_VideoSpriteOptions as VideoSpriteOptions, type canvasUtils_ZoomInOutProps as ZoomInOutProps, canvasUtils_ZoomTicker as ZoomTicker, type canvasUtils_ZoomTickerProps as ZoomTickerProps, canvasUtils_addImage as addImage, canvasUtils_addImageCointainer as addImageCointainer, canvasUtils_addVideo as addVideo, canvasUtils_animate as animate, canvasUtils_canvas as canvas, canvasUtils_canvasComponentDecorator as canvasComponentDecorator, canvasUtils_eventDecorator as eventDecorator, canvasUtils_getTexture as getTexture, canvasUtils_moveIn as moveIn, canvasUtils_moveOut as moveOut, canvasUtils_pushIn as pushIn, canvasUtils_pushOut as pushOut, canvasUtils_removeWithDissolve as removeWithDissolve, canvasUtils_removeWithFade as removeWithFade, canvasUtils_shakeEffect as shakeEffect, canvasUtils_showImage as showImage, canvasUtils_showImageContainer as showImageContainer, canvasUtils_showVideo as showVideo, canvasUtils_showWithDissolve as showWithDissolve, canvasUtils_showWithFade as showWithFade, canvasUtils_tickerDecorator as tickerDecorator, canvasUtils_zoomIn as zoomIn, canvasUtils_zoomOut as zoomOut };
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
/**
|
|
2629
|
+
* CharacterBaseModelProps is an interface that is used to create a character model.
|
|
2630
|
+
*/
|
|
2631
|
+
interface CharacterBaseModelProps {
|
|
2632
|
+
/**
|
|
2633
|
+
* The name of the character.
|
|
2634
|
+
*/
|
|
2635
|
+
name?: string;
|
|
2636
|
+
/**
|
|
2637
|
+
* The surname of the character.
|
|
2638
|
+
*/
|
|
2639
|
+
surname?: string;
|
|
2640
|
+
/**
|
|
2641
|
+
* The age of the character.
|
|
2642
|
+
*/
|
|
2643
|
+
age?: number;
|
|
2644
|
+
/**
|
|
2645
|
+
* The icon of the character.
|
|
2646
|
+
*/
|
|
2647
|
+
icon?: string;
|
|
2648
|
+
/**
|
|
2649
|
+
* The color of the character.
|
|
2650
|
+
*/
|
|
2651
|
+
color?: string;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
type StorageElementPrimaryType = string | number | boolean | undefined | null | StorageElementPrimaryType[];
|
|
2655
|
+
type StorageElementInternalType = StorageElementPrimaryType | Record<string | number | symbol, StorageElementPrimaryType> | StorageElementInternalType[];
|
|
2656
|
+
/**
|
|
2657
|
+
* StorageElementType are all the types that can be stored in the storage
|
|
2658
|
+
*/
|
|
2659
|
+
type StorageElementType = StorageElementInternalType | Record<string | number | symbol, StorageElementInternalType> | {
|
|
2660
|
+
[key: string | number | symbol]: StorageElementType;
|
|
2661
|
+
} | StorageObjectType[] | (StorageElementPrimaryType | StorageElementInternalType | StorageElementType)[];
|
|
2662
|
+
/**
|
|
2663
|
+
* StorageObjectType are all the types that can be stored in the storage
|
|
2664
|
+
*/
|
|
2665
|
+
type StorageObjectType = Record<string | number | symbol, StorageElementType>;
|
|
2666
|
+
|
|
2667
|
+
interface StorageGameStateItem<T = StorageElementType> {
|
|
2668
|
+
key: string;
|
|
2669
|
+
value: T;
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Interface exported storage data
|
|
2673
|
+
*/
|
|
2674
|
+
type StorageGameState = {
|
|
2675
|
+
base: StorageGameStateItem[];
|
|
2676
|
+
temp: StorageGameStateItem[];
|
|
2677
|
+
tempDeadlines: StorageGameStateItem<number>[];
|
|
2678
|
+
flags: string[];
|
|
2679
|
+
} | StorageGameStateItem[] | {
|
|
2680
|
+
[key: string]: StorageElementType;
|
|
2681
|
+
};
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* StoredClassModel is a abstract class that contains the methods to store a class in the game.
|
|
2685
|
+
* I suggest you extend this class to create your own stored class.
|
|
2686
|
+
* @example
|
|
2687
|
+
* ```typescript
|
|
2688
|
+
* export class CharacterBaseModel extends StoredClassModel implements CharacterBaseModelProps {
|
|
2689
|
+
* constructor(id: string, props: CharacterBaseModelProps) {
|
|
2690
|
+
* super("___character___", id)
|
|
2691
|
+
* this.defaultName = props.name
|
|
2692
|
+
* this.defaultSurname = props.surname
|
|
2693
|
+
* }
|
|
2694
|
+
* private defaultName: string = ""
|
|
2695
|
+
* get name(): string {
|
|
2696
|
+
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
2697
|
+
* }
|
|
2698
|
+
* set name(value: string) {
|
|
2699
|
+
* this.setStorageProperty<string>("name", value)
|
|
2700
|
+
* }
|
|
2701
|
+
* private defaultSurname?: string
|
|
2702
|
+
* get surname(): string | undefined {
|
|
2703
|
+
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
2704
|
+
* }
|
|
2705
|
+
* set surname(value: string | undefined) {
|
|
2706
|
+
* this.setStorageProperty<string>("surname", value)
|
|
2707
|
+
* }
|
|
2708
|
+
* }
|
|
2709
|
+
* ```
|
|
2710
|
+
*/
|
|
2711
|
+
declare class StoredClassModel {
|
|
2712
|
+
/**
|
|
2713
|
+
* @param categoryId The id of the category. For example if you are storing a character class, you can use "characters" as categoryId. so all instances of the character class will be stored in the "characters" category.
|
|
2714
|
+
* @param id The id of instance of the class. This id must be unique for the category.
|
|
2715
|
+
*/
|
|
2716
|
+
constructor(categoryId: string, id: string);
|
|
2717
|
+
private _id;
|
|
2718
|
+
/**
|
|
2719
|
+
* Is id of the stored class. is unique for this class.
|
|
2720
|
+
*/
|
|
2721
|
+
get id(): string;
|
|
2722
|
+
private categoryId;
|
|
2723
|
+
/**
|
|
2724
|
+
* Update a property in the storage.
|
|
2725
|
+
* @param propertyName The name of the property to set.
|
|
2726
|
+
* @param value The value to set. If is undefined, the property will be removed from the storage.
|
|
2727
|
+
*/
|
|
2728
|
+
protected setStorageProperty<T>(propertyName: string, value: T | undefined): void;
|
|
2729
|
+
/**
|
|
2730
|
+
* Get a property from the storage.
|
|
2731
|
+
* @param propertyName The name of the property to get.
|
|
2732
|
+
* @param idToUse The id of the instance to get the property. @default this.id
|
|
2733
|
+
* @returns The value of the property. If the property is not found, returns undefined.
|
|
2734
|
+
*/
|
|
2735
|
+
protected getStorageProperty<T>(propertyName: string, idToUse?: string): T | undefined;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
declare class CachedMap<K extends {}, V extends {}> implements Map<K, V> {
|
|
2739
|
+
readonly cache: LRUCache<K, V>;
|
|
2740
|
+
readonly map: Map<K, V>;
|
|
2741
|
+
constructor(options: {
|
|
2742
|
+
cacheSize: number;
|
|
2743
|
+
});
|
|
2744
|
+
get [Symbol.iterator](): () => MapIterator<[K, V]>;
|
|
2745
|
+
get [Symbol.toStringTag](): string;
|
|
2746
|
+
clear(): void;
|
|
2747
|
+
delete(key: K): boolean;
|
|
2748
|
+
get forEach(): (callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any) => void;
|
|
2749
|
+
get(key: K): V | undefined;
|
|
2750
|
+
has(key: K): boolean;
|
|
2751
|
+
set(key: K, value: V): this;
|
|
2752
|
+
get size(): number;
|
|
2753
|
+
entries(): MapIterator<[K, V]>;
|
|
2754
|
+
keys(): MapIterator<K>;
|
|
2755
|
+
values(): MapIterator<V>;
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
declare class CharacterStoredClass extends StoredClassModel {
|
|
2759
|
+
private sourceId;
|
|
2760
|
+
constructor(id: string, emotion?: string);
|
|
2761
|
+
getStorageProperty<T>(propertyName: string): T | undefined;
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* CharacterBaseModel is a class that is used to create a character model.
|
|
2766
|
+
* You must use the {@link RegisteredCharacters.add} function to save the character in the game.
|
|
2767
|
+
* It is raccomended to create your own class Character, read more here: https://pixi-vn.web.app/start/character.html#custom-character
|
|
2768
|
+
* @example
|
|
2769
|
+
* ```typescript
|
|
2770
|
+
* export const liam = new CharacterBaseModel('liam', {
|
|
2771
|
+
* name: 'Liam',
|
|
2772
|
+
* surname: 'Smith',
|
|
2773
|
+
* age: 25,
|
|
2774
|
+
* icon: "https://pixijs.com/assets/eggHead.png",
|
|
2775
|
+
* color: "#9e2e12"
|
|
2776
|
+
* });
|
|
2777
|
+
* export const alice = new CharacterBaseModel('alice', {
|
|
2778
|
+
* name: 'Alice',
|
|
2779
|
+
* surname: 'Smith',
|
|
2780
|
+
* age: 25,
|
|
2781
|
+
* icon: "https://pixijs.com/assets/eggHead.png",
|
|
2782
|
+
* color: "#9e2e12"
|
|
2783
|
+
* });
|
|
2784
|
+
* RegisteredCharacters.add([liam, alice]);
|
|
2785
|
+
* ```
|
|
2786
|
+
*/
|
|
2787
|
+
declare class CharacterBaseModel extends CharacterStoredClass {
|
|
2788
|
+
/**
|
|
2789
|
+
* @param id The id of the character.
|
|
2790
|
+
* @param props The properties of the character.
|
|
2791
|
+
*/
|
|
2792
|
+
constructor(id: string | {
|
|
2793
|
+
id: string;
|
|
2794
|
+
emotion: string;
|
|
2795
|
+
}, props: CharacterBaseModelProps);
|
|
2796
|
+
private defaultName?;
|
|
2797
|
+
/***
|
|
2798
|
+
* The name of the character.
|
|
2799
|
+
* If you set undefined, it will return the default name.
|
|
2800
|
+
*/
|
|
2801
|
+
get name(): string;
|
|
2802
|
+
set name(value: string | undefined);
|
|
2803
|
+
private defaultSurname?;
|
|
2804
|
+
/**
|
|
2805
|
+
* The surname of the character.
|
|
2806
|
+
* If you set undefined, it will return the default surname.
|
|
2807
|
+
*/
|
|
2808
|
+
get surname(): string | undefined;
|
|
2809
|
+
set surname(value: string | undefined);
|
|
2810
|
+
private defaultAge?;
|
|
2811
|
+
/**
|
|
2812
|
+
* The age of the character.
|
|
2813
|
+
* If you set undefined, it will return the default age.
|
|
2814
|
+
*/
|
|
2815
|
+
get age(): number | undefined;
|
|
2816
|
+
set age(value: number | undefined);
|
|
2817
|
+
private _icon?;
|
|
2818
|
+
/**
|
|
2819
|
+
* The icon of the character.
|
|
2820
|
+
*/
|
|
2821
|
+
get icon(): string | undefined;
|
|
2822
|
+
private _color?;
|
|
2823
|
+
/**
|
|
2824
|
+
* The color of the character.
|
|
2825
|
+
*/
|
|
2826
|
+
get color(): string | undefined;
|
|
2827
|
+
}
|
|
2828
|
+
|
|
2829
|
+
declare namespace RegisteredCharacters {
|
|
2830
|
+
/**
|
|
2831
|
+
* is a function that returns the character by the id
|
|
2832
|
+
* @param id is the id of the character
|
|
2833
|
+
* @returns the character
|
|
2834
|
+
* @example
|
|
2835
|
+
* ```typescript
|
|
2836
|
+
* const liam = RegisteredCharacters.get('liam');
|
|
2837
|
+
* ```
|
|
2838
|
+
*/
|
|
2839
|
+
function get<T = CharacterInterface$1>(id: string): T | undefined;
|
|
2840
|
+
/**
|
|
2841
|
+
* Is a function that saves the character. If the character already exists, it will be overwritten.
|
|
2842
|
+
* @param character is the character to save
|
|
2843
|
+
* @returns
|
|
2844
|
+
* @example
|
|
2845
|
+
* ```typescript
|
|
2846
|
+
* export const liam = new CharacterBaseModel('liam', { name: 'Liam'});
|
|
2847
|
+
* export const alice = new CharacterBaseModel('alice', { name: 'Alice'});
|
|
2848
|
+
* RegisteredCharacters.add([liam, alice]);
|
|
2849
|
+
* ```
|
|
2850
|
+
*/
|
|
2851
|
+
function add(character: CharacterInterface$1 | CharacterInterface$1[]): void;
|
|
2852
|
+
/**
|
|
2853
|
+
* is a function that returns all characters
|
|
2854
|
+
* @returns all characters
|
|
2855
|
+
* @example
|
|
2856
|
+
* ```typescript
|
|
2857
|
+
* const allCharacters = RegisteredCharacters.values();
|
|
2858
|
+
* ```
|
|
2859
|
+
*/
|
|
2860
|
+
function values<T extends CharacterInterface$1>(): T[];
|
|
2861
|
+
/**
|
|
2862
|
+
* Check if a character is registered.
|
|
2863
|
+
* @param id is the id of the character
|
|
2864
|
+
* @returns true if the character exists, false otherwise
|
|
2865
|
+
*/
|
|
2866
|
+
function has(id: string): boolean;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
/**
|
|
2870
|
+
* CharacterInterface is the interface that character must implement or extend.
|
|
2871
|
+
* So if you want to create your own Character, you must override this interface, implement or extend it and extend the {@link CharacterStoredClass} class.
|
|
2872
|
+
* You can override this interface to add your own props.
|
|
2873
|
+
* @example
|
|
2874
|
+
* ```typescript
|
|
2875
|
+
* // pixi-vn.d.ts
|
|
2876
|
+
* declare module '@drincs/pixi-vn' {
|
|
2877
|
+
* interface CharacterInterface {
|
|
2878
|
+
* name: string
|
|
2879
|
+
* surname?: string
|
|
2880
|
+
* age?: number
|
|
2881
|
+
* icon?: string
|
|
2882
|
+
* color?: string
|
|
2883
|
+
* }
|
|
2884
|
+
* }
|
|
2885
|
+
* // You Character class
|
|
2886
|
+
* export class Character extends CharacterStoredClass implements CharacterInterface {
|
|
2887
|
+
* constructor(id: string, props: CharacterProps) {
|
|
2888
|
+
* super(id)
|
|
2889
|
+
* this.defaultName = props.name
|
|
2890
|
+
* this.defaultSurname = props.surname
|
|
2891
|
+
* this.defaultAge = props.age
|
|
2892
|
+
* this._icon = props.icon
|
|
2893
|
+
* this._color = props.color
|
|
2894
|
+
* }
|
|
2895
|
+
* private defaultName: string = ""
|
|
2896
|
+
* get name(): string {
|
|
2897
|
+
* return this.getStorageProperty<string>("name") || this.defaultName
|
|
2898
|
+
* }
|
|
2899
|
+
* set name(value: string | undefined) {
|
|
2900
|
+
* this.setStorageProperty<string>("name", value)
|
|
2901
|
+
* }
|
|
2902
|
+
* private defaultSurname?: string
|
|
2903
|
+
* get surname(): string | undefined {
|
|
2904
|
+
* return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
2905
|
+
* }
|
|
2906
|
+
* set surname(value: string | undefined) {
|
|
2907
|
+
* this.setStorageProperty<string>("surname", value)
|
|
2908
|
+
* }
|
|
2909
|
+
* private defaultAge?: number | undefined
|
|
2910
|
+
* get age(): number | undefined {
|
|
2911
|
+
* return this.getStorageProperty<number>("age") || this.defaultAge
|
|
2912
|
+
* }
|
|
2913
|
+
* set age(value: number | undefined) {
|
|
2914
|
+
* this.setStorageProperty<number>("age", value)
|
|
2915
|
+
* }
|
|
2916
|
+
* private _icon?: string
|
|
2917
|
+
* get icon(): string | undefined {
|
|
2918
|
+
* return this._icon
|
|
2919
|
+
* }
|
|
2920
|
+
* private _color?: string | undefined
|
|
2921
|
+
* get color(): string | undefined {
|
|
2922
|
+
* return this._color
|
|
2923
|
+
* }
|
|
2924
|
+
* }
|
|
2925
|
+
* ```
|
|
2926
|
+
*/
|
|
2927
|
+
interface CharacterInterface {
|
|
2928
|
+
/**
|
|
2929
|
+
* The id of the character. It must be unique.
|
|
2930
|
+
*/
|
|
2931
|
+
id: string;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
type characterUtils_CharacterBaseModel = CharacterBaseModel;
|
|
2935
|
+
declare const characterUtils_CharacterBaseModel: typeof CharacterBaseModel;
|
|
2936
|
+
type characterUtils_CharacterInterface = CharacterInterface;
|
|
2937
|
+
type characterUtils_CharacterStoredClass = CharacterStoredClass;
|
|
2938
|
+
declare const characterUtils_CharacterStoredClass: typeof CharacterStoredClass;
|
|
2939
|
+
declare const characterUtils_RegisteredCharacters: typeof RegisteredCharacters;
|
|
2940
|
+
declare namespace characterUtils {
|
|
2941
|
+
export { characterUtils_CharacterBaseModel as CharacterBaseModel, type characterUtils_CharacterInterface as CharacterInterface, characterUtils_CharacterStoredClass as CharacterStoredClass, characterUtils_RegisteredCharacters as RegisteredCharacters };
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
var version = "1.3.15";
|
|
45
2945
|
|
|
46
2946
|
declare const Repeat: RepeatType;
|
|
47
2947
|
/**
|
|
@@ -120,208 +3020,168 @@ declare const SYSTEM_RESERVED_STORAGE_KEYS: {
|
|
|
120
3020
|
LAST_STEP_GLUED: string;
|
|
121
3021
|
};
|
|
122
3022
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
getStepCounter: () => number;
|
|
131
|
-
/**
|
|
132
|
-
* This function sets the current step counter.
|
|
133
|
-
*
|
|
134
|
-
* If your game engine does not have a history of steps, you can not set the step counter.
|
|
135
|
-
*/
|
|
136
|
-
setStepCounter: (value: number) => void;
|
|
137
|
-
/**
|
|
138
|
-
* This function returns the current state of the game step.
|
|
139
|
-
*
|
|
140
|
-
* If your game engine does not have a history of steps, you can return an empty object.
|
|
141
|
-
*/
|
|
142
|
-
getCurrentGameStepState: () => GameStepState;
|
|
143
|
-
/**
|
|
144
|
-
* This function restores the game step state.
|
|
145
|
-
*
|
|
146
|
-
* If your game engine does not have a history of steps, you can return a resolved promise.
|
|
147
|
-
*
|
|
148
|
-
* @param state The state to restore.
|
|
149
|
-
* @param navigate The function to navigate to the restored path.
|
|
150
|
-
*/
|
|
151
|
-
restoreGameStepState: (state: GameStepState, navigate: (path: string) => void | Promise<void>) => Promise<void>;
|
|
152
|
-
/**
|
|
153
|
-
* This function returns the number of opened labels.
|
|
154
|
-
*
|
|
155
|
-
* If your game engine does not have a narration system, you can return 0.
|
|
156
|
-
*/
|
|
157
|
-
getOpenedLabels: () => number;
|
|
158
|
-
/**
|
|
159
|
-
* This function is called after the narration.goNext() method is executed.
|
|
160
|
-
* It can be used to force the completion of the ticker in the game engine.
|
|
161
|
-
*/
|
|
162
|
-
onGoNextEnd?: () => Promise<void>;
|
|
163
|
-
/**
|
|
164
|
-
* This function returns the value of a variable.
|
|
165
|
-
* @param key The key of the variable.
|
|
166
|
-
* @returns The value of the variable.
|
|
167
|
-
*/
|
|
168
|
-
getVariable: <T extends StorageElementType>(key: string) => T | undefined;
|
|
169
|
-
/**
|
|
170
|
-
* This function sets the value of a variable.
|
|
171
|
-
* @param key The key of the variable.
|
|
172
|
-
* @param value The value of the variable.
|
|
173
|
-
*/
|
|
174
|
-
setVariable: (key: string, value: StorageElementType) => void;
|
|
175
|
-
/**
|
|
176
|
-
* This function removes a variable.
|
|
177
|
-
* @param key The key of the variable.
|
|
178
|
-
*/
|
|
179
|
-
removeVariable: (key: string) => void;
|
|
180
|
-
/**
|
|
181
|
-
* This function returns the value of a flag.
|
|
182
|
-
* @param name The name of the flag.
|
|
183
|
-
*/
|
|
184
|
-
getFlag: (name: string) => boolean;
|
|
185
|
-
/**
|
|
186
|
-
* This function sets the value of a flag.
|
|
187
|
-
* @param name The name of the flag.
|
|
188
|
-
* @param value The value of the flag.
|
|
189
|
-
*/
|
|
190
|
-
setFlag: (name: string, value: boolean) => void;
|
|
191
|
-
/**
|
|
192
|
-
* This function is called after the narration.goNext() method is executed.
|
|
193
|
-
*
|
|
194
|
-
* It can be used to clear old temporary variables.
|
|
195
|
-
*
|
|
196
|
-
* @param openedLabelsNumber The number of opened labels.
|
|
197
|
-
*/
|
|
198
|
-
onLabelClosing?: (openedLabelsNumber: number) => void;
|
|
199
|
-
/**
|
|
200
|
-
* Add a history step to the history.
|
|
201
|
-
*
|
|
202
|
-
* If your game engine does not have a history of steps, you can return a resolved promise.
|
|
203
|
-
*
|
|
204
|
-
* @param historyInfo The history information.
|
|
205
|
-
* @param opstions Options to add the step.
|
|
206
|
-
*/
|
|
207
|
-
addHistoryItem(historyInfo?: HistoryInfo, opstions?: {
|
|
208
|
-
/**
|
|
209
|
-
* If true, the step will not be added to the history if the current step is the same as the last step.
|
|
210
|
-
*/
|
|
211
|
-
ignoreSameStep?: boolean;
|
|
212
|
-
}): void;
|
|
213
|
-
/**
|
|
214
|
-
* This function returns the number of steps that are currently running.
|
|
215
|
-
*/
|
|
216
|
-
getCurrentStepsRunningNumber: () => number;
|
|
217
|
-
/**
|
|
218
|
-
* This function returns the character by its id.
|
|
219
|
-
* @param id The id of the character.
|
|
220
|
-
* @returns The character or undefined if it does not exist.
|
|
221
|
-
*/
|
|
222
|
-
getCharacter: (id: string) => CharacterInterface | undefined;
|
|
223
|
-
}): void;
|
|
224
|
-
private static _getStepCounter;
|
|
225
|
-
private static _setStepCounter;
|
|
3023
|
+
/**
|
|
3024
|
+
* is a string containing the name of the label.
|
|
3025
|
+
* It is used to {@link narration.registeredLabels} to get the label class.
|
|
3026
|
+
*/
|
|
3027
|
+
type LabelIdType = string;
|
|
3028
|
+
|
|
3029
|
+
interface DialogueInterface {
|
|
226
3030
|
/**
|
|
227
|
-
*
|
|
3031
|
+
* The text of the dialogue.
|
|
228
3032
|
*/
|
|
229
|
-
|
|
3033
|
+
text: string | string[];
|
|
230
3034
|
/**
|
|
231
|
-
*
|
|
3035
|
+
* The id of the character that is speaking.
|
|
232
3036
|
*/
|
|
233
|
-
|
|
234
|
-
|
|
3037
|
+
character?: CharacterInterface$1 | string;
|
|
3038
|
+
}
|
|
3039
|
+
type StoredDialogue = Omit<DialogueInterface, "character"> & {
|
|
3040
|
+
character: string | undefined;
|
|
3041
|
+
};
|
|
3042
|
+
|
|
3043
|
+
interface HistoryStep {
|
|
235
3044
|
/**
|
|
236
|
-
*
|
|
3045
|
+
* The difference between the previous step and the current step.
|
|
237
3046
|
*/
|
|
238
|
-
|
|
239
|
-
private static _restoreGameStepState;
|
|
3047
|
+
diff?: deepDiff.Diff<GameStepState, GameStepState>[] | Difference[];
|
|
240
3048
|
/**
|
|
241
|
-
*
|
|
242
|
-
* @param state The state to restore.
|
|
243
|
-
* @param navigate The function to navigate to the restored path.
|
|
3049
|
+
* The label id of the current step.
|
|
244
3050
|
*/
|
|
245
|
-
|
|
246
|
-
private static _getOpenedLabels;
|
|
3051
|
+
currentLabel?: LabelIdType;
|
|
247
3052
|
/**
|
|
248
|
-
*
|
|
3053
|
+
* The sha1 of the step function.
|
|
249
3054
|
*/
|
|
250
|
-
|
|
251
|
-
private static _onGoNextEnd;
|
|
3055
|
+
stepSha1: string;
|
|
252
3056
|
/**
|
|
253
|
-
*
|
|
254
|
-
* It can be used to force the completion of the ticker in the game engine.
|
|
3057
|
+
* Equivalent to the narration.stepCounter
|
|
255
3058
|
*/
|
|
256
|
-
|
|
257
|
-
private static _getVariable;
|
|
3059
|
+
index: number;
|
|
258
3060
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @param key The key of the variable.
|
|
261
|
-
* @returns The value of the variable.
|
|
3061
|
+
* The data of the step of the label.
|
|
262
3062
|
*/
|
|
263
|
-
|
|
264
|
-
private static _setVariable;
|
|
3063
|
+
labelStepIndex: number | null;
|
|
265
3064
|
/**
|
|
266
|
-
*
|
|
267
|
-
* @param key The key of the variable.
|
|
268
|
-
* @param value The value of the variable.
|
|
3065
|
+
* @deprecated
|
|
269
3066
|
*/
|
|
270
|
-
|
|
271
|
-
private static _removeVariable;
|
|
3067
|
+
dialoge?: StoredDialogue;
|
|
272
3068
|
/**
|
|
273
|
-
*
|
|
274
|
-
* @param key The key of the variable.
|
|
3069
|
+
* Dialogue to be shown in the game
|
|
275
3070
|
*/
|
|
276
|
-
|
|
277
|
-
private static _getFlag;
|
|
3071
|
+
dialogue?: StoredDialogue;
|
|
278
3072
|
/**
|
|
279
|
-
*
|
|
280
|
-
* @param name The name of the flag.
|
|
3073
|
+
* List of choices asked of the player
|
|
281
3074
|
*/
|
|
282
|
-
|
|
283
|
-
private static _setFlag;
|
|
3075
|
+
choices?: StoredChoiceInterface[];
|
|
284
3076
|
/**
|
|
285
|
-
*
|
|
286
|
-
* @param name The name of the flag.
|
|
287
|
-
* @param value The value of the flag.
|
|
3077
|
+
* List of choices already made by the player
|
|
288
3078
|
*/
|
|
289
|
-
|
|
290
|
-
private static _onLabelClosing;
|
|
3079
|
+
alreadyMadeChoices?: number[];
|
|
291
3080
|
/**
|
|
292
|
-
*
|
|
293
|
-
* It can be used to clear old temporary variables.
|
|
294
|
-
* @param openedLabelsNumber The number of opened labels.
|
|
3081
|
+
* The input value of the player
|
|
295
3082
|
*/
|
|
296
|
-
|
|
297
|
-
private static _addHistoryItem;
|
|
3083
|
+
inputValue?: StorageElementType$1;
|
|
298
3084
|
/**
|
|
299
|
-
*
|
|
300
|
-
* @param historyInfo The history information.
|
|
301
|
-
* @param opstions Options to add the step.
|
|
3085
|
+
* The choice made by the player
|
|
302
3086
|
*/
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* If true, the step will not be added to the history if the current step is the same as the last step.
|
|
306
|
-
*/
|
|
307
|
-
ignoreSameStep?: boolean;
|
|
308
|
-
}) => void;
|
|
309
|
-
private static _getCurrentStepsRunningNumber;
|
|
3087
|
+
choiceIndexMade?: number;
|
|
310
3088
|
/**
|
|
311
|
-
*
|
|
3089
|
+
* If true, the current dialogue will be glued to the previous one.
|
|
312
3090
|
*/
|
|
313
|
-
|
|
314
|
-
private static _getCharacter;
|
|
3091
|
+
isGlued?: boolean;
|
|
315
3092
|
/**
|
|
316
|
-
*
|
|
317
|
-
|
|
318
|
-
|
|
3093
|
+
* Opened Labels in the current step.
|
|
3094
|
+
*/
|
|
3095
|
+
openedLabels?: OpenedLabel$1[];
|
|
3096
|
+
}
|
|
3097
|
+
|
|
3098
|
+
interface OpenedLabel {
|
|
3099
|
+
label: LabelIdType;
|
|
3100
|
+
currentStepIndex: number;
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
/**
|
|
3104
|
+
* Interface exported step data
|
|
3105
|
+
*/
|
|
3106
|
+
interface HistoryGameState {
|
|
3107
|
+
stepsHistory: HistoryStep[];
|
|
3108
|
+
originalStepData: GameStepState | undefined;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
interface GameState {
|
|
3112
|
+
pixivn_version: string;
|
|
3113
|
+
stepData: NarrationGameState;
|
|
3114
|
+
storageData: StorageGameState;
|
|
3115
|
+
canvasData: CanvasGameState;
|
|
3116
|
+
soundData: SoundGameState;
|
|
3117
|
+
historyData: HistoryGameState;
|
|
3118
|
+
path: string;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
declare class SoundManagerStatic {
|
|
3122
|
+
private constructor();
|
|
3123
|
+
static soundAliasesOrder: string[];
|
|
3124
|
+
static soundsPlaying: {
|
|
3125
|
+
[key: string]: SoundPlay;
|
|
3126
|
+
};
|
|
3127
|
+
static sounds: {
|
|
3128
|
+
[key: string]: Sound;
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
declare const sound: SoundManager;
|
|
3133
|
+
|
|
3134
|
+
type soundUtils_ExportedSound = ExportedSound;
|
|
3135
|
+
type soundUtils_Sound = Sound;
|
|
3136
|
+
declare const soundUtils_Sound: typeof Sound;
|
|
3137
|
+
type soundUtils_SoundFilterMemory = SoundFilterMemory;
|
|
3138
|
+
type soundUtils_SoundGameState = SoundGameState;
|
|
3139
|
+
type soundUtils_SoundManagerStatic = SoundManagerStatic;
|
|
3140
|
+
declare const soundUtils_SoundManagerStatic: typeof SoundManagerStatic;
|
|
3141
|
+
type soundUtils_SoundOptions = SoundOptions;
|
|
3142
|
+
type soundUtils_SoundPlayOptions = SoundPlayOptions;
|
|
3143
|
+
declare const soundUtils_sound: typeof sound;
|
|
3144
|
+
declare namespace soundUtils {
|
|
3145
|
+
export { type soundUtils_ExportedSound as ExportedSound, soundUtils_Sound as Sound, type soundUtils_SoundFilterMemory as SoundFilterMemory, type soundUtils_SoundGameState as SoundGameState, soundUtils_SoundManagerStatic as SoundManagerStatic, type soundUtils_SoundOptions as SoundOptions, type soundUtils_SoundPlayOptions as SoundPlayOptions, soundUtils_sound as sound };
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
/**
|
|
3149
|
+
* It is a interface that contains the information of a step.
|
|
3150
|
+
*/
|
|
3151
|
+
interface GameStepStateData {
|
|
3152
|
+
/**
|
|
3153
|
+
* The browser path that occurred during the progression of the steps.
|
|
3154
|
+
*/
|
|
3155
|
+
path: string;
|
|
3156
|
+
/**
|
|
3157
|
+
* The storage that occurred during the progression of the steps.
|
|
3158
|
+
*/
|
|
3159
|
+
storage: StorageGameState;
|
|
3160
|
+
/**
|
|
3161
|
+
* The index of the label that occurred during the progression of the steps.
|
|
3162
|
+
*/
|
|
3163
|
+
labelIndex: number;
|
|
3164
|
+
/**
|
|
3165
|
+
* The canvas that occurred during the progression of the steps.
|
|
3166
|
+
*/
|
|
3167
|
+
canvas: CanvasGameState;
|
|
3168
|
+
/**
|
|
3169
|
+
* The opened labels that occurred during the progression of the steps.
|
|
3170
|
+
*/
|
|
3171
|
+
openedLabels: OpenedLabel[];
|
|
3172
|
+
/**
|
|
3173
|
+
* The sound data that occurred during the progression of the steps.
|
|
319
3174
|
*/
|
|
320
|
-
|
|
321
|
-
static onEnd?: StepLabelType;
|
|
322
|
-
static onError?: (type: "step", error: any, props: StepLabelPropsType) => void;
|
|
3175
|
+
sound: SoundGameState;
|
|
323
3176
|
}
|
|
324
3177
|
|
|
3178
|
+
/**
|
|
3179
|
+
* This function is used to create a deep copy of the element
|
|
3180
|
+
* @param element The element to be copied
|
|
3181
|
+
* @returns The copied element
|
|
3182
|
+
*/
|
|
3183
|
+
declare function createExportableElement<T>(element: T): T;
|
|
3184
|
+
|
|
325
3185
|
declare namespace Game {
|
|
326
3186
|
/**
|
|
327
3187
|
* Initialize the Game and PixiJS Application and the interface div.
|
|
@@ -378,7 +3238,7 @@ declare namespace Game {
|
|
|
378
3238
|
* })
|
|
379
3239
|
* ```
|
|
380
3240
|
*/
|
|
381
|
-
function onEnd(value: StepLabelType): void;
|
|
3241
|
+
function onEnd(value: narrationUtils.StepLabelType): void;
|
|
382
3242
|
/**
|
|
383
3243
|
* Function to be executed when an error occurs in the step.
|
|
384
3244
|
* @example
|
|
@@ -389,14 +3249,14 @@ declare namespace Game {
|
|
|
389
3249
|
* })
|
|
390
3250
|
* ```
|
|
391
3251
|
*/
|
|
392
|
-
function onError(value: (type: "step", error: any, props: StepLabelPropsType) => void): void;
|
|
3252
|
+
function onError(value: (type: "step", error: any, props: narrationUtils.StepLabelPropsType) => void): void;
|
|
393
3253
|
/**
|
|
394
3254
|
* Is a function that will be executed before any step is executed.
|
|
395
3255
|
* @param stepId Step id
|
|
396
3256
|
* @param label Label
|
|
397
3257
|
* @returns
|
|
398
3258
|
*/
|
|
399
|
-
function onStepStart(value: (stepId: number, label: LabelAbstract<any>) => void | Promise<void>): void;
|
|
3259
|
+
function onStepStart(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
|
|
400
3260
|
/**
|
|
401
3261
|
* Is a function that will be executed in {@link Game.onStepStart} if the id of the step is 0
|
|
402
3262
|
* and when the user laods a save file.
|
|
@@ -413,21 +3273,21 @@ declare namespace Game {
|
|
|
413
3273
|
* })
|
|
414
3274
|
* ```
|
|
415
3275
|
*/
|
|
416
|
-
function onLoadingLabel(value: (stepId: number, label: LabelAbstract<any>) => void | Promise<void>): void;
|
|
3276
|
+
function onLoadingLabel(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
|
|
417
3277
|
/**
|
|
418
3278
|
* Is a function that will be executed when the step ends.
|
|
419
3279
|
* @param stepId Step id
|
|
420
3280
|
* @param label Label
|
|
421
3281
|
* @returns
|
|
422
3282
|
*/
|
|
423
|
-
function onStepEnd(value: (stepId: number, label: LabelAbstract<any>) => void | Promise<void>): void;
|
|
3283
|
+
function onStepEnd(value: (stepId: number, label: narrationUtils.LabelAbstract<any>) => void | Promise<void>): void;
|
|
424
3284
|
}
|
|
425
3285
|
declare const _default: {
|
|
426
3286
|
canvas: CanvasManagerInterface;
|
|
427
|
-
narration: NarrationManagerInterface;
|
|
3287
|
+
narration: narrationUtils.NarrationManagerInterface;
|
|
428
3288
|
sound: SoundManager;
|
|
429
|
-
storage: StorageManagerInterface;
|
|
430
|
-
history: HistoryManagerInterface;
|
|
3289
|
+
storage: storageUtils.StorageManagerInterface;
|
|
3290
|
+
history: historyUtils.HistoryManagerInterface;
|
|
431
3291
|
Game: typeof Game;
|
|
432
3292
|
GameUnifier: typeof GameUnifier;
|
|
433
3293
|
createExportableElement: typeof createExportableElement;
|
|
@@ -467,4 +3327,4 @@ declare const _default: {
|
|
|
467
3327
|
PIXIVN_VERSION: string;
|
|
468
3328
|
};
|
|
469
3329
|
|
|
470
|
-
export { CANVAS_APP_GAME_LAYER_ALIAS, CanvasManagerInterface, Game, GameState,
|
|
3330
|
+
export { type AnimationOptions, type AnimationSequenceOptions, CANVAS_APP_GAME_LAYER_ALIAS, CachedMap, type CanvasBaseInterface, CanvasBaseItem, type CanvasBaseItemMemory, CanvasEvent, type CanvasEventNamesType, type CanvasGameState, type CanvasManagerInterface, CanvasManagerStatic, CharacterBaseModel, type CharacterInterface, CharacterStoredClass, type CommonTickerProps, Container, type ContainerChild, type ContainerMemory, type ExportedSound, FadeAlphaTicker, type FadeAlphaTickerProps, Game, type GameState, type GameStepStateData, ImageContainer, type ImageContainerMemory, type ImageContainerOptions, ImageSprite, type ImageSpriteMemory, type ImageSpriteOptions, type KeyframesType, type Layer, type MoveInOutProps, MoveTicker, type MoveTickerProps, type ObjectSegment, type ObjectSegmentWithTransition, version as PIXIVN_VERSION, Pause, type PauseType, type PushInOutProps, RegisteredCanvasComponents, RegisteredCharacters, RegisteredEvents, RegisteredTickers, Repeat, type RepeatType, RotateTicker, type RotateTickerProps, SYSTEM_RESERVED_STORAGE_KEYS, type SequenceOptions, type ShakeEffectProps, type ShowWithDissolveTransitionProps, type ShowWithFadeTransitionProps, Sound, type SoundFilterMemory, type SoundGameState, SoundManagerStatic, type SoundOptions, type SoundPlayOptions, Sprite, type SpriteBaseMemory, type SpriteMemory, type SpriteOptions, Text, type TextMemory, type TextOptions, type TextureMemory, type Ticker, type TickerArgs, TickerBase, type TickerHistory, type TickerInfo, type TickerProgrationExponential, type TickerProgrationLinear, type TickerProgrationType, type TickerTimeoutHistory, type TickersSequence, VideoSprite, type VideoSpriteMemory, type VideoSpriteOptions, type ZoomInOutProps, ZoomTicker, type ZoomTickerProps, addImage, addImageCointainer, addVideo, animate, canvas, canvasComponentDecorator, createExportableElement, _default as default, eventDecorator, filters, getTexture, moveIn, moveOut, pushIn, pushOut, removeWithDissolve, removeWithFade, shakeEffect, showImage, showImageContainer, showVideo, showWithDissolve, showWithFade, sound, tickerDecorator, zoomIn, zoomOut };
|