modern-canvas 0.1.10 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -26
- package/dist/index.cjs +10366 -9598
- package/dist/index.d.cts +1356 -1343
- package/dist/index.d.mts +1356 -1343
- package/dist/index.d.ts +1356 -1343
- package/dist/index.js +124 -105
- package/dist/index.mjs +10360 -9589
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,55 +1,153 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Path2D, LineStyle, LineCap, LineJoin, BoundingBox } from 'modern-path2d';
|
|
3
|
-
import { AnyColor, Colord } from 'colord';
|
|
1
|
+
import { Font } from 'modern-font';
|
|
4
2
|
import { AnimationItem } from 'lottie-web';
|
|
3
|
+
import { AnyColor, Colord } from 'colord';
|
|
4
|
+
import { IDOCTextStyleDeclaration, IDOCTransformStyleDeclaration, Visibility, Overflow } from 'modern-idoc';
|
|
5
|
+
import { Path2D, LineStyle, LineCap, LineJoin } from 'modern-path2d';
|
|
5
6
|
import { TextOptions, Text, MeasureResult } from 'modern-text';
|
|
6
|
-
import { Font } from 'modern-font';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
value: string;
|
|
11
|
-
intValue: number;
|
|
12
|
-
normalizedIntValue: number;
|
|
13
|
-
normalizedDefaultIntValue: number;
|
|
8
|
+
declare abstract class Loader {
|
|
9
|
+
abstract install(assets: Assets): this;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
|
|
12
|
+
declare class FontLoader extends Loader {
|
|
13
|
+
load: (url: string) => Promise<Font>;
|
|
14
|
+
install(assets: Assets): this;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
|
|
17
|
+
declare const customNodes: Map<string, any>;
|
|
18
|
+
declare function customNode<T = Record<string, any>>(tag: string, defaultProperties?: Partial<T>): ClassDecorator;
|
|
19
|
+
|
|
20
|
+
interface PropertyDeclaration {
|
|
21
|
+
readonly default?: any;
|
|
22
|
+
readonly protected?: boolean;
|
|
23
|
+
readonly alias?: string;
|
|
24
24
|
}
|
|
25
|
-
declare function
|
|
26
|
-
declare function
|
|
27
|
-
declare function
|
|
25
|
+
declare function getDeclarations(constructor: any): Map<PropertyKey, PropertyDeclaration>;
|
|
26
|
+
declare function defineProperty(constructor: any, name: PropertyKey, declaration?: PropertyDeclaration): void;
|
|
27
|
+
declare function property(options?: PropertyDeclaration): PropertyDecorator;
|
|
28
28
|
|
|
29
|
-
declare
|
|
30
|
-
|
|
31
|
-
declare
|
|
32
|
-
|
|
33
|
-
declare
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
declare function protectedProperty(options?: Omit<PropertyDeclaration, 'protected'>): PropertyDecorator;
|
|
30
|
+
|
|
31
|
+
declare function createNode<T = any>(tag?: string, options?: Record<string, any>): T;
|
|
32
|
+
|
|
33
|
+
declare function nextTick(cb?: () => void): Promise<void>;
|
|
34
|
+
|
|
35
|
+
type Callback = () => void;
|
|
36
|
+
interface QueueItem {
|
|
37
|
+
cb: Callback;
|
|
38
|
+
once: boolean;
|
|
39
|
+
}
|
|
40
|
+
interface Options {
|
|
41
|
+
sort?: number;
|
|
42
|
+
once?: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare class Ticker {
|
|
45
|
+
protected static _queue: QueueItem[][];
|
|
46
|
+
protected static _currentTime: number;
|
|
47
|
+
protected static _elapsed: number;
|
|
48
|
+
protected static _requestId?: number;
|
|
49
|
+
static get currentTime(): number;
|
|
50
|
+
static get elapsed(): number;
|
|
51
|
+
static on(cb: Callback, options?: Options): void;
|
|
52
|
+
static off(cb: Callback, options?: Options): void;
|
|
53
|
+
static start(): void;
|
|
54
|
+
static stop(): void;
|
|
55
|
+
protected static _update(time: number): void;
|
|
56
|
+
protected static _performUpdate(): void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ns-resize' | 'ew-resize' | 'nesw-resize' | 'col-resize' | 'nwse-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out' | 'grab' | 'grabbing';
|
|
60
|
+
|
|
61
|
+
declare class InputEvent<N extends UIEvent = UIEvent> implements UIEvent {
|
|
62
|
+
bubbles: boolean;
|
|
63
|
+
readonly cancelable = false;
|
|
64
|
+
which: number;
|
|
65
|
+
cancelBubble: boolean;
|
|
66
|
+
returnValue: boolean;
|
|
67
|
+
srcElement: EventTarget;
|
|
68
|
+
readonly composed = false;
|
|
69
|
+
currentTarget: any;
|
|
70
|
+
defaultPrevented: boolean;
|
|
71
|
+
eventPhase: number;
|
|
72
|
+
isTrusted: boolean;
|
|
73
|
+
target: any;
|
|
74
|
+
timeStamp: number;
|
|
75
|
+
type: string;
|
|
76
|
+
nativeEvent: N;
|
|
77
|
+
originalEvent: InputEvent<N> | null;
|
|
78
|
+
propagationStopped: boolean;
|
|
79
|
+
propagationImmediatelyStopped: boolean;
|
|
80
|
+
path: any[];
|
|
81
|
+
detail: number;
|
|
82
|
+
view: WindowProxy;
|
|
83
|
+
layer: {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
};
|
|
87
|
+
get layerX(): number;
|
|
88
|
+
get layerY(): number;
|
|
89
|
+
page: {
|
|
90
|
+
x: number;
|
|
91
|
+
y: number;
|
|
92
|
+
};
|
|
93
|
+
get pageX(): number;
|
|
94
|
+
get pageY(): number;
|
|
95
|
+
initEvent(..._args: any[]): void;
|
|
96
|
+
initUIEvent(..._args: any[]): void;
|
|
97
|
+
composedPath(): any[];
|
|
98
|
+
preventDefault(): void;
|
|
99
|
+
stopImmediatePropagation(): void;
|
|
100
|
+
stopPropagation(): void;
|
|
101
|
+
readonly NONE = 0;
|
|
102
|
+
readonly CAPTURING_PHASE = 1;
|
|
103
|
+
readonly AT_TARGET = 2;
|
|
104
|
+
readonly BUBBLING_PHASE = 3;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare class MouseInputEvent extends InputEvent implements MouseEvent {
|
|
108
|
+
altKey: boolean;
|
|
109
|
+
button: number;
|
|
110
|
+
buttons: number;
|
|
111
|
+
ctrlKey: boolean;
|
|
112
|
+
metaKey: boolean;
|
|
113
|
+
relatedTarget: EventTarget | null;
|
|
114
|
+
shiftKey: boolean;
|
|
115
|
+
client: {
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
};
|
|
119
|
+
get clientX(): number;
|
|
120
|
+
get clientY(): number;
|
|
121
|
+
get x(): number;
|
|
122
|
+
get y(): number;
|
|
123
|
+
detail: number;
|
|
124
|
+
movement: {
|
|
125
|
+
x: number;
|
|
126
|
+
y: number;
|
|
127
|
+
};
|
|
128
|
+
get movementX(): number;
|
|
129
|
+
get movementY(): number;
|
|
130
|
+
offset: {
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
};
|
|
134
|
+
get offsetX(): number;
|
|
135
|
+
get offsetY(): number;
|
|
136
|
+
global: {
|
|
137
|
+
x: number;
|
|
138
|
+
y: number;
|
|
139
|
+
};
|
|
140
|
+
get globalX(): number;
|
|
141
|
+
get globalY(): number;
|
|
142
|
+
screen: {
|
|
143
|
+
x: number;
|
|
144
|
+
y: number;
|
|
145
|
+
};
|
|
146
|
+
get screenX(): number;
|
|
147
|
+
get screenY(): number;
|
|
148
|
+
getModifierState(key: string): boolean;
|
|
149
|
+
initMouseEvent(..._args: any[]): void;
|
|
150
|
+
}
|
|
53
151
|
|
|
54
152
|
type EventListenerValue = (...args: any[]) => void;
|
|
55
153
|
type EventListenerOptions = boolean | AddEventListenerOptions;
|
|
@@ -67,81 +165,25 @@ declare class EventEmitter {
|
|
|
67
165
|
emit(type: string, ...args: any[]): boolean;
|
|
68
166
|
}
|
|
69
167
|
|
|
70
|
-
|
|
71
|
-
protected _map: WeakMap<K, V>;
|
|
72
|
-
protected _toRaw(value: any): any;
|
|
73
|
-
/**
|
|
74
|
-
* Removes the specified element from the WeakMap.
|
|
75
|
-
* @returns true if the element was successfully removed, or false if it was not present.
|
|
76
|
-
*/
|
|
77
|
-
delete(key: K): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @returns a specified element.
|
|
80
|
-
*/
|
|
81
|
-
get(key: K): V | undefined;
|
|
82
|
-
/**
|
|
83
|
-
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
84
|
-
*/
|
|
85
|
-
has(key: K): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Adds a new element with a specified key and value.
|
|
88
|
-
* @param key Must be an object or symbol.
|
|
89
|
-
*/
|
|
90
|
-
set(key: K, value: V): this;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
declare const PI: number;
|
|
94
|
-
declare const PI_2: number;
|
|
95
|
-
declare function uid(object?: Record<string, any>): number;
|
|
96
|
-
declare function isPow2(v: number): boolean;
|
|
97
|
-
|
|
98
|
-
interface CustomNodeOptions {
|
|
99
|
-
tag: string;
|
|
100
|
-
renderable?: boolean;
|
|
101
|
-
}
|
|
102
|
-
declare const customNodes: Map<string, any>;
|
|
103
|
-
declare function customNode(tag: string): ClassDecorator;
|
|
104
|
-
declare function customNode(options: CustomNodeOptions): ClassDecorator;
|
|
105
|
-
|
|
106
|
-
interface PropertyDeclaration {
|
|
107
|
-
readonly default?: any;
|
|
108
|
-
readonly protected?: boolean;
|
|
109
|
-
readonly alias?: string;
|
|
110
|
-
}
|
|
111
|
-
declare function getDeclarations(constructor: any): Map<PropertyKey, PropertyDeclaration>;
|
|
112
|
-
declare function defineProperty(constructor: any, name: PropertyKey, declaration?: PropertyDeclaration): void;
|
|
113
|
-
declare function property(options?: PropertyDeclaration): PropertyDecorator;
|
|
114
|
-
declare function protectedProperty(options?: Omit<PropertyDeclaration, 'protected'>): PropertyDecorator;
|
|
115
|
-
|
|
116
|
-
interface _ObjectEventMap {
|
|
168
|
+
interface CoreObjectEventMap {
|
|
117
169
|
updateProperty: (key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration) => void;
|
|
118
170
|
}
|
|
119
|
-
interface
|
|
120
|
-
on: (<K extends keyof
|
|
121
|
-
off: (<K extends keyof
|
|
122
|
-
emit: (<K extends keyof
|
|
171
|
+
interface CoreObject {
|
|
172
|
+
on: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
173
|
+
off: (<K extends keyof CoreObjectEventMap>(type: K, listener: CoreObjectEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
174
|
+
emit: (<K extends keyof CoreObjectEventMap>(type: K, ...args: Parameters<CoreObjectEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
123
175
|
}
|
|
124
|
-
|
|
125
|
-
* Object 是所有 Godot 类的根类。
|
|
126
|
-
* 它提供了基础的功能,如内存管理、信号(signals)机制、实例化和对象生命周期等。
|
|
127
|
-
*
|
|
128
|
-
* 功能和用途:
|
|
129
|
-
* • 所有的类都继承自 Object,这使得 Godot 中的所有对象都能共享一些基础的功能。
|
|
130
|
-
* • 提供了内存管理功能,例如销毁对象。
|
|
131
|
-
* • 支持信号机制,允许对象间进行通信。
|
|
132
|
-
* • 支持对象的序列化和保存。
|
|
133
|
-
*/
|
|
134
|
-
declare class _Object extends EventEmitter {
|
|
176
|
+
declare class CoreObject extends EventEmitter {
|
|
135
177
|
readonly instanceId: number;
|
|
136
178
|
protected _defaultProperties?: Record<PropertyKey, any>;
|
|
137
179
|
protected _updatedProperties: Map<PropertyKey, unknown>;
|
|
138
180
|
protected _changedProperties: Set<PropertyKey>;
|
|
139
|
-
protected
|
|
140
|
-
protected
|
|
181
|
+
protected _updatingPromise: Promise<void>;
|
|
182
|
+
protected _updating: boolean;
|
|
141
183
|
protected _enqueueUpdate(): Promise<void>;
|
|
142
184
|
protected _performUpdate(): void;
|
|
143
185
|
protected _onUpdate(changed: Map<PropertyKey, unknown>): void;
|
|
144
|
-
protected
|
|
186
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
145
187
|
isDirty(key: string): boolean;
|
|
146
188
|
getPropertyDeclarations(): Map<PropertyKey, PropertyDeclaration>;
|
|
147
189
|
getPropertyDeclaration(key: PropertyKey): PropertyDeclaration | undefined;
|
|
@@ -152,44 +194,513 @@ declare class _Object extends EventEmitter {
|
|
|
152
194
|
setProperties(properties?: Record<PropertyKey, any>): this;
|
|
153
195
|
requestUpdate(key?: PropertyKey, oldValue?: unknown, declaration?: PropertyDeclaration): void;
|
|
154
196
|
toJSON(): Record<string, any>;
|
|
197
|
+
clone(): this;
|
|
155
198
|
destroy(): void;
|
|
156
199
|
}
|
|
157
200
|
|
|
158
|
-
|
|
159
|
-
view?: HTMLCanvasElement;
|
|
160
|
-
pixelRatio: number;
|
|
161
|
-
readonly screen: {
|
|
162
|
-
x: number;
|
|
163
|
-
y: number;
|
|
164
|
-
width: number;
|
|
165
|
-
height: number;
|
|
166
|
-
};
|
|
167
|
-
readonly related: RawWeakMap<object, any>;
|
|
168
|
-
getRelated<T>(source: object, createFn?: () => T): T;
|
|
169
|
-
resize(width: number, height: number, updateStyle?: boolean): void;
|
|
201
|
+
interface RefCountedEventMap extends CoreObjectEventMap {
|
|
170
202
|
}
|
|
171
|
-
|
|
172
|
-
type
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
usage?: WebGLBufferUsage;
|
|
176
|
-
data: BufferSource | number[] | null;
|
|
203
|
+
interface RefCounted {
|
|
204
|
+
on: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
205
|
+
off: (<K extends keyof RefCountedEventMap>(type: K, listener: RefCountedEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
206
|
+
emit: (<K extends keyof RefCountedEventMap>(type: K, ...args: Parameters<RefCountedEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
177
207
|
}
|
|
178
|
-
|
|
179
|
-
interface WebGLBufferMeta {
|
|
180
|
-
id: number;
|
|
181
|
-
target?: WebGLBufferTarget;
|
|
182
|
-
usage?: WebGLBufferUsage;
|
|
183
|
-
length: number;
|
|
184
|
-
byteLength: number;
|
|
185
|
-
bytesPerElement: number;
|
|
208
|
+
declare class RefCounted extends CoreObject {
|
|
186
209
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
210
|
+
|
|
211
|
+
declare class PointerInputEvent extends MouseInputEvent implements PointerEvent {
|
|
212
|
+
altitudeAngle: number;
|
|
213
|
+
azimuthAngle: number;
|
|
214
|
+
pointerId: number;
|
|
215
|
+
width: number;
|
|
216
|
+
height: number;
|
|
217
|
+
isPrimary: boolean;
|
|
218
|
+
pointerType: string;
|
|
219
|
+
pressure: number;
|
|
220
|
+
tangentialPressure: number;
|
|
221
|
+
tiltX: number;
|
|
222
|
+
tiltY: number;
|
|
223
|
+
twist: number;
|
|
224
|
+
detail: number;
|
|
225
|
+
getCoalescedEvents(): PointerEvent[];
|
|
226
|
+
getPredictedEvents(): PointerEvent[];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare class WheelInputEvent extends MouseInputEvent implements WheelEvent {
|
|
230
|
+
deltaMode: number;
|
|
231
|
+
deltaX: number;
|
|
232
|
+
deltaY: number;
|
|
233
|
+
deltaZ: number;
|
|
234
|
+
static readonly DOM_DELTA_PIXEL = 0;
|
|
235
|
+
readonly DOM_DELTA_PIXEL = 0;
|
|
236
|
+
static readonly DOM_DELTA_LINE = 1;
|
|
237
|
+
readonly DOM_DELTA_LINE = 1;
|
|
238
|
+
static readonly DOM_DELTA_PAGE = 2;
|
|
239
|
+
readonly DOM_DELTA_PAGE = 2;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface InputEventMap {
|
|
243
|
+
pointerdown: (ev: PointerInputEvent) => void;
|
|
244
|
+
pointerover: (ev: PointerInputEvent) => void;
|
|
245
|
+
pointermove: (ev: PointerInputEvent) => void;
|
|
246
|
+
pointerup: (ev: PointerInputEvent) => void;
|
|
247
|
+
wheel: (ev: WheelInputEvent) => void;
|
|
248
|
+
}
|
|
249
|
+
type InputEventKey = keyof InputEventMap;
|
|
250
|
+
interface Input {
|
|
251
|
+
on: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
252
|
+
off: (<K extends keyof InputEventMap>(type: K, listener: InputEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
253
|
+
emit: (<K extends keyof InputEventMap>(type: K, ...args: Parameters<InputEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
254
|
+
}
|
|
255
|
+
declare class Input extends EventEmitter {
|
|
256
|
+
target?: HTMLElement;
|
|
257
|
+
cursor: Cursor | string;
|
|
258
|
+
cursorStyles: Record<string, any>;
|
|
259
|
+
setuped: boolean;
|
|
260
|
+
/**
|
|
261
|
+
* Current event
|
|
262
|
+
*/
|
|
263
|
+
event?: PointerInputEvent | WheelInputEvent;
|
|
264
|
+
enableMoveEvent: boolean;
|
|
265
|
+
enableWheelEvent: boolean;
|
|
266
|
+
enableClickEvent: boolean;
|
|
267
|
+
setTarget(target: HTMLElement): void;
|
|
268
|
+
removeEventListeners(): void;
|
|
269
|
+
addEventListeners(): void;
|
|
270
|
+
protected normalize(event: WheelEvent): WheelEvent[];
|
|
271
|
+
protected normalize(event: TouchEvent | PointerEvent | MouseEvent): PointerEvent[];
|
|
272
|
+
protected cloneWheelEvent(nativeEvent: WheelEvent): WheelInputEvent;
|
|
273
|
+
protected clonePointerEvent(nativeEvent: PointerEvent): PointerInputEvent;
|
|
274
|
+
protected copyMouseEvent(event: MouseInputEvent, nativeEvent: MouseEvent): void;
|
|
275
|
+
/**
|
|
276
|
+
* Sets the current cursor mode, handling any callbacks or CSS style changes.
|
|
277
|
+
* @param mode - cursor mode, a key from the cursorStyles dictionary
|
|
278
|
+
*/
|
|
279
|
+
setCursor(mode: string): void;
|
|
280
|
+
mapPositionToPoint(point: {
|
|
281
|
+
x: number;
|
|
282
|
+
y: number;
|
|
283
|
+
}, x: number, y: number): void;
|
|
284
|
+
protected onPointerDown: (nativeEvent: PointerEvent | TouchEvent | MouseEvent) => void;
|
|
285
|
+
protected onPointerOver: (nativeEvent: PointerEvent | TouchEvent | MouseEvent) => void;
|
|
286
|
+
protected onPointerMove: (nativeEvent: PointerEvent | TouchEvent | MouseEvent) => void;
|
|
287
|
+
protected onPointerUp: (nativeEvent: PointerEvent | TouchEvent | MouseEvent) => void;
|
|
288
|
+
protected onWheel: (nativeEvent: WheelEvent) => void;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
interface ResourceEventMap extends RefCountedEventMap {
|
|
292
|
+
}
|
|
293
|
+
interface Resource {
|
|
294
|
+
on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
295
|
+
off: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
296
|
+
emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
297
|
+
}
|
|
298
|
+
declare class Resource extends RefCounted {
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
type ColorValue = number | AnyColor;
|
|
302
|
+
declare class Color {
|
|
303
|
+
protected _colord: Colord;
|
|
304
|
+
protected _value: ColorValue;
|
|
305
|
+
get value(): ColorValue;
|
|
306
|
+
set value(value: ColorValue | undefined);
|
|
307
|
+
get r8(): number;
|
|
308
|
+
get g8(): number;
|
|
309
|
+
get b8(): number;
|
|
310
|
+
get a8(): number;
|
|
311
|
+
get r(): number;
|
|
312
|
+
get g(): number;
|
|
313
|
+
get b(): number;
|
|
314
|
+
get a(): number;
|
|
315
|
+
get rgb(): number;
|
|
316
|
+
get bgr(): number;
|
|
317
|
+
get abgr(): number;
|
|
318
|
+
constructor(value?: ColorValue);
|
|
319
|
+
toArgb(alpha?: number, applyToRGB?: boolean): number;
|
|
320
|
+
toHex(): string;
|
|
321
|
+
toArray(): [number, number, number, number];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
type VectorLike = number | number[] | Matrix | Vector;
|
|
325
|
+
type VectorOperateOutput = number[] | Vector;
|
|
326
|
+
declare abstract class Vector extends EventEmitter {
|
|
327
|
+
readonly dim: number;
|
|
328
|
+
protected _array: number[];
|
|
329
|
+
get length(): number;
|
|
330
|
+
constructor(dim: number);
|
|
331
|
+
protected _operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=' | string, target: VectorLike, output?: VectorOperateOutput): any;
|
|
332
|
+
add(value: VectorLike): this;
|
|
333
|
+
add<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
334
|
+
sub(value: VectorLike): this;
|
|
335
|
+
sub<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
336
|
+
multiply(value: VectorLike): this;
|
|
337
|
+
multiply<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
338
|
+
divide(value: VectorLike): this;
|
|
339
|
+
divide<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
340
|
+
rotate(angle: number): this;
|
|
341
|
+
rotate<T extends VectorOperateOutput>(angle: number, output: T): T;
|
|
342
|
+
set(value: VectorLike, ...args: number[]): this;
|
|
343
|
+
equals(value: VectorLike): boolean;
|
|
344
|
+
clone(): this;
|
|
345
|
+
protected _emitUpdate(array: number[]): void;
|
|
346
|
+
protected _onUpdate(_array: number[]): void;
|
|
347
|
+
toArray(): number[];
|
|
348
|
+
toName(): string;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
type MatrixLike = number | number[] | Matrix;
|
|
352
|
+
type MatrixOperateOutput = number[] | Matrix | Vector;
|
|
353
|
+
declare abstract class Matrix extends EventEmitter {
|
|
354
|
+
readonly rows: number;
|
|
355
|
+
readonly cols: number;
|
|
356
|
+
protected _array: number[];
|
|
357
|
+
get length(): number;
|
|
358
|
+
constructor(rows: number, cols: number, array?: number[]);
|
|
359
|
+
protected _operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
|
|
360
|
+
identity(): this;
|
|
361
|
+
clone(): this;
|
|
362
|
+
set(value: MatrixLike): this;
|
|
363
|
+
multiply<T extends Vector>(value: T): T;
|
|
364
|
+
multiply(value: MatrixLike): this;
|
|
365
|
+
multiply<T extends MatrixOperateOutput>(value: MatrixLike, output: T): T;
|
|
366
|
+
onUpdate(callback: (array: number[]) => void): this;
|
|
367
|
+
offUpdate(callback: (array: number[]) => void): this;
|
|
368
|
+
protected _emitUpdate(array: number[]): void;
|
|
369
|
+
protected _onUpdate(_array: number[]): void;
|
|
370
|
+
toArray(transpose?: boolean): number[];
|
|
371
|
+
toName(): string;
|
|
372
|
+
toJSON(): number[];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Matrix4
|
|
377
|
+
*
|
|
378
|
+
* | x0 | y0 | z0 | m0 |
|
|
379
|
+
* | x1 | y1 | z1 | m1 |
|
|
380
|
+
* | x2 | y2 | z2 | m2 |
|
|
381
|
+
*/
|
|
382
|
+
declare class Matrix4 extends Matrix {
|
|
383
|
+
constructor(array?: number[]);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Vector4
|
|
388
|
+
*/
|
|
389
|
+
declare class Vector4 extends Vector {
|
|
390
|
+
constructor(x?: number, y?: number, z?: number, m?: number);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Matrix4(4x5)
|
|
395
|
+
*
|
|
396
|
+
* | r0 | g0 | b0 | a0 | tr |
|
|
397
|
+
* | r1 | g1 | b1 | a1 | tg |
|
|
398
|
+
* | r2 | g2 | b2 | a2 | tb |
|
|
399
|
+
* | r3 | g3 | b3 | a3 | ta |
|
|
400
|
+
*/
|
|
401
|
+
declare class ColorMatrix extends Matrix {
|
|
402
|
+
constructor(array?: number[]);
|
|
403
|
+
hueRotate(angle?: number): this;
|
|
404
|
+
saturate(amount?: number): this;
|
|
405
|
+
brightness(amount?: number): this;
|
|
406
|
+
contrast(amount?: number): this;
|
|
407
|
+
invert(amount?: number): this;
|
|
408
|
+
sepia(amount?: number): this;
|
|
409
|
+
opacity(amount?: number): this;
|
|
410
|
+
grayscale(amount?: number): this;
|
|
411
|
+
multiply(target: number[]): this;
|
|
412
|
+
toMatrix4(): Matrix4;
|
|
413
|
+
toVector4(): Vector4;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Matrix2
|
|
418
|
+
*
|
|
419
|
+
* | x0 | y0 |
|
|
420
|
+
* | x1 | y1 |
|
|
421
|
+
*/
|
|
422
|
+
declare class Matrix2 extends Matrix {
|
|
423
|
+
constructor(array?: number[]);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Matrix3
|
|
428
|
+
*
|
|
429
|
+
* | x0 | y0 | z0 |
|
|
430
|
+
* | x1 | y1 | z1 |
|
|
431
|
+
* | x2 | y2 | z2 |
|
|
432
|
+
*/
|
|
433
|
+
declare class Matrix3 extends Matrix {
|
|
434
|
+
constructor(array?: number[]);
|
|
435
|
+
invert(): this;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
declare class Projection2D extends Matrix3 {
|
|
439
|
+
protected _x: number;
|
|
440
|
+
protected _y: number;
|
|
441
|
+
protected _width: number;
|
|
442
|
+
protected _height: number;
|
|
443
|
+
protected _flipY: boolean;
|
|
444
|
+
constructor(_x?: number, _y?: number, _width?: number, _height?: number, _flipY?: boolean);
|
|
445
|
+
flipY(flipY: boolean): this;
|
|
446
|
+
translate(x: number, y: number): this;
|
|
447
|
+
resize(width: number, height: number): this;
|
|
448
|
+
protected _performUpdateArray(): void;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Vector2
|
|
453
|
+
*/
|
|
454
|
+
declare class Vector2 extends Vector {
|
|
455
|
+
get x(): number;
|
|
456
|
+
set x(val: number);
|
|
457
|
+
get y(): number;
|
|
458
|
+
set y(val: number);
|
|
459
|
+
get width(): number;
|
|
460
|
+
set width(val: number);
|
|
461
|
+
get height(): number;
|
|
462
|
+
set height(val: number);
|
|
463
|
+
constructor(x?: VectorLike, y?: number);
|
|
464
|
+
update(x: number, y: number): this;
|
|
465
|
+
getLength(): number;
|
|
466
|
+
getAngle(): number;
|
|
467
|
+
distanceTo(point: Vector2): number;
|
|
468
|
+
normalize(): this;
|
|
469
|
+
static lerp(a: VectorLike, b: VectorLike, t: number): Vector2;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
declare class Rect2 {
|
|
473
|
+
get x(): number;
|
|
474
|
+
get y(): number;
|
|
475
|
+
get left(): number;
|
|
476
|
+
get top(): number;
|
|
477
|
+
get width(): number;
|
|
478
|
+
get height(): number;
|
|
479
|
+
readonly end: Vector2;
|
|
480
|
+
readonly position: Vector2;
|
|
481
|
+
readonly size: Vector2;
|
|
482
|
+
constructor(from: Rect2);
|
|
483
|
+
constructor(position: Vector2, size: Vector2);
|
|
484
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
485
|
+
update(): this;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface Transform2DObject {
|
|
489
|
+
a: number;
|
|
490
|
+
c: number;
|
|
491
|
+
tx: number;
|
|
492
|
+
b: number;
|
|
493
|
+
d: number;
|
|
494
|
+
ty: number;
|
|
495
|
+
tz: number;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Transform
|
|
499
|
+
*
|
|
500
|
+
* | a | c | tx|
|
|
501
|
+
* | b | d | ty|
|
|
502
|
+
* | 0 | 0 | 1 |
|
|
503
|
+
*/
|
|
504
|
+
declare class Transform2D extends Matrix3 {
|
|
505
|
+
autoUpdate: boolean;
|
|
506
|
+
protected _cx: number;
|
|
507
|
+
protected _sx: number;
|
|
508
|
+
protected _cy: number;
|
|
509
|
+
protected _sy: number;
|
|
510
|
+
protected _translateX: number;
|
|
511
|
+
protected _translateY: number;
|
|
512
|
+
protected _translateZ: number;
|
|
513
|
+
protected _scaleX: number;
|
|
514
|
+
protected _scaleY: number;
|
|
515
|
+
protected _skewX: number;
|
|
516
|
+
protected _skewY: number;
|
|
517
|
+
protected _rotate: number;
|
|
518
|
+
dirtyId: number;
|
|
519
|
+
protected _needsUpdateArray: boolean;
|
|
520
|
+
protected _needsUpdateFields: boolean;
|
|
521
|
+
constructor(autoUpdate?: boolean);
|
|
522
|
+
protected _onUpdate(array: number[]): void;
|
|
523
|
+
protected _updateSkew(): void;
|
|
524
|
+
protected _requestUpdateArray(): void;
|
|
525
|
+
protected _requestUpdateFields(): void;
|
|
526
|
+
protected _performUpdateArray(): void;
|
|
527
|
+
protected _performUpdateFields(): void;
|
|
528
|
+
skew(x: number, y: number): this;
|
|
529
|
+
skewX(x: number): this;
|
|
530
|
+
skewY(y: number): this;
|
|
531
|
+
translate(x: number, y: number, z?: number): this;
|
|
532
|
+
translateX(x: number): this;
|
|
533
|
+
translateY(y: number): this;
|
|
534
|
+
translateZ(z: number): this;
|
|
535
|
+
translate3d(x: number, y: number, z: number): this;
|
|
536
|
+
scale(x: number, y: number, _z?: number): this;
|
|
537
|
+
scaleX(x: number): this;
|
|
538
|
+
scaleY(y: number): this;
|
|
539
|
+
scale3d(x: number, y: number, z: number): this;
|
|
540
|
+
rotate(rad: number): this;
|
|
541
|
+
rotateX(x: number): this;
|
|
542
|
+
rotateY(y: number): this;
|
|
543
|
+
rotateZ(z: number): this;
|
|
544
|
+
rotate3d(x: number, y: number, z: number, rad: number): this;
|
|
545
|
+
protected _rotateToScale(rad: number): number;
|
|
546
|
+
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
547
|
+
applyToPoint(x: number, y: number): number[];
|
|
548
|
+
inverse(): this;
|
|
549
|
+
update(): boolean;
|
|
550
|
+
isIdentity(): boolean;
|
|
551
|
+
toObject(): Transform2DObject;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare const DEG_TO_RAD: number;
|
|
555
|
+
declare const RAD_TO_DEG: number;
|
|
556
|
+
declare function clamp(min: number, val: number, max: number): number;
|
|
557
|
+
declare function lerp(a: number, b: number, weight: number): number;
|
|
558
|
+
declare const curves: {
|
|
559
|
+
adaptive: boolean;
|
|
560
|
+
maxLength: number;
|
|
561
|
+
minSegments: number;
|
|
562
|
+
maxSegments: number;
|
|
563
|
+
epsilon: number;
|
|
564
|
+
_segmentsCount(length: number, defaultSegments?: number): number;
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Vector3
|
|
569
|
+
*/
|
|
570
|
+
declare class Vector3 extends Vector {
|
|
571
|
+
constructor();
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
interface MainLoopEventMap extends CoreObjectEventMap {
|
|
575
|
+
process: (delta: number) => void;
|
|
576
|
+
}
|
|
577
|
+
interface MainLoop {
|
|
578
|
+
on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
579
|
+
off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
580
|
+
emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
581
|
+
}
|
|
582
|
+
declare class MainLoop extends CoreObject {
|
|
583
|
+
fps: number;
|
|
584
|
+
speed: number;
|
|
585
|
+
protected _starting: boolean;
|
|
586
|
+
protected _nextDeltaTime: number;
|
|
587
|
+
get starting(): boolean;
|
|
588
|
+
get spf(): number;
|
|
589
|
+
constructor();
|
|
590
|
+
start(process: (delta: number) => void): this;
|
|
591
|
+
stop(): this;
|
|
592
|
+
protected _onNextTick(): void;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
interface CssFunctionArg {
|
|
596
|
+
unit: string | null;
|
|
597
|
+
value: string;
|
|
598
|
+
intValue: number;
|
|
599
|
+
normalizedIntValue: number;
|
|
600
|
+
normalizedDefaultIntValue: number;
|
|
601
|
+
}
|
|
602
|
+
interface CssFunction {
|
|
603
|
+
name: string;
|
|
604
|
+
args: CssFunctionArg[];
|
|
605
|
+
}
|
|
606
|
+
interface ParseArgumentContext {
|
|
607
|
+
index?: number;
|
|
608
|
+
fontSize?: number;
|
|
609
|
+
width?: number;
|
|
610
|
+
height?: number;
|
|
611
|
+
}
|
|
612
|
+
declare function getDefaultCssPropertyValue<T extends CssFunctionArg | CssFunction[]>(value: T): T;
|
|
613
|
+
declare function parseCssProperty(name: string, propertyValue: string, context?: ParseArgumentContext): CssFunctionArg | CssFunction[];
|
|
614
|
+
declare function parseCssFunctions(propertyValue: string, context?: ParseArgumentContext): CssFunction[];
|
|
615
|
+
|
|
616
|
+
declare const SUPPORTS_WEBGL2: boolean;
|
|
617
|
+
declare const SUPPORTS_IMAGE_BITMAP: boolean;
|
|
618
|
+
declare const SUPPORTS_RESIZE_OBSERVER: boolean;
|
|
619
|
+
declare const SUPPORTS_POINTER_EVENTS: boolean;
|
|
620
|
+
declare const SUPPORTS_WHEEL_EVENTS: boolean;
|
|
621
|
+
declare const SUPPORTS_MOUSE_EVENTS: boolean;
|
|
622
|
+
declare const SUPPORTS_TOUCH_EVENTS: boolean;
|
|
623
|
+
declare const SUPPORTS_CLICK_EVENTS: boolean;
|
|
624
|
+
declare const SUPPORTS_CREATE_IMAGE_BITMAP: boolean;
|
|
625
|
+
declare const SUPPORTS_AUDIO_CONTEXT: boolean;
|
|
626
|
+
declare const SUPPORTS_WEBKIT_AUDIO_CONTEXT: boolean;
|
|
627
|
+
declare const SUPPORTS_OFFLINE_AUDIO_CONTEXT: boolean;
|
|
628
|
+
declare const SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT: boolean;
|
|
629
|
+
declare const SUPPORTS_WEB_AUDIO: boolean;
|
|
630
|
+
declare const IN_BROWSER: boolean;
|
|
631
|
+
declare const DEVICE_PIXEL_RATIO: number;
|
|
632
|
+
declare const isElementNode: (node: unknown) => node is Element;
|
|
633
|
+
declare const isVideoElement: (node: unknown) => node is HTMLVideoElement;
|
|
634
|
+
declare const isImageElement: (node: unknown) => node is HTMLImageElement;
|
|
635
|
+
declare function isCanvasElement(node: unknown): node is HTMLCanvasElement;
|
|
636
|
+
declare function isWebgl2(gl: unknown): gl is WebGL2RenderingContext;
|
|
637
|
+
declare function createHTMLCanvas(): HTMLCanvasElement | undefined;
|
|
638
|
+
declare function determineCrossOrigin(url: string, loc?: Location): string;
|
|
639
|
+
declare function crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin: boolean | string | null): void;
|
|
640
|
+
|
|
641
|
+
declare class RawWeakMap<K extends WeakKey = WeakKey, V = any> {
|
|
642
|
+
protected _map: WeakMap<K, V>;
|
|
643
|
+
protected _toRaw(value: any): any;
|
|
644
|
+
/**
|
|
645
|
+
* Removes the specified element from the WeakMap.
|
|
646
|
+
* @returns true if the element was successfully removed, or false if it was not present.
|
|
647
|
+
*/
|
|
648
|
+
delete(key: K): boolean;
|
|
649
|
+
/**
|
|
650
|
+
* @returns a specified element.
|
|
651
|
+
*/
|
|
652
|
+
get(key: K): V | undefined;
|
|
653
|
+
/**
|
|
654
|
+
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
655
|
+
*/
|
|
656
|
+
has(key: K): boolean;
|
|
657
|
+
/**
|
|
658
|
+
* Adds a new element with a specified key and value.
|
|
659
|
+
* @param key Must be an object or symbol.
|
|
660
|
+
*/
|
|
661
|
+
set(key: K, value: V): this;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
declare const PI: number;
|
|
665
|
+
declare const PI_2: number;
|
|
666
|
+
declare function uid(object?: Record<string, any>): number;
|
|
667
|
+
declare function isPow2(v: number): boolean;
|
|
668
|
+
|
|
669
|
+
declare abstract class Renderer {
|
|
670
|
+
view?: HTMLCanvasElement;
|
|
671
|
+
pixelRatio: number;
|
|
672
|
+
readonly screen: {
|
|
673
|
+
x: number;
|
|
674
|
+
y: number;
|
|
675
|
+
width: number;
|
|
676
|
+
height: number;
|
|
677
|
+
};
|
|
678
|
+
readonly related: RawWeakMap<object, any>;
|
|
679
|
+
getRelated<T>(source: object, createFn?: () => T): T;
|
|
680
|
+
resize(width: number, height: number, updateStyle?: boolean): void;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
type WebGLBufferTarget = 'array_buffer' | 'element_array_buffer';
|
|
684
|
+
interface WebGLBufferOptions {
|
|
685
|
+
target?: WebGLBufferTarget;
|
|
686
|
+
usage?: WebGLBufferUsage;
|
|
687
|
+
data: BufferSource | number[] | null;
|
|
688
|
+
}
|
|
689
|
+
type WebGLBufferUsage = 'static_draw' | 'dynamic_draw';
|
|
690
|
+
interface WebGLBufferMeta {
|
|
691
|
+
id: number;
|
|
692
|
+
target?: WebGLBufferTarget;
|
|
693
|
+
usage?: WebGLBufferUsage;
|
|
694
|
+
length: number;
|
|
695
|
+
byteLength: number;
|
|
696
|
+
bytesPerElement: number;
|
|
697
|
+
}
|
|
698
|
+
type WebGLDrawMode = 'points' | 'line_strip' | 'line_loop' | 'lines' | 'triangle_strip' | 'triangle_fan' | 'triangles';
|
|
699
|
+
interface WebGLDrawOptions {
|
|
700
|
+
mode?: WebGLDrawMode;
|
|
701
|
+
count?: number;
|
|
702
|
+
first?: number;
|
|
703
|
+
bytesPerElement?: number;
|
|
193
704
|
instanceCount?: number;
|
|
194
705
|
}
|
|
195
706
|
interface WebGLExtensions {
|
|
@@ -399,14 +910,7 @@ declare class WebGLState {
|
|
|
399
910
|
set blendMode(value: WebGLBlendMode);
|
|
400
911
|
get polygonOffset(): number;
|
|
401
912
|
set polygonOffset(value: number);
|
|
402
|
-
constructor(options?:
|
|
403
|
-
blend?: boolean;
|
|
404
|
-
offsets?: boolean;
|
|
405
|
-
culling?: boolean;
|
|
406
|
-
depthTest?: boolean;
|
|
407
|
-
clockwiseFrontFace?: boolean;
|
|
408
|
-
depthMask?: boolean;
|
|
409
|
-
});
|
|
913
|
+
constructor(options?: Partial<WebGLState>);
|
|
410
914
|
}
|
|
411
915
|
declare class WebGLStateModule extends WebGLModule {
|
|
412
916
|
install(renderer: WebGLRenderer): void;
|
|
@@ -436,7 +940,7 @@ interface Batchable2D {
|
|
|
436
940
|
uvs?: number[];
|
|
437
941
|
texture?: WebGLTexture;
|
|
438
942
|
backgroundColor?: number;
|
|
439
|
-
|
|
943
|
+
modulate?: number;
|
|
440
944
|
colorMatrix?: ArrayLike<number>;
|
|
441
945
|
colorMatrixOffset?: ArrayLike<number>;
|
|
442
946
|
blendMode?: WebGLBlendMode;
|
|
@@ -451,7 +955,7 @@ declare class WebGLBatch2DModule extends WebGLModule {
|
|
|
451
955
|
protected _batchSize: number;
|
|
452
956
|
protected _vertexSize: number;
|
|
453
957
|
protected _drawCallUid: number;
|
|
454
|
-
protected
|
|
958
|
+
protected _defaultModulate: number;
|
|
455
959
|
protected _defaultBackgroundColor: number;
|
|
456
960
|
protected _defaultColorMatrixOffset: number[];
|
|
457
961
|
protected _defaultColorMatrix: number[];
|
|
@@ -638,46 +1142,6 @@ declare class WebGLViewportModule extends WebGLModule {
|
|
|
638
1142
|
reset(): void;
|
|
639
1143
|
}
|
|
640
1144
|
|
|
641
|
-
interface ReferenceEventMap extends _ObjectEventMap {
|
|
642
|
-
}
|
|
643
|
-
interface Reference {
|
|
644
|
-
on: (<K extends keyof ReferenceEventMap>(type: K, listener: ReferenceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
645
|
-
off: (<K extends keyof ReferenceEventMap>(type: K, listener: ReferenceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
646
|
-
emit: (<K extends keyof ReferenceEventMap>(type: K, ...args: Parameters<ReferenceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Reference 是 Object 的子类,提供了对对象的引用计数功能。
|
|
650
|
-
* 这使得它成为 Godot 中处理资源(如纹理、音频文件)和某些类的基础。
|
|
651
|
-
* 与普通对象不同,Reference 类的对象会进行引用计数,直到没有任何引用时才会被销毁。
|
|
652
|
-
*
|
|
653
|
-
* 功能和用途:
|
|
654
|
-
* • 提供自动内存管理,避免了内存泄漏。
|
|
655
|
-
* • 经常被用作 资源类(如 Resource 和其子类)和某些非节点类型的对象。
|
|
656
|
-
*/
|
|
657
|
-
declare class Reference extends _Object {
|
|
658
|
-
protected _refCount: number;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
interface ResourceEventMap extends ReferenceEventMap {
|
|
662
|
-
}
|
|
663
|
-
interface Resource {
|
|
664
|
-
on: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
665
|
-
off: (<K extends keyof ResourceEventMap>(type: K, listener: ResourceEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
666
|
-
emit: (<K extends keyof ResourceEventMap>(type: K, ...args: Parameters<ResourceEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Resource 是继承自 Reference 的类,是所有资源类型的基类。
|
|
670
|
-
* 它用于存储各种可重用的资源,如纹理、材质、音效、脚本等。
|
|
671
|
-
* Resource 类的主要功能是为资源提供序列化和管理支持,使得这些资源能够被保存、加载和共享。
|
|
672
|
-
*
|
|
673
|
-
* 功能和用途:
|
|
674
|
-
* • 序列化支持:Resource 支持将资源序列化为文件并保存到磁盘,通常以 .tres 或 .res 格式存储。
|
|
675
|
-
* • 资源加载和引用:可以在多个地方引用同一个资源实例,资源本身是共享的。当一个 Resource 实例被加载时,它不会创建多个副本,而是通过引用计数来管理其生命周期。
|
|
676
|
-
* • 可重用性:资源是可以在多个场景中共享的,例如一个纹理资源可以在多个 Sprite 节点中使用,而不需要重新加载。
|
|
677
|
-
*/
|
|
678
|
-
declare class Resource extends Reference {
|
|
679
|
-
}
|
|
680
|
-
|
|
681
1145
|
interface MaterialOptions {
|
|
682
1146
|
vert?: string;
|
|
683
1147
|
frag?: string;
|
|
@@ -707,7 +1171,7 @@ declare class IndexBuffer extends Resource {
|
|
|
707
1171
|
_glBufferOptions(): WebGLBufferOptions;
|
|
708
1172
|
/** @internal */
|
|
709
1173
|
_glBuffer(renderer: WebGLRenderer): WebGLBuffer;
|
|
710
|
-
protected
|
|
1174
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
711
1175
|
upload(renderer: WebGLRenderer): boolean;
|
|
712
1176
|
}
|
|
713
1177
|
|
|
@@ -724,7 +1188,7 @@ declare class VertexBuffer extends Resource {
|
|
|
724
1188
|
_glBufferOptions(): WebGLBufferOptions;
|
|
725
1189
|
/** @internal */
|
|
726
1190
|
_glBuffer(renderer: WebGLRenderer): WebGLBuffer;
|
|
727
|
-
protected
|
|
1191
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
728
1192
|
upload(renderer: WebGLRenderer): boolean;
|
|
729
1193
|
}
|
|
730
1194
|
|
|
@@ -743,352 +1207,98 @@ declare class VertexAttribute extends Resource {
|
|
|
743
1207
|
normalized: boolean;
|
|
744
1208
|
type: 'float' | 'unsigned_byte' | 'unsigned_short';
|
|
745
1209
|
stride?: number;
|
|
746
|
-
offset?: number;
|
|
747
|
-
divisor?: number;
|
|
748
|
-
needsUpload: boolean;
|
|
749
|
-
constructor(options?: VertexAttributeOptions);
|
|
750
|
-
protected
|
|
751
|
-
upload(): boolean;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
interface GeometryOptions {
|
|
755
|
-
vertexAttributes?: Record<string, VertexAttribute>;
|
|
756
|
-
indexBuffer?: IndexBuffer;
|
|
757
|
-
instanceCount?: number;
|
|
758
|
-
mode?: WebGLDrawMode;
|
|
759
|
-
}
|
|
760
|
-
declare class Geometry extends Resource {
|
|
761
|
-
vertexAttributes: Map<string, VertexAttribute>;
|
|
762
|
-
indexBuffer?: IndexBuffer;
|
|
763
|
-
instanceCount?: number;
|
|
764
|
-
mode: WebGLDrawMode;
|
|
765
|
-
protected _materialWeakMap: RawWeakMap<Material, Record<string, any>>;
|
|
766
|
-
constructor(options?: GeometryOptions);
|
|
767
|
-
/** @internal */
|
|
768
|
-
_glVertexArray(renderer: WebGLRenderer): WebGLVertexArrayObjectOptions;
|
|
769
|
-
/** @internal */
|
|
770
|
-
_glVertexArrayObject(renderer: WebGLRenderer, material: Material): WebGLVertexArrayObject | null;
|
|
771
|
-
draw(renderer: WebGLRenderer, material: Material, uniforms?: Record<string, any>): void;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
declare class QuadGeometry extends Geometry {
|
|
775
|
-
constructor();
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
declare class UvMaterial extends Material {
|
|
779
|
-
protected static _instance: UvMaterial;
|
|
780
|
-
static get instance(): UvMaterial;
|
|
781
|
-
constructor();
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
declare class QuadUvGeometry extends Geometry {
|
|
785
|
-
protected static _instance: QuadUvGeometry;
|
|
786
|
-
static get instance(): QuadUvGeometry;
|
|
787
|
-
static draw(renderer: WebGLRenderer, material?: Material, uniforms?: Record<string, any>): void;
|
|
788
|
-
constructor();
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
declare class UvGeometry extends Geometry {
|
|
792
|
-
positionBuffer: VertexBuffer;
|
|
793
|
-
uvBuffer: VertexBuffer;
|
|
794
|
-
constructor();
|
|
795
|
-
update(vertices: Float32Array, uvs: Float32Array, indices: Uint16Array): this;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
interface MainLoopEventMap extends _ObjectEventMap {
|
|
799
|
-
process: (delta: number) => void;
|
|
800
|
-
}
|
|
801
|
-
interface MainLoop {
|
|
802
|
-
on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
803
|
-
off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
804
|
-
emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
805
|
-
}
|
|
806
|
-
declare class MainLoop extends _Object {
|
|
807
|
-
fps: number;
|
|
808
|
-
speed: number;
|
|
809
|
-
protected _starting: boolean;
|
|
810
|
-
protected _nextDeltaTime: number;
|
|
811
|
-
get starting(): boolean;
|
|
812
|
-
get spf(): number;
|
|
813
|
-
constructor();
|
|
814
|
-
start(process: (delta: number) => void): this;
|
|
815
|
-
stop(): this;
|
|
816
|
-
protected _onNextTick(): void;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
interface RenderCall {
|
|
820
|
-
renderable: Node;
|
|
821
|
-
fn: (renderer: WebGLRenderer, next: () => void) => void;
|
|
822
|
-
parentCall: RenderCall | undefined;
|
|
823
|
-
calls: RenderCall[];
|
|
824
|
-
}
|
|
825
|
-
declare class RenderStack {
|
|
826
|
-
currentCall?: RenderCall;
|
|
827
|
-
calls: RenderCall[];
|
|
828
|
-
createCall(renderable: Node): RenderCall;
|
|
829
|
-
push(renderable: Node): RenderCall;
|
|
830
|
-
render(renderer: WebGLRenderer): void;
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
interface TimerEventMap extends NodeEventMap {
|
|
834
|
-
update: (current: number, delta: number) => void;
|
|
835
|
-
}
|
|
836
|
-
interface TimerOptions extends NodeOptions {
|
|
837
|
-
start?: number;
|
|
838
|
-
current?: number;
|
|
839
|
-
end?: number;
|
|
840
|
-
loop?: boolean;
|
|
841
|
-
}
|
|
842
|
-
interface Timer {
|
|
843
|
-
on: (<K extends keyof TimerEventMap>(type: K, listener: TimerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
844
|
-
off: (<K extends keyof TimerEventMap>(type: K, listener: TimerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
845
|
-
emit: (<K extends keyof TimerEventMap>(type: K, ...args: Parameters<TimerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
846
|
-
}
|
|
847
|
-
declare class Timer extends Node {
|
|
848
|
-
start: number;
|
|
849
|
-
current: number;
|
|
850
|
-
end: number;
|
|
851
|
-
loop: boolean;
|
|
852
|
-
static from(range: number | number[]): Timer;
|
|
853
|
-
constructor(options?: TimerOptions);
|
|
854
|
-
protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
855
|
-
addTime(delta: number): this;
|
|
856
|
-
protected _process(delta: number): void;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
type VectorLike = number | number[] | Matrix | Vector;
|
|
860
|
-
type VectorOperateOutput = number[] | Vector;
|
|
861
|
-
declare abstract class Vector extends EventEmitter {
|
|
862
|
-
readonly dim: number;
|
|
863
|
-
protected _array: number[];
|
|
864
|
-
get length(): number;
|
|
865
|
-
constructor(dim: number);
|
|
866
|
-
protected _operate(operator: '+' | '-' | '*' | '/' | 'rot' | '==' | '=' | string, target: VectorLike, output?: VectorOperateOutput): any;
|
|
867
|
-
add(value: VectorLike): this;
|
|
868
|
-
add<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
869
|
-
sub(value: VectorLike): this;
|
|
870
|
-
sub<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
871
|
-
multiply(value: VectorLike): this;
|
|
872
|
-
multiply<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
873
|
-
divide(value: VectorLike): this;
|
|
874
|
-
divide<T extends VectorOperateOutput>(value: VectorLike, output: T): T;
|
|
875
|
-
rotate(angle: number): this;
|
|
876
|
-
rotate<T extends VectorOperateOutput>(angle: number, output: T): T;
|
|
877
|
-
set(value: VectorLike, ...args: number[]): this;
|
|
878
|
-
equals(value: VectorLike): boolean;
|
|
879
|
-
clone(): this;
|
|
880
|
-
onUpdate(callback: (array: number[]) => void): this;
|
|
881
|
-
offUpdate(callback: (array: number[]) => void): this;
|
|
882
|
-
protected _emitUpdate(array: number[]): void;
|
|
883
|
-
protected _onUpdate(_array: number[]): void;
|
|
884
|
-
toArray(): number[];
|
|
885
|
-
toName(): string;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
type MatrixLike = number | number[] | Matrix;
|
|
889
|
-
type MatrixOperateOutput = number[] | Matrix | Vector;
|
|
890
|
-
declare abstract class Matrix extends EventEmitter {
|
|
891
|
-
readonly rows: number;
|
|
892
|
-
readonly cols: number;
|
|
893
|
-
protected _array: number[];
|
|
894
|
-
get length(): number;
|
|
895
|
-
constructor(rows: number, cols: number, array?: number[]);
|
|
896
|
-
protected _operate(operator: string, target: MatrixLike | Vector, output?: MatrixOperateOutput): any;
|
|
897
|
-
identity(): this;
|
|
898
|
-
clone(): this;
|
|
899
|
-
set(value: MatrixLike): this;
|
|
900
|
-
multiply<T extends Vector>(value: T): T;
|
|
901
|
-
multiply(value: MatrixLike): this;
|
|
902
|
-
multiply<T extends MatrixOperateOutput>(value: MatrixLike, output: T): T;
|
|
903
|
-
onUpdate(callback: (array: number[]) => void): this;
|
|
904
|
-
offUpdate(callback: (array: number[]) => void): this;
|
|
905
|
-
protected _emitUpdate(array: number[]): void;
|
|
906
|
-
protected _onUpdate(_array: number[]): void;
|
|
907
|
-
toArray(transpose?: boolean): number[];
|
|
908
|
-
toName(): string;
|
|
909
|
-
toJSON(): number[];
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
* Matrix2
|
|
914
|
-
*
|
|
915
|
-
* | x0 | y0 |
|
|
916
|
-
* | x1 | y1 |
|
|
917
|
-
*/
|
|
918
|
-
declare class Matrix2 extends Matrix {
|
|
919
|
-
constructor(array?: number[]);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Matrix3
|
|
924
|
-
*
|
|
925
|
-
* | x0 | y0 | z0 |
|
|
926
|
-
* | x1 | y1 | z1 |
|
|
927
|
-
* | x2 | y2 | z2 |
|
|
928
|
-
*/
|
|
929
|
-
declare class Matrix3 extends Matrix {
|
|
930
|
-
constructor(array?: number[]);
|
|
931
|
-
invert(): this;
|
|
1210
|
+
offset?: number;
|
|
1211
|
+
divisor?: number;
|
|
1212
|
+
needsUpload: boolean;
|
|
1213
|
+
constructor(options?: VertexAttributeOptions);
|
|
1214
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1215
|
+
upload(): boolean;
|
|
932
1216
|
}
|
|
933
1217
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
* | x2 | y2 | z2 | m2 |
|
|
940
|
-
*/
|
|
941
|
-
declare class Matrix4 extends Matrix {
|
|
942
|
-
constructor(array?: number[]);
|
|
1218
|
+
interface GeometryOptions {
|
|
1219
|
+
vertexAttributes?: Record<string, VertexAttribute>;
|
|
1220
|
+
indexBuffer?: IndexBuffer;
|
|
1221
|
+
instanceCount?: number;
|
|
1222
|
+
mode?: WebGLDrawMode;
|
|
943
1223
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
protected
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1224
|
+
declare class Geometry extends Resource {
|
|
1225
|
+
vertexAttributes: Map<string, VertexAttribute>;
|
|
1226
|
+
indexBuffer?: IndexBuffer;
|
|
1227
|
+
instanceCount?: number;
|
|
1228
|
+
mode: WebGLDrawMode;
|
|
1229
|
+
protected _materialWeakMap: RawWeakMap<Material, Record<string, any>>;
|
|
1230
|
+
constructor(options?: GeometryOptions);
|
|
1231
|
+
/** @internal */
|
|
1232
|
+
_glVertexArray(renderer: WebGLRenderer): WebGLVertexArrayObjectOptions;
|
|
1233
|
+
/** @internal */
|
|
1234
|
+
_glVertexArrayObject(renderer: WebGLRenderer, material: Material): WebGLVertexArrayObject | null;
|
|
1235
|
+
draw(renderer: WebGLRenderer, material: Material, uniforms?: Record<string, any>): void;
|
|
956
1236
|
}
|
|
957
1237
|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
c: number;
|
|
961
|
-
tx: number;
|
|
962
|
-
b: number;
|
|
963
|
-
d: number;
|
|
964
|
-
ty: number;
|
|
965
|
-
tz: number;
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Transform
|
|
969
|
-
*
|
|
970
|
-
* | a | c | tx|
|
|
971
|
-
* | b | d | ty|
|
|
972
|
-
* | 0 | 0 | 1 |
|
|
973
|
-
*/
|
|
974
|
-
declare class Transform2D extends Matrix3 {
|
|
975
|
-
autoUpdate: boolean;
|
|
976
|
-
protected _cx: number;
|
|
977
|
-
protected _sx: number;
|
|
978
|
-
protected _cy: number;
|
|
979
|
-
protected _sy: number;
|
|
980
|
-
protected _translateX: number;
|
|
981
|
-
protected _translateY: number;
|
|
982
|
-
protected _translateZ: number;
|
|
983
|
-
protected _scaleX: number;
|
|
984
|
-
protected _scaleY: number;
|
|
985
|
-
protected _skewX: number;
|
|
986
|
-
protected _skewY: number;
|
|
987
|
-
protected _rotate: number;
|
|
988
|
-
dirtyId: number;
|
|
989
|
-
protected _needsUpdateArray: boolean;
|
|
990
|
-
protected _needsUpdateFields: boolean;
|
|
991
|
-
constructor(autoUpdate?: boolean);
|
|
992
|
-
protected _onUpdate(array: number[]): void;
|
|
993
|
-
protected _updateSkew(): void;
|
|
994
|
-
protected _requestUpdateArray(): void;
|
|
995
|
-
protected _requestUpdateFields(): void;
|
|
996
|
-
protected _performUpdateArray(): void;
|
|
997
|
-
protected _performUpdateFields(): void;
|
|
998
|
-
skew(x: number, y: number): this;
|
|
999
|
-
skewX(x: number): this;
|
|
1000
|
-
skewY(y: number): this;
|
|
1001
|
-
translate(x: number, y: number, z?: number): this;
|
|
1002
|
-
translateX(x: number): this;
|
|
1003
|
-
translateY(y: number): this;
|
|
1004
|
-
translateZ(z: number): this;
|
|
1005
|
-
translate3d(x: number, y: number, z: number): this;
|
|
1006
|
-
scale(x: number, y: number, _z?: number): this;
|
|
1007
|
-
scaleX(x: number): this;
|
|
1008
|
-
scaleY(y: number): this;
|
|
1009
|
-
scale3d(x: number, y: number, z: number): this;
|
|
1010
|
-
rotate(rad: number): this;
|
|
1011
|
-
rotateX(x: number): this;
|
|
1012
|
-
rotateY(y: number): this;
|
|
1013
|
-
rotateZ(z: number): this;
|
|
1014
|
-
rotate3d(x: number, y: number, z: number, rad: number): this;
|
|
1015
|
-
protected _rotateToScale(rad: number): number;
|
|
1016
|
-
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
1017
|
-
applyToPoint(x: number, y: number): number[];
|
|
1018
|
-
inverse(): this;
|
|
1019
|
-
update(): boolean;
|
|
1020
|
-
isIdentity(): boolean;
|
|
1021
|
-
toObject(): Transform2DObject;
|
|
1238
|
+
declare class QuadGeometry extends Geometry {
|
|
1239
|
+
constructor();
|
|
1022
1240
|
}
|
|
1023
1241
|
|
|
1024
|
-
declare
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1242
|
+
declare class EffectMaterial extends Material {
|
|
1243
|
+
vert: string;
|
|
1244
|
+
readonly uniforms: Map<string, any>;
|
|
1245
|
+
static RE: {
|
|
1246
|
+
getColor: RegExp;
|
|
1247
|
+
getFromColor: RegExp;
|
|
1248
|
+
getToColor: RegExp;
|
|
1249
|
+
transform: RegExp;
|
|
1250
|
+
transition: RegExp;
|
|
1251
|
+
};
|
|
1252
|
+
has: {
|
|
1253
|
+
getColor: boolean;
|
|
1254
|
+
getFromColor: boolean;
|
|
1255
|
+
getToColor: boolean;
|
|
1256
|
+
transform: boolean;
|
|
1257
|
+
transition: boolean;
|
|
1258
|
+
};
|
|
1259
|
+
constructor(glsl: string);
|
|
1260
|
+
}
|
|
1036
1261
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
get x(): number;
|
|
1042
|
-
set x(val: number);
|
|
1043
|
-
get y(): number;
|
|
1044
|
-
set y(val: number);
|
|
1045
|
-
get width(): number;
|
|
1046
|
-
set width(val: number);
|
|
1047
|
-
get height(): number;
|
|
1048
|
-
set height(val: number);
|
|
1049
|
-
constructor(x?: VectorLike, y?: number);
|
|
1050
|
-
update(x: number, y: number): this;
|
|
1051
|
-
getLength(): number;
|
|
1052
|
-
getAngle(): number;
|
|
1053
|
-
distanceTo(point: Vector2): number;
|
|
1054
|
-
normalize(): this;
|
|
1055
|
-
static lerp(a: VectorLike, b: VectorLike, t: number): Vector2;
|
|
1262
|
+
declare class UvMaterial extends Material {
|
|
1263
|
+
protected static _instance: UvMaterial;
|
|
1264
|
+
static get instance(): UvMaterial;
|
|
1265
|
+
constructor();
|
|
1056
1266
|
}
|
|
1057
1267
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1268
|
+
declare class QuadUvGeometry extends Geometry {
|
|
1269
|
+
protected static _instance: QuadUvGeometry;
|
|
1270
|
+
static get instance(): QuadUvGeometry;
|
|
1271
|
+
static draw(renderer: WebGLRenderer, material?: Material, uniforms?: Record<string, any>): void;
|
|
1062
1272
|
constructor();
|
|
1063
1273
|
}
|
|
1064
1274
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1275
|
+
declare class UvGeometry extends Geometry {
|
|
1276
|
+
positionBuffer: VertexBuffer;
|
|
1277
|
+
uvBuffer: VertexBuffer;
|
|
1278
|
+
constructor();
|
|
1279
|
+
update(vertices: Float32Array, uvs: Float32Array, indices: Uint16Array): this;
|
|
1070
1280
|
}
|
|
1071
1281
|
|
|
1072
|
-
type
|
|
1073
|
-
type
|
|
1074
|
-
interface
|
|
1282
|
+
type Texture2DFilterMode = WebGLTextureFilterMode;
|
|
1283
|
+
type Texture2DWrapMode = WebGLTextureWrapMode;
|
|
1284
|
+
interface Texture2DPixelsSource {
|
|
1075
1285
|
width: number;
|
|
1076
1286
|
height: number;
|
|
1077
1287
|
pixels: Uint8Array | null;
|
|
1078
1288
|
}
|
|
1079
|
-
type
|
|
1080
|
-
declare class
|
|
1081
|
-
static get EMPTY():
|
|
1082
|
-
static get WHITE():
|
|
1083
|
-
static get BLACK():
|
|
1084
|
-
static get RED():
|
|
1085
|
-
static get GREEN():
|
|
1086
|
-
static get BLUE():
|
|
1289
|
+
type Texture2DSource = TexImageSource | Texture2DPixelsSource;
|
|
1290
|
+
declare class Texture2D<T extends Texture2DSource = Texture2DSource> extends Resource {
|
|
1291
|
+
static get EMPTY(): Texture2D;
|
|
1292
|
+
static get WHITE(): Texture2D;
|
|
1293
|
+
static get BLACK(): Texture2D;
|
|
1294
|
+
static get RED(): Texture2D;
|
|
1295
|
+
static get GREEN(): Texture2D;
|
|
1296
|
+
static get BLUE(): Texture2D;
|
|
1087
1297
|
source: T;
|
|
1088
1298
|
width: number;
|
|
1089
1299
|
height: number;
|
|
1090
|
-
filterMode:
|
|
1091
|
-
wrapMode:
|
|
1300
|
+
filterMode: Texture2DFilterMode;
|
|
1301
|
+
wrapMode: Texture2DWrapMode;
|
|
1092
1302
|
pixelRatio: number;
|
|
1093
1303
|
protected _isPowerOfTwo: boolean;
|
|
1094
1304
|
protected _needsUpload: boolean;
|
|
@@ -1096,26 +1306,36 @@ declare class Texture<T extends TextureSource = TextureSource> extends Resource
|
|
|
1096
1306
|
get realWidth(): number;
|
|
1097
1307
|
get realHeight(): number;
|
|
1098
1308
|
constructor(source: T);
|
|
1099
|
-
protected _refreshPOT(): void;
|
|
1100
1309
|
/** @internal */
|
|
1101
1310
|
_glTextureOptions(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): WebGLTextureOptions;
|
|
1102
1311
|
/** @internal */
|
|
1103
1312
|
_glTexture(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): WebGLTexture;
|
|
1104
|
-
protected
|
|
1313
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1314
|
+
protected _updatePOT(): void;
|
|
1105
1315
|
protected _updateSize(): void;
|
|
1106
1316
|
requestUpload(): void;
|
|
1107
1317
|
upload(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): boolean;
|
|
1108
|
-
activate(renderer: WebGLRenderer, location?: number):
|
|
1318
|
+
activate(renderer: WebGLRenderer, location?: number): boolean;
|
|
1109
1319
|
inactivate(renderer: WebGLRenderer): void;
|
|
1110
1320
|
destroy(): void;
|
|
1111
1321
|
}
|
|
1112
1322
|
|
|
1323
|
+
declare class CanvasTexture extends Texture2D<HTMLCanvasElement> {
|
|
1324
|
+
pixelRatio: number;
|
|
1325
|
+
constructor(source?: HTMLCanvasElement);
|
|
1326
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
declare class ColorTexture extends Texture2D {
|
|
1330
|
+
constructor(value: ColorValue);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1113
1333
|
interface ImageTextureOptions {
|
|
1114
1334
|
autoLoad?: boolean;
|
|
1115
1335
|
useBitmap?: boolean;
|
|
1116
1336
|
crossorigin?: boolean | string | null;
|
|
1117
1337
|
}
|
|
1118
|
-
declare class ImageTexture extends
|
|
1338
|
+
declare class ImageTexture extends Texture2D<HTMLImageElement> {
|
|
1119
1339
|
bitmap?: ImageBitmap;
|
|
1120
1340
|
useBitmap: boolean;
|
|
1121
1341
|
preserveBitmap: boolean;
|
|
@@ -1129,8 +1349,9 @@ declare class ImageTexture extends Texture<HTMLImageElement> {
|
|
|
1129
1349
|
upload(renderer: WebGLRenderer): boolean;
|
|
1130
1350
|
}
|
|
1131
1351
|
|
|
1132
|
-
declare class PixelsTexture extends
|
|
1352
|
+
declare class PixelsTexture extends Texture2D<Texture2DPixelsSource> {
|
|
1133
1353
|
constructor(pixels?: ArrayLike<number> | ArrayBufferLike | ArrayBufferView | null, width?: number, height?: number);
|
|
1354
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1134
1355
|
}
|
|
1135
1356
|
|
|
1136
1357
|
interface VideoTextureOptions {
|
|
@@ -1146,7 +1367,7 @@ interface VideoTextureSource {
|
|
|
1146
1367
|
src: string;
|
|
1147
1368
|
mime: string;
|
|
1148
1369
|
}
|
|
1149
|
-
declare class VideoTexture extends
|
|
1370
|
+
declare class VideoTexture extends Texture2D<HTMLVideoElement> {
|
|
1150
1371
|
autoUpdate: boolean;
|
|
1151
1372
|
fps: number;
|
|
1152
1373
|
static readonly mimeTypes: Map<string, string>;
|
|
@@ -1165,7 +1386,7 @@ declare class VideoTexture extends Texture<HTMLVideoElement> {
|
|
|
1165
1386
|
protected _resolve?: (val: this) => void;
|
|
1166
1387
|
protected _reject?: (event: ErrorEvent) => void;
|
|
1167
1388
|
constructor(source: HTMLVideoElement | (string | VideoTextureSource)[] | string, options?: VideoTextureOptions);
|
|
1168
|
-
protected
|
|
1389
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1169
1390
|
protected _onPlayStart: () => void;
|
|
1170
1391
|
protected _onPlayStop: () => void;
|
|
1171
1392
|
protected _onCanPlay: () => void;
|
|
@@ -1179,7 +1400,144 @@ declare class VideoTexture extends Texture<HTMLVideoElement> {
|
|
|
1179
1400
|
destroy(): void;
|
|
1180
1401
|
}
|
|
1181
1402
|
|
|
1182
|
-
declare class ViewportTexture extends PixelsTexture {
|
|
1403
|
+
declare class ViewportTexture extends PixelsTexture {
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
type CanvasItemStyleFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'invert' | 'sepia' | 'opacity' | 'grayscale';
|
|
1407
|
+
type CanvasItemStyleFilter = Record<CanvasItemStyleFilterKey, number>;
|
|
1408
|
+
interface CanvasItemStyleProperties extends IDOCTextStyleDeclaration, IDOCTransformStyleDeclaration {
|
|
1409
|
+
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1410
|
+
backgroundColor?: ColorValue;
|
|
1411
|
+
backgroundImage?: string;
|
|
1412
|
+
filter: string;
|
|
1413
|
+
shadowColor: ColorValue;
|
|
1414
|
+
shadowOffsetX: number;
|
|
1415
|
+
shadowOffsetY: number;
|
|
1416
|
+
shadowBlur: number;
|
|
1417
|
+
opacity: number;
|
|
1418
|
+
borderWidth: number;
|
|
1419
|
+
borderRadius: number;
|
|
1420
|
+
borderColor: ColorValue;
|
|
1421
|
+
borderStyle: string;
|
|
1422
|
+
outlineWidth: number;
|
|
1423
|
+
outlineOffset: number;
|
|
1424
|
+
outlineColor: ColorValue;
|
|
1425
|
+
outlineStyle: string;
|
|
1426
|
+
visibility: Visibility;
|
|
1427
|
+
overflow: Overflow;
|
|
1428
|
+
pointerEvents: PointerEvents;
|
|
1429
|
+
}
|
|
1430
|
+
type PointerEvents = 'auto' | 'none';
|
|
1431
|
+
interface CanvasItemStyle extends CanvasItemStyleProperties {
|
|
1432
|
+
}
|
|
1433
|
+
declare class CanvasItemStyle extends Resource {
|
|
1434
|
+
backgroundColor?: string;
|
|
1435
|
+
backgroundImage?: string;
|
|
1436
|
+
filter: string;
|
|
1437
|
+
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1438
|
+
shadowColor: string;
|
|
1439
|
+
shadowOffsetX: number;
|
|
1440
|
+
shadowOffsetY: number;
|
|
1441
|
+
shadowBlur: number;
|
|
1442
|
+
opacity: number;
|
|
1443
|
+
borderWidth: number;
|
|
1444
|
+
borderRadius: number;
|
|
1445
|
+
borderColor: string;
|
|
1446
|
+
borderStyle: string;
|
|
1447
|
+
outlineWidth: number;
|
|
1448
|
+
outlineOffset: number;
|
|
1449
|
+
outlineColor: string;
|
|
1450
|
+
outlineStyle: string;
|
|
1451
|
+
visibility: Visibility;
|
|
1452
|
+
overflow: Overflow;
|
|
1453
|
+
pointerEvents: PointerEvents;
|
|
1454
|
+
protected _backgroundColor: Color;
|
|
1455
|
+
constructor(properties?: Partial<CanvasItemStyleProperties>);
|
|
1456
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1457
|
+
canPointeEvents(): boolean;
|
|
1458
|
+
getComputedOpacity(): number;
|
|
1459
|
+
getComputedBackgroundColor(): Color;
|
|
1460
|
+
getComputedBackgroundImage(): Promise<Texture2D<ImageBitmap> | undefined>;
|
|
1461
|
+
getComputedTransform(): Transform2D;
|
|
1462
|
+
getComputedTransformOrigin(): number[];
|
|
1463
|
+
getComputedFilter(): CanvasItemStyleFilter;
|
|
1464
|
+
getComputedFilterColorMatrix(): ColorMatrix;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
interface CanvasBatchable extends Batchable2D {
|
|
1468
|
+
type: 'stroke' | 'fill';
|
|
1469
|
+
texture?: Texture2D;
|
|
1470
|
+
}
|
|
1471
|
+
interface StrokedGraphics {
|
|
1472
|
+
path: Path2D;
|
|
1473
|
+
texture?: Texture2D;
|
|
1474
|
+
textureTransform?: Transform2D;
|
|
1475
|
+
style: LineStyle;
|
|
1476
|
+
}
|
|
1477
|
+
interface FilledGraphics {
|
|
1478
|
+
path: Path2D;
|
|
1479
|
+
texture?: Texture2D;
|
|
1480
|
+
textureTransform?: Transform2D;
|
|
1481
|
+
}
|
|
1482
|
+
declare class CanvasContext extends Path2D {
|
|
1483
|
+
textureTransform?: Transform2D;
|
|
1484
|
+
fillStyle?: ColorValue | Texture2D;
|
|
1485
|
+
strokeStyle?: ColorValue | Texture2D;
|
|
1486
|
+
lineCap?: LineCap;
|
|
1487
|
+
lineJoin?: LineJoin;
|
|
1488
|
+
lineWidth?: number;
|
|
1489
|
+
miterLimit?: number;
|
|
1490
|
+
_defaultStyle: Texture2D<Texture2DSource>;
|
|
1491
|
+
_stroke: StrokedGraphics[];
|
|
1492
|
+
_fille: FilledGraphics[];
|
|
1493
|
+
stroke(): void;
|
|
1494
|
+
fillRect(x: number, y: number, width: number, height: number): void;
|
|
1495
|
+
strokeRect(x: number, y: number, width: number, height: number): void;
|
|
1496
|
+
fill(): void;
|
|
1497
|
+
copy(source: CanvasContext): this;
|
|
1498
|
+
reset(): this;
|
|
1499
|
+
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, textureTransform?: Transform2D): void;
|
|
1500
|
+
toBatchables(): CanvasBatchable[];
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
interface RenderCall {
|
|
1504
|
+
renderable: Node;
|
|
1505
|
+
fn: (renderer: WebGLRenderer, next: () => void) => void;
|
|
1506
|
+
parentCall: RenderCall | undefined;
|
|
1507
|
+
calls: RenderCall[];
|
|
1508
|
+
}
|
|
1509
|
+
declare class RenderStack extends Node {
|
|
1510
|
+
currentCall?: RenderCall;
|
|
1511
|
+
calls: RenderCall[];
|
|
1512
|
+
createCall(renderable: Node): RenderCall;
|
|
1513
|
+
push(renderable: Node): RenderCall;
|
|
1514
|
+
render(renderer: WebGLRenderer): void;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
interface TimelineEventMap extends NodeEventMap {
|
|
1518
|
+
updateCurrentTime: (current: number, delta: number) => void;
|
|
1519
|
+
}
|
|
1520
|
+
interface TimelineProperties extends NodeProperties {
|
|
1521
|
+
startTime: number;
|
|
1522
|
+
currentTime: number;
|
|
1523
|
+
endTime: number;
|
|
1524
|
+
loop: boolean;
|
|
1525
|
+
}
|
|
1526
|
+
interface Timeline {
|
|
1527
|
+
on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1528
|
+
off: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1529
|
+
emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1530
|
+
}
|
|
1531
|
+
declare class Timeline extends Node {
|
|
1532
|
+
startTime: number;
|
|
1533
|
+
currentTime: number;
|
|
1534
|
+
endTime: number;
|
|
1535
|
+
loop: boolean;
|
|
1536
|
+
static from(range: number | number[], loop?: boolean): Timeline;
|
|
1537
|
+
constructor(properties?: Partial<TimelineProperties>);
|
|
1538
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1539
|
+
addTime(delta: number): this;
|
|
1540
|
+
protected _process(delta: number): void;
|
|
1183
1541
|
}
|
|
1184
1542
|
|
|
1185
1543
|
interface ViewportFramebuffer {
|
|
@@ -1192,6 +1550,7 @@ declare class Viewport extends Node {
|
|
|
1192
1550
|
y: number;
|
|
1193
1551
|
width: number;
|
|
1194
1552
|
height: number;
|
|
1553
|
+
get valid(): boolean;
|
|
1195
1554
|
protected _projection: Projection2D;
|
|
1196
1555
|
protected _framebufferIndex: number;
|
|
1197
1556
|
protected _framebuffers: ViewportFramebuffer[];
|
|
@@ -1202,12 +1561,12 @@ declare class Viewport extends Node {
|
|
|
1202
1561
|
_glFramebufferOptions(renderer: WebGLRenderer): WebGLFramebufferOptions;
|
|
1203
1562
|
/** @internal */
|
|
1204
1563
|
_glFramebuffer(renderer: WebGLRenderer): WebGLFramebuffer;
|
|
1205
|
-
protected
|
|
1564
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1206
1565
|
requestUpload(): void;
|
|
1207
1566
|
resize(width: number, height: number): void;
|
|
1208
1567
|
upload(renderer: WebGLRenderer): boolean;
|
|
1209
|
-
activate(renderer: WebGLRenderer):
|
|
1210
|
-
redraw(renderer: WebGLRenderer, cb: () => void):
|
|
1568
|
+
activate(renderer: WebGLRenderer): boolean;
|
|
1569
|
+
redraw(renderer: WebGLRenderer, cb: () => void): boolean;
|
|
1211
1570
|
activateWithCopy(renderer: WebGLRenderer, target: Viewport): void;
|
|
1212
1571
|
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1213
1572
|
toProjectionArray(transpose?: boolean): number[];
|
|
@@ -1225,415 +1584,209 @@ interface SceneTree {
|
|
|
1225
1584
|
emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1226
1585
|
}
|
|
1227
1586
|
declare class SceneTree extends MainLoop {
|
|
1587
|
+
paused: boolean;
|
|
1588
|
+
backgroundColor?: ColorValue;
|
|
1228
1589
|
readonly renderStack: RenderStack;
|
|
1229
1590
|
readonly root: Viewport;
|
|
1230
|
-
readonly timeline:
|
|
1591
|
+
readonly timeline: Timeline;
|
|
1592
|
+
protected _backgroundColor: Color;
|
|
1231
1593
|
protected _currentViewport?: Viewport;
|
|
1232
|
-
getCurrentViewport(): Viewport | undefined;
|
|
1233
|
-
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1234
|
-
|
|
1235
|
-
protected
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
interface NodeEventMap extends ReferenceEventMap {
|
|
1239
|
-
enterTree: () => void;
|
|
1240
|
-
exitTree: () => void;
|
|
1241
|
-
childExitingTree: (node: Node) => void;
|
|
1242
|
-
childEnteredTree: (node: Node) => void;
|
|
1243
|
-
postEnterTree: () => void;
|
|
1244
|
-
ready: () => void;
|
|
1245
|
-
treeEntered: () => void;
|
|
1246
|
-
treeExiting: () => void;
|
|
1247
|
-
treeExited: () => void;
|
|
1248
|
-
parented: () => void;
|
|
1249
|
-
unparented: () => void;
|
|
1250
|
-
process: (delta?: number) => void;
|
|
1251
|
-
addChild: (child: Node) => void;
|
|
1252
|
-
removeChild: (child: Node, index: number) => void;
|
|
1253
|
-
moveChild: (child: Node, newIndex: number, oldIndex: number) => void;
|
|
1254
|
-
}
|
|
1255
|
-
declare enum InternalMode {
|
|
1256
|
-
DEFAULT = 0,
|
|
1257
|
-
FRONT = 1,
|
|
1258
|
-
BACK = 2
|
|
1259
|
-
}
|
|
1260
|
-
interface NodeOptions {
|
|
1261
|
-
name?: string;
|
|
1262
|
-
mask?: Maskable;
|
|
1263
|
-
visibility?: Visibility;
|
|
1264
|
-
visibleDelay?: number;
|
|
1265
|
-
visibleDuration?: number;
|
|
1266
|
-
}
|
|
1267
|
-
interface Node {
|
|
1268
|
-
on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1269
|
-
off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1270
|
-
emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Node 是所有节点的基类,提供了管理场景树的功能。
|
|
1274
|
-
* 在 Godot 中,节点代表了游戏中的元素或对象,所有的节点都是通过继承 Node 类来实现的。
|
|
1275
|
-
* Node 处理与场景树、节点的添加、删除、子父关系、以及输入事件等相关的操作。
|
|
1276
|
-
*
|
|
1277
|
-
* 功能和用途:
|
|
1278
|
-
* • 管理节点在场景树中的位置和生命周期。
|
|
1279
|
-
* • 节点可以有 子节点,并且可以通过 add_child() 方法将子节点添加到当前节点。
|
|
1280
|
-
* • 支持 信号(signals)机制,用于事件通知。
|
|
1281
|
-
* • 提供 生命周期方法,如 _ready()、_enter_tree()、_exit_tree() 等。
|
|
1282
|
-
* • 支持 输入事件,通过 _input() 等方法来处理输入。
|
|
1283
|
-
*/
|
|
1284
|
-
declare class Node extends Reference {
|
|
1285
|
-
readonly tag: string;
|
|
1286
|
-
renderable?: boolean;
|
|
1287
|
-
name: string;
|
|
1288
|
-
mask?: Maskable;
|
|
1289
|
-
visibility: Visibility;
|
|
1290
|
-
visibleDelay: number;
|
|
1291
|
-
visibleDuration: number;
|
|
1292
|
-
/** @internal */
|
|
1293
|
-
_computedVisibleDelay: number;
|
|
1294
|
-
_computedVisibleDuration: number;
|
|
1295
|
-
_computedVisibility: Visibility;
|
|
1296
|
-
/** @internal */
|
|
1297
|
-
_internalMode: InternalMode;
|
|
1298
|
-
protected _readyed: boolean;
|
|
1299
|
-
protected _tree?: SceneTree;
|
|
1300
|
-
protected _parent?: Node;
|
|
1301
|
-
protected _children: Node[];
|
|
1302
|
-
get children(): Node[];
|
|
1303
|
-
get visibleTimeline(): number[];
|
|
1304
|
-
get visibleRelativeTime(): number;
|
|
1305
|
-
get visibleProgress(): number;
|
|
1306
|
-
get siblingIndex(): number;
|
|
1307
|
-
set siblingIndex(toIndex: number);
|
|
1308
|
-
get previousSibling(): Node | undefined;
|
|
1309
|
-
get nextSibling(): Node | undefined;
|
|
1310
|
-
get firstSibling(): Node | undefined;
|
|
1311
|
-
get lastSibling(): Node | undefined;
|
|
1312
|
-
constructor(options?: NodeOptions);
|
|
1313
|
-
/** Meta */
|
|
1314
|
-
protected _meta: Map<string, unknown>;
|
|
1315
|
-
hasMeta(name: string): boolean;
|
|
1316
|
-
getMeta<T = any>(name: string): T | undefined;
|
|
1317
|
-
getMeta<T = any>(name: string, defaultVal: T): T;
|
|
1318
|
-
setMeta(name: string, value: any): void;
|
|
1319
|
-
deleteMeta(name: string): void;
|
|
1320
|
-
clearMeta(): void;
|
|
1321
|
-
/** Name */
|
|
1322
|
-
setName(value: string): this;
|
|
1323
|
-
/** Tree */
|
|
1324
|
-
getTree(): SceneTree | undefined;
|
|
1325
|
-
getViewport(): Viewport | undefined;
|
|
1326
|
-
getWindow(): Viewport | undefined;
|
|
1327
|
-
isInsideTree(): boolean;
|
|
1328
|
-
/** @internal */
|
|
1329
|
-
_setTree(tree: SceneTree | undefined): this;
|
|
1330
|
-
isRenderable(): boolean;
|
|
1331
|
-
isVisible(): boolean;
|
|
1332
|
-
protected _updateVisibility(): void;
|
|
1333
|
-
protected _onEnterTree(): void;
|
|
1334
|
-
protected _onExitTree(): void;
|
|
1335
|
-
protected _onParented(): void;
|
|
1336
|
-
protected _onUnparented(): void;
|
|
1337
|
-
protected _onReady(): void;
|
|
1338
|
-
protected _onProcess(delta?: number): void;
|
|
1339
|
-
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1340
|
-
input(event: UIEvent): void;
|
|
1341
|
-
/** Parent */
|
|
1342
|
-
get parent(): Node | undefined;
|
|
1343
|
-
hasParent(): boolean;
|
|
1344
|
-
getParent(): Node | undefined;
|
|
1345
|
-
/** @internal */
|
|
1346
|
-
_setParent(parent: Node | undefined): this;
|
|
1347
|
-
/** Children */
|
|
1348
|
-
getChildren(includeInternal?: boolean | InternalMode): Node[];
|
|
1349
|
-
getIndex(includeInternal?: boolean | InternalMode): number;
|
|
1350
|
-
getNode<T extends Node>(path: string): T | undefined;
|
|
1351
|
-
removeNode(path: string): void;
|
|
1352
|
-
addSibling(sibling: Node): this;
|
|
1353
|
-
addChild(child: Node, internalMode?: InternalMode): this;
|
|
1354
|
-
moveChild(child: Node, toIndex: number, internalMode?: InternalMode): this;
|
|
1355
|
-
removeChild(child: Node): this;
|
|
1356
|
-
removeChildren(): void;
|
|
1357
|
-
remove(): void;
|
|
1358
|
-
forEach(fn: (child: Node) => void): this;
|
|
1359
|
-
deepForEach(fn: (descendant: Node) => void): this;
|
|
1360
|
-
is(target: Node | undefined | null): boolean;
|
|
1361
|
-
protected _enterTree(): void;
|
|
1362
|
-
protected _ready(): void;
|
|
1363
|
-
protected _exitTree(): void;
|
|
1364
|
-
protected _parented(): void;
|
|
1365
|
-
protected _unparented(): void;
|
|
1366
|
-
protected _process(_delta: number): void;
|
|
1367
|
-
protected _input(_event: UIEvent): void;
|
|
1368
|
-
protected _render(_renderer: WebGLRenderer): void;
|
|
1369
|
-
toJSON(): Record<string, any>;
|
|
1370
|
-
static parse(JSON: Record<string, any>[]): Node[];
|
|
1371
|
-
static parse(JSON: Record<string, any>): Node;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
declare function createNode<T extends Node>(tag?: string, options?: Record<string, any>): T;
|
|
1375
|
-
|
|
1376
|
-
declare function nextTick(cb?: () => void): Promise<void>;
|
|
1377
|
-
|
|
1378
|
-
type Callback = () => void;
|
|
1379
|
-
interface QueueItem {
|
|
1380
|
-
cb: Callback;
|
|
1381
|
-
once: boolean;
|
|
1382
|
-
}
|
|
1383
|
-
interface Options {
|
|
1384
|
-
sort?: number;
|
|
1385
|
-
once?: boolean;
|
|
1386
|
-
}
|
|
1387
|
-
declare class Ticker {
|
|
1388
|
-
protected static _queue: QueueItem[][];
|
|
1389
|
-
protected static _currentTime: number;
|
|
1390
|
-
protected static _elapsed: number;
|
|
1391
|
-
protected static _requestId?: number;
|
|
1392
|
-
static get currentTime(): number;
|
|
1393
|
-
static get elapsed(): number;
|
|
1394
|
-
static on(cb: Callback, options?: Options): void;
|
|
1395
|
-
static off(cb: Callback, options?: Options): void;
|
|
1396
|
-
static start(): void;
|
|
1397
|
-
static stop(): void;
|
|
1398
|
-
protected static _update(time: number): void;
|
|
1399
|
-
protected static _performUpdate(): void;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
declare const linear: (amount: number) => number;
|
|
1403
|
-
declare const ease: (amount: number) => number;
|
|
1404
|
-
declare const easeIn: (amount: number) => number;
|
|
1405
|
-
declare const easeOut: (amount: number) => number;
|
|
1406
|
-
declare const easeInOut: (amount: number) => number;
|
|
1407
|
-
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number;
|
|
1408
|
-
declare const timingFunctions: {
|
|
1409
|
-
linear: (amount: number) => number;
|
|
1410
|
-
ease: (amount: number) => number;
|
|
1411
|
-
easeIn: (amount: number) => number;
|
|
1412
|
-
easeOut: (amount: number) => number;
|
|
1413
|
-
easeInOut: (amount: number) => number;
|
|
1414
|
-
};
|
|
1415
|
-
type TimingFunctions = typeof timingFunctions;
|
|
1416
|
-
type Easing = keyof TimingFunctions | `cubic-bezier(${string})`;
|
|
1417
|
-
interface Keyframe {
|
|
1418
|
-
easing?: Easing;
|
|
1419
|
-
offset?: number;
|
|
1420
|
-
[property: string]: string | number | null | undefined;
|
|
1421
|
-
}
|
|
1422
|
-
interface NormalizedKeyframe {
|
|
1423
|
-
easing: (amount: number) => number;
|
|
1424
|
-
offset: number;
|
|
1425
|
-
props: Record<string, any>;
|
|
1426
|
-
}
|
|
1427
|
-
interface AnimationOptions {
|
|
1428
|
-
mode?: 'parent' | 'sibling';
|
|
1429
|
-
startTime?: number;
|
|
1430
|
-
duration?: number;
|
|
1431
|
-
loop?: boolean;
|
|
1432
|
-
keyframes?: Keyframe[];
|
|
1433
|
-
}
|
|
1434
|
-
declare class Animation2D extends Node {
|
|
1435
|
-
mode: 'parent' | 'sibling';
|
|
1436
|
-
loop: boolean;
|
|
1437
|
-
keyframes: Keyframe[];
|
|
1438
|
-
easing?: Easing;
|
|
1439
|
-
delay: number;
|
|
1440
|
-
duration: number;
|
|
1441
|
-
protected _keyframes: NormalizedKeyframe[];
|
|
1442
|
-
protected _starting: boolean;
|
|
1443
|
-
protected _startProps: RawWeakMap<any, Map<string, any>>;
|
|
1444
|
-
constructor(options?: AnimationOptions);
|
|
1445
|
-
protected _enterTree(): void;
|
|
1446
|
-
protected _exitTree(): void;
|
|
1447
|
-
protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1448
|
-
protected _getTargets(): any[];
|
|
1449
|
-
protected _updateKeyframes(): void;
|
|
1450
|
-
protected _onUpdateTime(): void;
|
|
1451
|
-
protected _updateStartProps(): void;
|
|
1452
|
-
protected _parseEasing(easing: Easing | undefined): (amount: number) => number;
|
|
1453
|
-
protected _parseKeyframes(currentTime: number, startProps: Map<string, any>): [NormalizedKeyframe, NormalizedKeyframe] | null;
|
|
1454
|
-
protected _commitStyle(currentTime: number, target: any, startProps: Map<string, any>, previous: NormalizedKeyframe, current: NormalizedKeyframe): void;
|
|
1455
|
-
protected _getDiffValue(name: string, previous: string | undefined, current: string | undefined, weight: number, context: Record<string, any>): any;
|
|
1456
|
-
cancel(): void;
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
type ColorValue = number | AnyColor;
|
|
1460
|
-
declare class Color {
|
|
1461
|
-
protected _colord: Colord;
|
|
1462
|
-
protected _value: ColorValue;
|
|
1463
|
-
get value(): ColorValue;
|
|
1464
|
-
set value(value: ColorValue);
|
|
1465
|
-
get r8(): number;
|
|
1466
|
-
get g8(): number;
|
|
1467
|
-
get b8(): number;
|
|
1468
|
-
get a8(): number;
|
|
1469
|
-
get r(): number;
|
|
1470
|
-
get g(): number;
|
|
1471
|
-
get b(): number;
|
|
1472
|
-
get a(): number;
|
|
1473
|
-
get rgb(): number;
|
|
1474
|
-
get bgr(): number;
|
|
1475
|
-
get abgr(): number;
|
|
1476
|
-
constructor(value?: ColorValue);
|
|
1477
|
-
toArgb(alpha?: number, applyToRGB?: boolean): number;
|
|
1478
|
-
toHex(): string;
|
|
1479
|
-
toArray(): [number, number, number, number];
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
/**
|
|
1483
|
-
* Matrix4(4x5)
|
|
1484
|
-
*
|
|
1485
|
-
* | r0 | g0 | b0 | a0 | tr |
|
|
1486
|
-
* | r1 | g1 | b1 | a1 | tg |
|
|
1487
|
-
* | r2 | g2 | b2 | a2 | tb |
|
|
1488
|
-
* | r3 | g3 | b3 | a3 | ta |
|
|
1489
|
-
*/
|
|
1490
|
-
declare class ColorMatrix extends Matrix {
|
|
1491
|
-
constructor(array?: number[]);
|
|
1492
|
-
hueRotate(angle?: number): this;
|
|
1493
|
-
saturate(amount?: number): this;
|
|
1494
|
-
brightness(amount?: number): this;
|
|
1495
|
-
contrast(amount?: number): this;
|
|
1496
|
-
invert(amount?: number): this;
|
|
1497
|
-
sepia(amount?: number): this;
|
|
1498
|
-
opacity(amount?: number): this;
|
|
1499
|
-
grayscale(amount?: number): this;
|
|
1500
|
-
multiply(target: number[]): this;
|
|
1501
|
-
toMatrix4(): Matrix4;
|
|
1502
|
-
toVector4(): Vector4;
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
declare class ColorTexture extends Texture {
|
|
1506
|
-
constructor(value: ColorValue);
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
interface CanvasBatchable extends Batchable2D {
|
|
1510
|
-
type: 'stroke' | 'fill';
|
|
1511
|
-
texture?: Texture;
|
|
1512
|
-
}
|
|
1513
|
-
interface StrokedGraphics {
|
|
1514
|
-
path: Path2D;
|
|
1515
|
-
texture?: Texture;
|
|
1516
|
-
textureTransform?: Transform2D;
|
|
1517
|
-
style: LineStyle;
|
|
1518
|
-
}
|
|
1519
|
-
interface FilledGraphics {
|
|
1520
|
-
path: Path2D;
|
|
1521
|
-
texture?: Texture;
|
|
1522
|
-
textureTransform?: Transform2D;
|
|
1523
|
-
}
|
|
1524
|
-
declare class CanvasContext extends Path2D {
|
|
1525
|
-
textureTransform?: Transform2D;
|
|
1526
|
-
fillStyle?: ColorValue | Texture;
|
|
1527
|
-
strokeStyle?: ColorValue | Texture;
|
|
1528
|
-
lineCap?: LineCap;
|
|
1529
|
-
lineJoin?: LineJoin;
|
|
1530
|
-
lineWidth?: number;
|
|
1531
|
-
miterLimit?: number;
|
|
1532
|
-
_defaultStyle: Texture<TextureSource>;
|
|
1533
|
-
_stroke: StrokedGraphics[];
|
|
1534
|
-
_fille: FilledGraphics[];
|
|
1535
|
-
stroke(): void;
|
|
1536
|
-
fillRect(x: number, y: number, width: number, height: number): void;
|
|
1537
|
-
strokeRect(x: number, y: number, width: number, height: number): void;
|
|
1538
|
-
fill(): void;
|
|
1539
|
-
copy(source: CanvasContext): this;
|
|
1540
|
-
reset(): this;
|
|
1541
|
-
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture, textureTransform?: Transform2D): void;
|
|
1542
|
-
toBatchables(): CanvasBatchable[];
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<Style2DFilterProperties>, Partial<Style2DTextProperties>, Partial<Style2DTransformProperties> {
|
|
1546
|
-
shadowColor?: string;
|
|
1547
|
-
shadowOffsetX?: number;
|
|
1548
|
-
shadowOffsetY?: number;
|
|
1549
|
-
shadowBlur?: number;
|
|
1550
|
-
opacity?: number;
|
|
1551
|
-
borderRadius?: number;
|
|
1552
|
-
overflow?: Overflow;
|
|
1553
|
-
}
|
|
1554
|
-
interface Style2D extends Style2DBackgroundExtend, Style2DFilterExtend, Style2DTextExtend, Style2DTransformExtend {
|
|
1555
|
-
}
|
|
1556
|
-
declare class Style2D extends _Object {
|
|
1557
|
-
shadowColor: string;
|
|
1558
|
-
shadowOffsetX: number;
|
|
1559
|
-
shadowOffsetY: number;
|
|
1560
|
-
shadowBlur: number;
|
|
1561
|
-
opacity: number;
|
|
1562
|
-
borderRadius: number;
|
|
1563
|
-
overflow: Overflow;
|
|
1564
|
-
constructor(options?: Style2DOptions);
|
|
1565
|
-
protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1594
|
+
getCurrentViewport(): Viewport | undefined;
|
|
1595
|
+
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1596
|
+
constructor(timeline?: Timeline);
|
|
1597
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1598
|
+
protected _render(renderer: WebGLRenderer, delta?: number): this;
|
|
1599
|
+
protected _renderScreen(renderer: WebGLRenderer): void;
|
|
1566
1600
|
}
|
|
1567
1601
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1602
|
+
interface NodeEventMap extends CoreObjectEventMap, InputEventMap {
|
|
1603
|
+
treeEnter: (tree: SceneTree) => void;
|
|
1604
|
+
treeEntered: (tree: SceneTree) => void;
|
|
1605
|
+
treePostEnter: (tree: SceneTree) => void;
|
|
1606
|
+
treeExit: (oldTree: SceneTree) => void;
|
|
1607
|
+
treeExiting: (oldTree: SceneTree) => void;
|
|
1608
|
+
treeExited: (oldTree: SceneTree) => void;
|
|
1609
|
+
childExitingTree: (node: Node) => void;
|
|
1610
|
+
childEnteredTree: (node: Node) => void;
|
|
1611
|
+
ready: () => void;
|
|
1612
|
+
parented: (parent: Node) => void;
|
|
1613
|
+
unparented: (oldParent: Node) => void;
|
|
1614
|
+
processing: (delta?: number) => void;
|
|
1615
|
+
process: (delta?: number) => void;
|
|
1616
|
+
processed: (delta?: number) => void;
|
|
1617
|
+
addChild: (child: Node) => void;
|
|
1618
|
+
removeChild: (child: Node, index: number) => void;
|
|
1619
|
+
moveChild: (child: Node, newIndex: number, oldIndex: number) => void;
|
|
1570
1620
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1621
|
+
type InternalMode = 'default' | 'front' | 'back';
|
|
1622
|
+
type ProcessMode = 'inherit' | 'pausable' | 'when_paused' | 'always' | 'disabled';
|
|
1623
|
+
type RenderMode = 'inherit' | 'always' | 'disabled';
|
|
1624
|
+
interface NodeProperties {
|
|
1625
|
+
name: string;
|
|
1626
|
+
processMode: ProcessMode;
|
|
1627
|
+
renderMode: RenderMode;
|
|
1628
|
+
internalMode: InternalMode;
|
|
1629
|
+
mask: Maskable;
|
|
1575
1630
|
}
|
|
1576
|
-
interface
|
|
1577
|
-
|
|
1631
|
+
interface Node {
|
|
1632
|
+
on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1633
|
+
off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1634
|
+
emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1578
1635
|
}
|
|
1579
|
-
declare class
|
|
1580
|
-
|
|
1636
|
+
declare class Node extends CoreObject {
|
|
1637
|
+
readonly tag: string;
|
|
1638
|
+
name: string;
|
|
1639
|
+
mask?: Maskable;
|
|
1640
|
+
processMode: ProcessMode;
|
|
1641
|
+
renderMode: RenderMode;
|
|
1642
|
+
internalMode: InternalMode;
|
|
1643
|
+
protected _readyed: boolean;
|
|
1644
|
+
constructor(properties?: Partial<NodeProperties>, children?: Node[]);
|
|
1645
|
+
/** Name */
|
|
1646
|
+
getName(): string;
|
|
1647
|
+
setName(value: string): this;
|
|
1648
|
+
/** Tree */
|
|
1649
|
+
protected _tree?: SceneTree;
|
|
1650
|
+
get tree(): SceneTree | undefined;
|
|
1651
|
+
set tree(tree: SceneTree | undefined);
|
|
1652
|
+
getTree(): SceneTree | undefined;
|
|
1653
|
+
getViewport(): Viewport | undefined;
|
|
1654
|
+
getWindow(): Viewport | undefined;
|
|
1655
|
+
isInsideTree(): boolean;
|
|
1656
|
+
setTree(tree: SceneTree | undefined): this;
|
|
1657
|
+
/** Parent */
|
|
1658
|
+
protected _parent?: Node;
|
|
1659
|
+
get parent(): Node | undefined;
|
|
1660
|
+
set parent(parent: Node | undefined);
|
|
1661
|
+
hasParent(): boolean;
|
|
1662
|
+
getParent(): Node | undefined;
|
|
1663
|
+
setParent(parent: Node | undefined): this;
|
|
1664
|
+
/** Children */
|
|
1665
|
+
protected _children: Node[];
|
|
1666
|
+
get children(): Node[];
|
|
1667
|
+
get siblingIndex(): number;
|
|
1668
|
+
set siblingIndex(toIndex: number);
|
|
1669
|
+
get previousSibling(): Node | undefined;
|
|
1670
|
+
get nextSibling(): Node | undefined;
|
|
1671
|
+
get firstSibling(): Node | undefined;
|
|
1672
|
+
get lastSibling(): Node | undefined;
|
|
1673
|
+
/** Meta */
|
|
1674
|
+
protected _meta: Map<string, unknown>;
|
|
1675
|
+
hasMeta(name: string): boolean;
|
|
1676
|
+
getMeta<T = any>(name: string): T | undefined;
|
|
1677
|
+
getMeta<T = any>(name: string, defaultVal: T): T;
|
|
1678
|
+
setMeta(name: string, value: any): void;
|
|
1679
|
+
deleteMeta(name: string): void;
|
|
1680
|
+
clearMeta(): void;
|
|
1681
|
+
canProcess(): boolean;
|
|
1682
|
+
canRender(): boolean;
|
|
1683
|
+
protected _onTreeEnter(tree: SceneTree): void;
|
|
1684
|
+
protected _onTreeExit(oldTree: SceneTree): void;
|
|
1685
|
+
protected _onParented(parent: Node): void;
|
|
1686
|
+
protected _onUnparented(oldParent: Node): void;
|
|
1687
|
+
protected _onReady(): void;
|
|
1688
|
+
protected _onProcess(delta?: number): void;
|
|
1689
|
+
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1690
|
+
input(event: InputEvent, key: InputEventKey): void;
|
|
1691
|
+
/** Children */
|
|
1692
|
+
getChildren(includeInternal?: boolean | InternalMode): Node[];
|
|
1693
|
+
getIndex(includeInternal?: boolean | InternalMode): number;
|
|
1694
|
+
getNode<T extends Node>(path: string): T | undefined;
|
|
1695
|
+
removeNode(path: string): void;
|
|
1696
|
+
addSibling(sibling: Node): this;
|
|
1697
|
+
append(children: Node[]): this;
|
|
1698
|
+
append(...children: Node[]): this;
|
|
1699
|
+
addChild(child: Node, internalMode?: InternalMode): this;
|
|
1700
|
+
moveChild(child: Node, toIndex: number, internalMode?: InternalMode): this;
|
|
1701
|
+
removeChild(child: Node): this;
|
|
1702
|
+
removeChildren(): void;
|
|
1703
|
+
remove(): void;
|
|
1704
|
+
forEach(fn: (child: Node) => void): this;
|
|
1705
|
+
deepForEach(fn: (descendant: Node) => void): this;
|
|
1706
|
+
is(target: Node | undefined | null): boolean;
|
|
1707
|
+
/** override */
|
|
1708
|
+
protected _ready(): void;
|
|
1709
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
1710
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
1711
|
+
protected _parented(parent: Node): void;
|
|
1712
|
+
protected _unparented(oldParent: Node): void;
|
|
1713
|
+
protected _process(delta: number): void;
|
|
1714
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1715
|
+
protected _render(renderer: WebGLRenderer): void;
|
|
1716
|
+
toJSON(): Record<string, any>;
|
|
1717
|
+
static parse(JSON: Record<string, any>[]): Node[];
|
|
1718
|
+
static parse(JSON: Record<string, any>): Node;
|
|
1581
1719
|
}
|
|
1582
|
-
declare function getComputedBackgroundImage(this: Style2D): Promise<Texture<ImageBitmap> | undefined>;
|
|
1583
1720
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
interface Style2DFilterExtend extends Style2DFilterProperties {
|
|
1590
|
-
getComputedFilter: typeof getComputedFilter;
|
|
1591
|
-
getComputedFilterColorMatrix: typeof getComputedFilterColorMatrix;
|
|
1592
|
-
}
|
|
1593
|
-
declare class Style2DFilterModule extends Style2DModule {
|
|
1594
|
-
install(Style2D: new () => Style2D): void;
|
|
1721
|
+
interface TimelineNodeProperties extends NodeProperties {
|
|
1722
|
+
delay: number;
|
|
1723
|
+
duration: number;
|
|
1724
|
+
paused: boolean;
|
|
1595
1725
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
interface Style2DTextProperties extends IDOCTextStyleDeclaration {
|
|
1600
|
-
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1726
|
+
interface TimelineNodeEventMap extends NodeEventMap {
|
|
1727
|
+
updateCurrentTime: (currentTime: number) => void;
|
|
1601
1728
|
}
|
|
1602
|
-
interface
|
|
1729
|
+
interface TimelineNode {
|
|
1730
|
+
on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1731
|
+
off: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1732
|
+
emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1603
1733
|
}
|
|
1604
|
-
declare class
|
|
1605
|
-
|
|
1734
|
+
declare class TimelineNode extends Node {
|
|
1735
|
+
delay: number;
|
|
1736
|
+
duration: number;
|
|
1737
|
+
paused: boolean;
|
|
1738
|
+
constructor(properties?: Partial<TimelineNodeProperties>, children?: Node[]);
|
|
1739
|
+
/** Timeline */
|
|
1740
|
+
computedDuration: number;
|
|
1741
|
+
protected _currentTime: number;
|
|
1742
|
+
protected _startTime: number;
|
|
1743
|
+
get timeline(): Timeline | undefined;
|
|
1744
|
+
get timelineCurrentTime(): number;
|
|
1745
|
+
get parentStartTime(): number;
|
|
1746
|
+
get currentTime(): number;
|
|
1747
|
+
get startTime(): number;
|
|
1748
|
+
set startTime(val: number);
|
|
1749
|
+
get endTime(): number;
|
|
1750
|
+
get currentTimeProgress(): number;
|
|
1751
|
+
isInsideTimeRange(): boolean;
|
|
1752
|
+
protected _updateCurrentTime(force?: boolean): void;
|
|
1753
|
+
protected _process(delta: number): void;
|
|
1606
1754
|
}
|
|
1607
1755
|
|
|
1608
|
-
interface
|
|
1756
|
+
interface CanvasItemProperties extends TimelineNodeProperties {
|
|
1757
|
+
visible: boolean;
|
|
1758
|
+
style: Partial<CanvasItemStyleProperties>;
|
|
1759
|
+
modulate: ColorValue;
|
|
1760
|
+
blendMode: WebGLBlendMode;
|
|
1761
|
+
inheritSize: boolean;
|
|
1609
1762
|
}
|
|
1610
|
-
interface
|
|
1611
|
-
|
|
1612
|
-
|
|
1763
|
+
interface CanvasItemEventMap extends TimelineNodeEventMap {
|
|
1764
|
+
updateStyleProperty: (key: PropertyKey, newValue: any, oldValue: any, declaration?: PropertyDeclaration) => void;
|
|
1765
|
+
draw: () => void;
|
|
1613
1766
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
declare function getComputedTransformOrigin(this: Style2D): number[];
|
|
1619
|
-
|
|
1620
|
-
interface CanvasItemOptions extends NodeOptions {
|
|
1621
|
-
style?: Style2DOptions;
|
|
1622
|
-
tint?: string;
|
|
1623
|
-
blendMode?: WebGLBlendMode;
|
|
1767
|
+
interface CanvasItem {
|
|
1768
|
+
on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1769
|
+
off: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1770
|
+
emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1624
1771
|
}
|
|
1625
|
-
declare class CanvasItem extends
|
|
1626
|
-
|
|
1772
|
+
declare class CanvasItem extends TimelineNode {
|
|
1773
|
+
visible: boolean;
|
|
1774
|
+
modulate?: ColorValue;
|
|
1627
1775
|
blendMode?: WebGLBlendMode;
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1776
|
+
inheritSize?: boolean;
|
|
1777
|
+
protected _style: CanvasItemStyle;
|
|
1778
|
+
get style(): CanvasItemStyle;
|
|
1779
|
+
set style(style: CanvasItemStyle);
|
|
1631
1780
|
/** @internal */
|
|
1632
1781
|
opacity: number;
|
|
1782
|
+
size: {
|
|
1783
|
+
width: number;
|
|
1784
|
+
height: number;
|
|
1785
|
+
};
|
|
1633
1786
|
protected _parentOpacity?: number;
|
|
1634
|
-
protected
|
|
1635
|
-
protected
|
|
1636
|
-
|
|
1787
|
+
protected _modulate: Color;
|
|
1788
|
+
protected _backgroundImage?: Texture2D;
|
|
1789
|
+
_computedVisible: boolean;
|
|
1637
1790
|
context: CanvasContext;
|
|
1638
1791
|
protected _resetContext: boolean;
|
|
1639
1792
|
protected _redrawing: boolean;
|
|
@@ -1642,14 +1795,19 @@ declare class CanvasItem extends Node {
|
|
|
1642
1795
|
protected _originalBatchables: CanvasBatchable[];
|
|
1643
1796
|
protected _layoutedBatchables: CanvasBatchable[];
|
|
1644
1797
|
protected _batchables: CanvasBatchable[];
|
|
1645
|
-
constructor(
|
|
1798
|
+
constructor(properties?: Partial<CanvasItemProperties>, children?: Node[]);
|
|
1646
1799
|
setProperties(properties?: Record<PropertyKey, any>): this;
|
|
1647
|
-
protected
|
|
1648
|
-
protected
|
|
1800
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1801
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1802
|
+
protected _updateSize(): void;
|
|
1649
1803
|
protected _updateBackgroundColor(): void;
|
|
1650
1804
|
protected _updateBackgroundImage(): Promise<void>;
|
|
1651
1805
|
protected _updateOpacity(): void;
|
|
1652
|
-
|
|
1806
|
+
protected _updateVisible(): void;
|
|
1807
|
+
show(): void;
|
|
1808
|
+
hide(): void;
|
|
1809
|
+
isVisibleInTree(): boolean;
|
|
1810
|
+
canRender(): boolean;
|
|
1653
1811
|
requestRedraw(): void;
|
|
1654
1812
|
requestReflow(): void;
|
|
1655
1813
|
requestRepaint(): void;
|
|
@@ -1657,7 +1815,11 @@ declare class CanvasItem extends Node {
|
|
|
1657
1815
|
protected _draw(): void;
|
|
1658
1816
|
protected _drawBackground(): void;
|
|
1659
1817
|
protected _drawContent(): void;
|
|
1818
|
+
protected _drawBorder(): void;
|
|
1819
|
+
protected _drawOutline(): void;
|
|
1820
|
+
protected _drawBoundingRect(): void;
|
|
1660
1821
|
protected _fill(): void;
|
|
1822
|
+
protected _stroke(): void;
|
|
1661
1823
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1662
1824
|
protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1663
1825
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
@@ -1665,28 +1827,28 @@ declare class CanvasItem extends Node {
|
|
|
1665
1827
|
toJSON(): Record<string, any>;
|
|
1666
1828
|
}
|
|
1667
1829
|
|
|
1668
|
-
interface
|
|
1830
|
+
interface Node2DProperties extends CanvasItemProperties {
|
|
1669
1831
|
}
|
|
1670
1832
|
declare class Node2D extends CanvasItem {
|
|
1671
|
-
|
|
1833
|
+
transform: Transform2D;
|
|
1672
1834
|
protected _parentTransformDirtyId?: number;
|
|
1673
|
-
constructor(
|
|
1674
|
-
|
|
1675
|
-
protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1835
|
+
constructor(properties?: Partial<Node2DProperties>, children?: Node[]);
|
|
1836
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1676
1837
|
protected _updateTransform(): void;
|
|
1677
1838
|
protected _updateOverflow(): void;
|
|
1678
1839
|
protected _transformVertices(vertices: number[]): number[];
|
|
1679
1840
|
protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1680
1841
|
protected _process(delta: number): void;
|
|
1681
|
-
|
|
1842
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1843
|
+
clone(): this;
|
|
1682
1844
|
}
|
|
1683
1845
|
|
|
1684
1846
|
declare class Graphics2D extends Node2D {
|
|
1685
1847
|
protected _resetContext: boolean;
|
|
1686
1848
|
lineCap?: LineCap;
|
|
1687
1849
|
lineJoin?: LineJoin;
|
|
1688
|
-
fillStyle?: ColorValue |
|
|
1689
|
-
strokeStyle?: ColorValue |
|
|
1850
|
+
fillStyle?: ColorValue | Texture2D;
|
|
1851
|
+
strokeStyle?: ColorValue | Texture2D;
|
|
1690
1852
|
lineWidth?: number;
|
|
1691
1853
|
miterLimit?: number;
|
|
1692
1854
|
rect: (x: number, y: number, width: number, height: number) => this;
|
|
@@ -1706,66 +1868,69 @@ declare class Graphics2D extends Node2D {
|
|
|
1706
1868
|
}
|
|
1707
1869
|
|
|
1708
1870
|
interface ImageFrame {
|
|
1709
|
-
texture:
|
|
1871
|
+
texture: Texture2D;
|
|
1710
1872
|
duration: number;
|
|
1711
1873
|
}
|
|
1712
1874
|
declare class Image2DResource extends Resource {
|
|
1713
1875
|
frames: ImageFrame[];
|
|
1714
1876
|
duration: number;
|
|
1715
|
-
constructor(source:
|
|
1877
|
+
constructor(source: Texture2D | ImageFrame[]);
|
|
1716
1878
|
updateDuration(): this;
|
|
1717
1879
|
destroy(): void;
|
|
1718
1880
|
}
|
|
1719
1881
|
|
|
1720
|
-
interface
|
|
1721
|
-
src
|
|
1722
|
-
gif
|
|
1882
|
+
interface Image2DProperties extends Node2DProperties {
|
|
1883
|
+
src: string;
|
|
1884
|
+
gif: boolean;
|
|
1723
1885
|
}
|
|
1724
1886
|
declare class Image2D extends Node2D {
|
|
1725
1887
|
resource?: Image2DResource;
|
|
1726
1888
|
gif: boolean;
|
|
1727
1889
|
src: string;
|
|
1728
|
-
get currentTexture():
|
|
1729
|
-
get
|
|
1890
|
+
get currentTexture(): Texture2D | undefined;
|
|
1891
|
+
get framesDuration(): number;
|
|
1730
1892
|
get naturalWidth(): number;
|
|
1731
1893
|
get naturalHeight(): number;
|
|
1732
1894
|
get complete(): boolean;
|
|
1733
1895
|
protected _frameIndex: number;
|
|
1734
1896
|
protected _complete: boolean;
|
|
1735
1897
|
protected _wait: Promise<void>;
|
|
1736
|
-
constructor(
|
|
1737
|
-
protected
|
|
1898
|
+
constructor(properties?: Partial<Image2DProperties>, children?: Node[]);
|
|
1899
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1738
1900
|
decode(): Promise<void>;
|
|
1739
|
-
setResource(source:
|
|
1901
|
+
setResource(source: Texture2D | ImageFrame[] | Image2DResource): this;
|
|
1740
1902
|
protected _load(src: string): Promise<void>;
|
|
1741
|
-
protected
|
|
1903
|
+
protected _getFrameCurrentTime(): number;
|
|
1742
1904
|
protected _updateFrameIndex(): this;
|
|
1743
1905
|
protected _process(delta: number): void;
|
|
1744
1906
|
protected _drawContent(): void;
|
|
1745
1907
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1746
1908
|
}
|
|
1747
1909
|
|
|
1748
|
-
interface
|
|
1749
|
-
pixelRatio?: number;
|
|
1750
|
-
src?: string;
|
|
1910
|
+
interface TextureRect2DProperties extends Node2DProperties {
|
|
1751
1911
|
}
|
|
1752
|
-
declare class
|
|
1753
|
-
|
|
1912
|
+
declare class TextureRect2D<T extends Texture2D = Texture2D> extends Node2D {
|
|
1913
|
+
texture?: T;
|
|
1914
|
+
getRect(): Rect2;
|
|
1915
|
+
protected _drawContent(): void;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
interface Lottie2DProperties extends Node2DProperties {
|
|
1754
1919
|
src: string;
|
|
1755
|
-
|
|
1756
|
-
|
|
1920
|
+
}
|
|
1921
|
+
declare class Lottie2D extends TextureRect2D {
|
|
1922
|
+
src: string;
|
|
1923
|
+
readonly texture: CanvasTexture;
|
|
1757
1924
|
animation?: AnimationItem;
|
|
1758
|
-
constructor(
|
|
1759
|
-
protected
|
|
1760
|
-
protected
|
|
1925
|
+
constructor(properties?: Partial<Lottie2DProperties>, children?: Node[]);
|
|
1926
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1927
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1761
1928
|
protected _load(): Promise<void>;
|
|
1762
1929
|
protected _process(delta: number): void;
|
|
1763
|
-
protected _drawContent(): void;
|
|
1764
1930
|
}
|
|
1765
1931
|
|
|
1766
|
-
interface
|
|
1767
|
-
|
|
1768
|
-
split?: boolean;
|
|
1932
|
+
interface Text2DProperties extends Node2DProperties, Omit<TextOptions, 'style'> {
|
|
1933
|
+
split: boolean;
|
|
1769
1934
|
}
|
|
1770
1935
|
/**
|
|
1771
1936
|
* @example
|
|
@@ -1777,20 +1942,19 @@ interface Text2DOptions extends Node2DOptions, Omit<TextOptions, 'style'> {
|
|
|
1777
1942
|
* content: 'Text2D',
|
|
1778
1943
|
* })
|
|
1779
1944
|
*/
|
|
1780
|
-
declare class Text2D extends
|
|
1781
|
-
pixelRatio: number;
|
|
1945
|
+
declare class Text2D extends TextureRect2D<CanvasTexture> {
|
|
1782
1946
|
split: boolean;
|
|
1783
1947
|
content: TextOptions['content'];
|
|
1784
1948
|
effects?: TextOptions['effects'];
|
|
1785
1949
|
measureDom?: TextOptions['measureDom'];
|
|
1786
1950
|
fonts?: TextOptions['fonts'];
|
|
1951
|
+
texture: CanvasTexture;
|
|
1787
1952
|
text: Text;
|
|
1788
|
-
readonly texture: Texture<HTMLCanvasElement>;
|
|
1789
1953
|
protected _subTextsCount: number;
|
|
1790
|
-
constructor(
|
|
1791
|
-
protected
|
|
1954
|
+
constructor(properties?: Partial<Text2DProperties>, children?: Node[]);
|
|
1955
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1792
1956
|
protected _updateText(): void;
|
|
1793
|
-
protected
|
|
1957
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1794
1958
|
protected _getSubTexts(): Text2D[];
|
|
1795
1959
|
protected _updateSubTexts(): void;
|
|
1796
1960
|
measure(): MeasureResult;
|
|
@@ -1798,92 +1962,81 @@ declare class Text2D extends Node2D {
|
|
|
1798
1962
|
protected _drawContent(): void;
|
|
1799
1963
|
}
|
|
1800
1964
|
|
|
1801
|
-
interface
|
|
1802
|
-
src
|
|
1965
|
+
interface Video2DProperties extends Node2DProperties {
|
|
1966
|
+
src: string;
|
|
1803
1967
|
}
|
|
1804
|
-
declare class Video2D extends
|
|
1968
|
+
declare class Video2D extends TextureRect2D<VideoTexture> {
|
|
1805
1969
|
src: string;
|
|
1806
|
-
|
|
1807
|
-
get duration(): number;
|
|
1970
|
+
get videoDuration(): number;
|
|
1808
1971
|
protected _wait: Promise<void>;
|
|
1809
|
-
constructor(
|
|
1810
|
-
protected
|
|
1972
|
+
constructor(properties?: Partial<Video2DProperties>, children?: Node[]);
|
|
1973
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1811
1974
|
waitLoad(): Promise<void>;
|
|
1812
1975
|
protected _load(src: string): Promise<void>;
|
|
1813
|
-
protected _drawContent(): void;
|
|
1814
1976
|
protected _updateVideoCurrentTime(): void;
|
|
1815
1977
|
protected _process(delta: number): void;
|
|
1816
1978
|
}
|
|
1817
1979
|
|
|
1818
|
-
declare
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
declare
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
declare class LottieLoader extends Loader {
|
|
1838
|
-
load: (url: string, canvas: HTMLCanvasElement) => Promise<AnimationItem>;
|
|
1839
|
-
install(assets: Assets): this;
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
declare class TextLoader extends Loader {
|
|
1843
|
-
load: (url: string) => Promise<string>;
|
|
1844
|
-
install(assets: Assets): this;
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
declare class TextureLoader extends Loader {
|
|
1848
|
-
load: (url: string) => Promise<Texture<ImageBitmap>>;
|
|
1849
|
-
install(assets: Assets): this;
|
|
1980
|
+
declare const linear: (amount: number) => number;
|
|
1981
|
+
declare const ease: (amount: number) => number;
|
|
1982
|
+
declare const easeIn: (amount: number) => number;
|
|
1983
|
+
declare const easeOut: (amount: number) => number;
|
|
1984
|
+
declare const easeInOut: (amount: number) => number;
|
|
1985
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number;
|
|
1986
|
+
declare const timingFunctions: {
|
|
1987
|
+
linear: (amount: number) => number;
|
|
1988
|
+
ease: (amount: number) => number;
|
|
1989
|
+
easeIn: (amount: number) => number;
|
|
1990
|
+
easeOut: (amount: number) => number;
|
|
1991
|
+
easeInOut: (amount: number) => number;
|
|
1992
|
+
};
|
|
1993
|
+
type TimingFunctions = typeof timingFunctions;
|
|
1994
|
+
type Easing = keyof TimingFunctions | `cubic-bezier(${string})`;
|
|
1995
|
+
interface Keyframe {
|
|
1996
|
+
easing?: Easing;
|
|
1997
|
+
offset?: number;
|
|
1998
|
+
[property: string]: string | number | null | undefined;
|
|
1850
1999
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
2000
|
+
interface NormalizedKeyframe {
|
|
2001
|
+
easing: (amount: number) => number;
|
|
2002
|
+
offset: number;
|
|
2003
|
+
props: Record<string, any>;
|
|
1855
2004
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
text: TextLoader;
|
|
1864
|
-
texture: TextureLoader;
|
|
1865
|
-
video: VideoLoader;
|
|
2005
|
+
type AnimationMode = 'parent' | 'sibling';
|
|
2006
|
+
interface AnimationProperties extends TimelineNodeProperties {
|
|
2007
|
+
animationMode: AnimationMode;
|
|
2008
|
+
startTime: number;
|
|
2009
|
+
duration: number;
|
|
2010
|
+
loop: boolean;
|
|
2011
|
+
keyframes: Keyframe[];
|
|
1866
2012
|
}
|
|
1867
|
-
declare class
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
protected
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
protected
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2013
|
+
declare class Animation extends TimelineNode {
|
|
2014
|
+
animationMode: AnimationMode;
|
|
2015
|
+
loop: boolean;
|
|
2016
|
+
keyframes: Keyframe[];
|
|
2017
|
+
easing?: Easing;
|
|
2018
|
+
protected _keyframes: NormalizedKeyframe[];
|
|
2019
|
+
protected _isFirstUpdatePosition: boolean;
|
|
2020
|
+
protected _cachedProps: RawWeakMap<any, Map<string, any>>;
|
|
2021
|
+
protected _stoped: boolean;
|
|
2022
|
+
constructor(properties?: Partial<AnimationProperties>, children?: Node[]);
|
|
2023
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
2024
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
2025
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2026
|
+
protected _getTargets(): any[];
|
|
2027
|
+
protected _updateKeyframes(): void;
|
|
2028
|
+
commitStyles(): void;
|
|
2029
|
+
protected _updateCachedProps(): void;
|
|
2030
|
+
protected _parseEasing(easing: Easing | undefined): (amount: number) => number;
|
|
2031
|
+
protected _parseKeyframes(currentTime: number, startProps: Map<string, any>): [NormalizedKeyframe, NormalizedKeyframe] | null;
|
|
2032
|
+
protected _commitStyle(currentTime: number, target: any, startProps: Map<string, any>, previous: NormalizedKeyframe, current: NormalizedKeyframe): void;
|
|
2033
|
+
protected _getDiffValue(name: string, previous: string | undefined, current: string | undefined, weight: number, context: Record<string, any>): any;
|
|
2034
|
+
isPlaying(): boolean;
|
|
2035
|
+
play(): boolean;
|
|
2036
|
+
pause(): boolean;
|
|
2037
|
+
stop(): boolean;
|
|
2038
|
+
cancel(): void;
|
|
1885
2039
|
}
|
|
1886
|
-
declare const assets: Assets;
|
|
1887
2040
|
|
|
1888
2041
|
declare abstract class AudioProcessor {
|
|
1889
2042
|
destination: IAudioNode;
|
|
@@ -2122,7 +2275,7 @@ declare class WebAudio extends AudioPipeline {
|
|
|
2122
2275
|
|
|
2123
2276
|
type PlatformAudio = WebAudio | HTMLAudio;
|
|
2124
2277
|
type PlatformSound = WebSound | HTMLSound;
|
|
2125
|
-
declare class Audio extends
|
|
2278
|
+
declare class Audio extends TimelineNode {
|
|
2126
2279
|
protected static _soundPool: PlatformSound[];
|
|
2127
2280
|
protected _sounds: PlatformSound[];
|
|
2128
2281
|
/** PlatformAudio */
|
|
@@ -2135,7 +2288,7 @@ declare class Audio extends Node {
|
|
|
2135
2288
|
isLoaded: boolean;
|
|
2136
2289
|
get isPlayable(): boolean;
|
|
2137
2290
|
/** Duration */
|
|
2138
|
-
get
|
|
2291
|
+
get audioDuration(): number;
|
|
2139
2292
|
/** Volume */
|
|
2140
2293
|
protected _volume: number;
|
|
2141
2294
|
get volume(): number;
|
|
@@ -2155,14 +2308,11 @@ declare class Audio extends Node {
|
|
|
2155
2308
|
/** IsPlaying */
|
|
2156
2309
|
protected _isPlaying: boolean;
|
|
2157
2310
|
get isPlaying(): boolean;
|
|
2158
|
-
/** Paused */
|
|
2159
|
-
protected _paused: boolean;
|
|
2160
|
-
get paused(): boolean;
|
|
2161
|
-
set paused(val: boolean);
|
|
2162
2311
|
multiple: boolean;
|
|
2163
2312
|
start: number;
|
|
2164
2313
|
end: number;
|
|
2165
2314
|
constructor(src?: string);
|
|
2315
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2166
2316
|
load(): Promise<this>;
|
|
2167
2317
|
pause(): this;
|
|
2168
2318
|
resume(): this;
|
|
@@ -2183,20 +2333,20 @@ declare class Audio extends Node {
|
|
|
2183
2333
|
declare class AudioSpectrum extends Node2D {
|
|
2184
2334
|
}
|
|
2185
2335
|
|
|
2186
|
-
interface
|
|
2187
|
-
src
|
|
2188
|
-
gap
|
|
2189
|
-
color
|
|
2336
|
+
interface AudioWaveformProperties extends Node2DProperties {
|
|
2337
|
+
src: string;
|
|
2338
|
+
gap: number;
|
|
2339
|
+
color: string;
|
|
2190
2340
|
}
|
|
2191
2341
|
declare class AudioWaveform extends Node2D {
|
|
2192
2342
|
src?: string;
|
|
2193
2343
|
gap: number;
|
|
2194
2344
|
color: string;
|
|
2195
2345
|
protected _audioBuffer?: AudioBuffer;
|
|
2196
|
-
protected _src:
|
|
2346
|
+
protected _src: Texture2D<HTMLCanvasElement> | undefined;
|
|
2197
2347
|
protected _needsUpdateTexture: boolean;
|
|
2198
|
-
constructor(options?:
|
|
2199
|
-
protected
|
|
2348
|
+
constructor(options?: Partial<AudioWaveformProperties>);
|
|
2349
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2200
2350
|
_loadSrc(src: string): Promise<void>;
|
|
2201
2351
|
syncTexture(force?: boolean): void;
|
|
2202
2352
|
protected _process(delta: number): void;
|
|
@@ -2204,9 +2354,8 @@ declare class AudioWaveform extends Node2D {
|
|
|
2204
2354
|
}
|
|
2205
2355
|
|
|
2206
2356
|
type EffectMode = 'before' | 'parent' | 'children' | 'transition';
|
|
2207
|
-
interface EffectOptions extends
|
|
2357
|
+
interface EffectOptions extends TimelineNodeProperties {
|
|
2208
2358
|
mode?: EffectMode;
|
|
2209
|
-
duration?: number;
|
|
2210
2359
|
glsl?: string;
|
|
2211
2360
|
glslSrc?: string;
|
|
2212
2361
|
material?: Material;
|
|
@@ -2220,16 +2369,14 @@ interface EffectContext {
|
|
|
2220
2369
|
from?: Viewport;
|
|
2221
2370
|
to?: Viewport;
|
|
2222
2371
|
}
|
|
2223
|
-
declare class Effect extends
|
|
2372
|
+
declare class Effect extends TimelineNode {
|
|
2224
2373
|
material?: Material;
|
|
2225
2374
|
mode?: EffectMode;
|
|
2226
2375
|
glsl: string;
|
|
2227
2376
|
glslSrc: string;
|
|
2228
|
-
delay: number;
|
|
2229
|
-
duration: number;
|
|
2230
2377
|
protected get _mode(): EffectMode;
|
|
2231
2378
|
/** Viewports */
|
|
2232
|
-
readonly
|
|
2379
|
+
readonly viewport1: Viewport;
|
|
2233
2380
|
readonly viewport2: Viewport;
|
|
2234
2381
|
/** Render call */
|
|
2235
2382
|
protected _renderId: number;
|
|
@@ -2238,11 +2385,11 @@ declare class Effect extends Node {
|
|
|
2238
2385
|
protected _previousSibling?: Node;
|
|
2239
2386
|
protected _nextSibling?: Node;
|
|
2240
2387
|
constructor(options?: EffectOptions);
|
|
2241
|
-
protected
|
|
2242
|
-
protected
|
|
2243
|
-
protected
|
|
2244
|
-
protected _onProcessing
|
|
2245
|
-
protected _onNodeProcessed
|
|
2388
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2389
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
2390
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
2391
|
+
protected _onProcessing(): void;
|
|
2392
|
+
protected _onNodeProcessed(node: Node): void;
|
|
2246
2393
|
protected _processParent(): void;
|
|
2247
2394
|
protected _processChildren(): void;
|
|
2248
2395
|
_onProcess(delta?: number): void;
|
|
@@ -2275,13 +2422,13 @@ declare class ColorAdjustEffect extends Effect {
|
|
|
2275
2422
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2276
2423
|
}
|
|
2277
2424
|
|
|
2278
|
-
interface
|
|
2425
|
+
interface ColorFilterEffectProperties {
|
|
2279
2426
|
filter?: string;
|
|
2280
2427
|
}
|
|
2281
2428
|
declare class ColorFilterEffect extends Effect {
|
|
2282
2429
|
filter: string;
|
|
2283
2430
|
protected _colorMatrix: ColorMatrix;
|
|
2284
|
-
constructor(
|
|
2431
|
+
constructor(properties?: Partial<ColorFilterEffectProperties>);
|
|
2285
2432
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2286
2433
|
static material: Material;
|
|
2287
2434
|
}
|
|
@@ -2310,26 +2457,6 @@ declare class ColorReplaceEffect extends Effect {
|
|
|
2310
2457
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2311
2458
|
}
|
|
2312
2459
|
|
|
2313
|
-
declare class EffectMaterial extends Material {
|
|
2314
|
-
vert: string;
|
|
2315
|
-
readonly uniforms: Map<string, any>;
|
|
2316
|
-
static RE: {
|
|
2317
|
-
getColor: RegExp;
|
|
2318
|
-
getFromColor: RegExp;
|
|
2319
|
-
getToColor: RegExp;
|
|
2320
|
-
transform: RegExp;
|
|
2321
|
-
transition: RegExp;
|
|
2322
|
-
};
|
|
2323
|
-
has: {
|
|
2324
|
-
getColor: boolean;
|
|
2325
|
-
getFromColor: boolean;
|
|
2326
|
-
getToColor: boolean;
|
|
2327
|
-
transform: boolean;
|
|
2328
|
-
transition: boolean;
|
|
2329
|
-
};
|
|
2330
|
-
constructor(glsl: string);
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
2460
|
declare class EmbossEffect extends Effect {
|
|
2334
2461
|
strength: number;
|
|
2335
2462
|
constructor(strength?: number);
|
|
@@ -2340,7 +2467,7 @@ declare class EmbossEffect extends Effect {
|
|
|
2340
2467
|
declare class GlitchEffect extends Effect {
|
|
2341
2468
|
static material: Material;
|
|
2342
2469
|
protected _canvas: HTMLCanvasElement;
|
|
2343
|
-
protected _texture:
|
|
2470
|
+
protected _texture: Texture2D;
|
|
2344
2471
|
protected _sizes: Float32Array;
|
|
2345
2472
|
protected _offsets: Float32Array;
|
|
2346
2473
|
protected _redraw: boolean;
|
|
@@ -2385,11 +2512,11 @@ interface MaskEffectOptions extends EffectOptions {
|
|
|
2385
2512
|
src?: string;
|
|
2386
2513
|
}
|
|
2387
2514
|
declare class MaskEffect extends Effect {
|
|
2388
|
-
texture?:
|
|
2515
|
+
texture?: Texture2D<ImageBitmap>;
|
|
2389
2516
|
src: string;
|
|
2390
2517
|
constructor(options?: MaskEffectOptions);
|
|
2391
2518
|
load(): Promise<void>;
|
|
2392
|
-
protected
|
|
2519
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2393
2520
|
apply(renderer: WebGLRenderer, source: Viewport, context: EffectContext): void;
|
|
2394
2521
|
static material: Material;
|
|
2395
2522
|
}
|
|
@@ -2401,6 +2528,13 @@ declare class PixelateEffect extends Effect {
|
|
|
2401
2528
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2402
2529
|
}
|
|
2403
2530
|
|
|
2531
|
+
declare class ShadowEffect extends Effect {
|
|
2532
|
+
static material: Material;
|
|
2533
|
+
blur: BlurEffect;
|
|
2534
|
+
viewport3: Viewport;
|
|
2535
|
+
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2404
2538
|
declare class TiltShiftEffect extends Effect {
|
|
2405
2539
|
static material: Material;
|
|
2406
2540
|
blur: number;
|
|
@@ -2426,274 +2560,154 @@ declare class ZoomBlurEffect extends Effect {
|
|
|
2426
2560
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2427
2561
|
}
|
|
2428
2562
|
|
|
2429
|
-
|
|
2563
|
+
interface ControlProperties extends CanvasItemProperties {
|
|
2564
|
+
}
|
|
2565
|
+
declare class Control extends CanvasItem {
|
|
2566
|
+
constructor(properties?: Partial<ControlProperties>, children?: Node[]);
|
|
2567
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2568
|
+
protected _guiInput(event: InputEvent, key: InputEventKey): void;
|
|
2569
|
+
getRect(): Rect2;
|
|
2570
|
+
}
|
|
2430
2571
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
/** The original event that caused this event, if any. */
|
|
2459
|
-
originalEvent: UIInputEvent<N> | null;
|
|
2460
|
-
/** Flags whether propagation was stopped. */
|
|
2461
|
-
propagationStopped: boolean;
|
|
2462
|
-
/** Flags whether propagation was immediately stopped. */
|
|
2463
|
-
propagationImmediatelyStopped: boolean;
|
|
2464
|
-
/** The composed path of the event's propagation. The {@code target} is at the end. */
|
|
2465
|
-
path: any[];
|
|
2466
|
-
/** Event-specific detail */
|
|
2467
|
-
detail: number;
|
|
2468
|
-
/** The global Window object. */
|
|
2469
|
-
view: WindowProxy;
|
|
2470
|
-
/** The coordinates of the evnet relative to the nearest DOM layer. This is a non-standard property. */
|
|
2471
|
-
layer: {
|
|
2472
|
-
x: number;
|
|
2473
|
-
y: number;
|
|
2474
|
-
};
|
|
2475
|
-
get layerX(): number;
|
|
2476
|
-
get layerY(): number;
|
|
2477
|
-
/** The coordinates of the event relative to the DOM document. This is a non-standard property. */
|
|
2478
|
-
page: {
|
|
2479
|
-
x: number;
|
|
2480
|
-
y: number;
|
|
2481
|
-
};
|
|
2482
|
-
get pageX(): number;
|
|
2483
|
-
get pageY(): number;
|
|
2484
|
-
initEvent(..._args: any[]): void;
|
|
2485
|
-
initUIEvent(..._args: any[]): void;
|
|
2486
|
-
/** The propagation path for this event. */
|
|
2487
|
-
composedPath(): any[];
|
|
2488
|
-
/** Prevent default behavior of PixiJS and the user agent. */
|
|
2489
|
-
preventDefault(): void;
|
|
2490
|
-
stopImmediatePropagation(): void;
|
|
2491
|
-
stopPropagation(): void;
|
|
2492
|
-
readonly NONE = 0;
|
|
2493
|
-
readonly CAPTURING_PHASE = 1;
|
|
2494
|
-
readonly AT_TARGET = 2;
|
|
2495
|
-
readonly BUBBLING_PHASE = 3;
|
|
2572
|
+
interface RulerProperties extends ControlProperties {
|
|
2573
|
+
pixelRatio: number;
|
|
2574
|
+
offsetX: number;
|
|
2575
|
+
offsetY: number;
|
|
2576
|
+
thickness: number;
|
|
2577
|
+
markHeight: number;
|
|
2578
|
+
color: string;
|
|
2579
|
+
markBackgroundColor: string;
|
|
2580
|
+
markColor: string;
|
|
2581
|
+
gap: number;
|
|
2582
|
+
}
|
|
2583
|
+
declare class Ruler extends Control {
|
|
2584
|
+
pixelRatio: number;
|
|
2585
|
+
offsetX: number;
|
|
2586
|
+
offsetY: number;
|
|
2587
|
+
thickness: number;
|
|
2588
|
+
markHeight: number;
|
|
2589
|
+
color: string;
|
|
2590
|
+
markBackgroundColor: string;
|
|
2591
|
+
markColor: string;
|
|
2592
|
+
gap: number;
|
|
2593
|
+
texture: CanvasTexture;
|
|
2594
|
+
constructor(properties?: Partial<RulerProperties>, children?: Node[]);
|
|
2595
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2596
|
+
protected _updateSize(): void;
|
|
2597
|
+
protected _drawTexture(): void;
|
|
2598
|
+
protected _drawContent(): void;
|
|
2496
2599
|
}
|
|
2497
2600
|
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
/** The specific button that was pressed in this mouse event. */
|
|
2502
|
-
button: number;
|
|
2503
|
-
/** The button depressed when this event occurred. */
|
|
2504
|
-
buttons: number;
|
|
2505
|
-
/** Whether the "control" key was pressed when this mouse event occurred. */
|
|
2506
|
-
ctrlKey: boolean;
|
|
2507
|
-
/** Whether the "meta" key was pressed when this mouse event occurred. */
|
|
2508
|
-
metaKey: boolean;
|
|
2509
|
-
/** This is currently not implemented in the Federated Events API. */
|
|
2510
|
-
relatedTarget: EventTarget | null;
|
|
2511
|
-
/** Whether the "shift" key was pressed when this mouse event occurred. */
|
|
2512
|
-
shiftKey: boolean;
|
|
2513
|
-
/** The coordinates of the mouse event relative to the canvas. */
|
|
2514
|
-
client: {
|
|
2515
|
-
x: number;
|
|
2516
|
-
y: number;
|
|
2517
|
-
};
|
|
2518
|
-
get clientX(): number;
|
|
2519
|
-
get clientY(): number;
|
|
2520
|
-
get x(): number;
|
|
2521
|
-
get y(): number;
|
|
2522
|
-
/** This is the number of clicks that occurs in 200ms/click of each other. */
|
|
2523
|
-
detail: number;
|
|
2524
|
-
/** The movement in this pointer relative to the last `mousemove` event. */
|
|
2525
|
-
movement: {
|
|
2526
|
-
x: number;
|
|
2527
|
-
y: number;
|
|
2528
|
-
};
|
|
2529
|
-
get movementX(): number;
|
|
2530
|
-
get movementY(): number;
|
|
2531
|
-
/**
|
|
2532
|
-
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
2533
|
-
* not supported at the moment.
|
|
2534
|
-
*/
|
|
2535
|
-
offset: {
|
|
2536
|
-
x: number;
|
|
2537
|
-
y: number;
|
|
2538
|
-
};
|
|
2539
|
-
get offsetX(): number;
|
|
2540
|
-
get offsetY(): number;
|
|
2541
|
-
/** The pointer coordinates in world space. */
|
|
2542
|
-
global: {
|
|
2543
|
-
x: number;
|
|
2544
|
-
y: number;
|
|
2545
|
-
};
|
|
2546
|
-
get globalX(): number;
|
|
2547
|
-
get globalY(): number;
|
|
2548
|
-
/**
|
|
2549
|
-
* The pointer coordinates in the renderer's.
|
|
2550
|
-
* This has slightly different semantics than native PointerEvent screenX/screenY.
|
|
2551
|
-
*/
|
|
2552
|
-
screen: {
|
|
2553
|
-
x: number;
|
|
2554
|
-
y: number;
|
|
2555
|
-
};
|
|
2556
|
-
get screenX(): number;
|
|
2557
|
-
get screenY(): number;
|
|
2558
|
-
/**
|
|
2559
|
-
* Whether the modifier key was pressed when this event natively occurred.
|
|
2560
|
-
* @param key - The modifier key.
|
|
2561
|
-
*/
|
|
2562
|
-
getModifierState(key: string): boolean;
|
|
2563
|
-
initMouseEvent(..._args: any[]): void;
|
|
2601
|
+
interface ScrollBarProperties extends ControlProperties {
|
|
2602
|
+
}
|
|
2603
|
+
declare class ScrollBar extends Control {
|
|
2564
2604
|
}
|
|
2565
2605
|
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
/**
|
|
2587
|
-
* Indicates whether or not the pointer device that created the event is the primary pointer.
|
|
2588
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
|
|
2589
|
-
*/
|
|
2590
|
-
isPrimary: boolean;
|
|
2591
|
-
/**
|
|
2592
|
-
* The type of pointer that triggered the event.
|
|
2593
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
2594
|
-
*/
|
|
2595
|
-
pointerType: string;
|
|
2596
|
-
/**
|
|
2597
|
-
* Pressure applied by the pointing device during the event.
|
|
2598
|
-
*s
|
|
2599
|
-
* A Touch's force property will be represented by this value.
|
|
2600
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
|
|
2601
|
-
*/
|
|
2602
|
-
pressure: number;
|
|
2603
|
-
/**
|
|
2604
|
-
* Barrel pressure on a stylus pointer.
|
|
2605
|
-
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
2606
|
-
*/
|
|
2607
|
-
tangentialPressure: number;
|
|
2608
|
-
/**
|
|
2609
|
-
* The angle, in degrees, between the pointer device and the screen.
|
|
2610
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
|
|
2611
|
-
*/
|
|
2612
|
-
tiltX: number;
|
|
2613
|
-
/**
|
|
2614
|
-
* The angle, in degrees, between the pointer device and the screen.
|
|
2615
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
|
|
2616
|
-
*/
|
|
2617
|
-
tiltY: number;
|
|
2618
|
-
/**
|
|
2619
|
-
* Twist of a stylus pointer.
|
|
2620
|
-
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
2621
|
-
*/
|
|
2622
|
-
twist: number;
|
|
2623
|
-
/**
|
|
2624
|
-
* This is the number of clicks that occurs in 200ms/click of each other.
|
|
2625
|
-
*/
|
|
2626
|
-
detail: number;
|
|
2627
|
-
/**
|
|
2628
|
-
* Only included for completeness for now
|
|
2629
|
-
*/
|
|
2630
|
-
getCoalescedEvents(): PointerEvent[];
|
|
2631
|
-
/**
|
|
2632
|
-
* Only included for completeness for now
|
|
2633
|
-
*/
|
|
2634
|
-
getPredictedEvents(): PointerEvent[];
|
|
2606
|
+
interface ScalerEventMap extends NodeEventMap {
|
|
2607
|
+
updateScale: (scale: number) => void;
|
|
2608
|
+
}
|
|
2609
|
+
interface ScalerProperties extends NodeProperties {
|
|
2610
|
+
}
|
|
2611
|
+
interface Scaler {
|
|
2612
|
+
on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2613
|
+
off: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2614
|
+
emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
2615
|
+
}
|
|
2616
|
+
declare class Scaler extends Node {
|
|
2617
|
+
scale: number;
|
|
2618
|
+
min: number;
|
|
2619
|
+
max: number;
|
|
2620
|
+
get target(): CanvasItem | undefined;
|
|
2621
|
+
constructor(properties?: Partial<ScalerProperties>, children?: Node[]);
|
|
2622
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2623
|
+
protected _updateScale(): void;
|
|
2624
|
+
protected _onWheel(e: WheelInputEvent): void;
|
|
2625
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2635
2626
|
}
|
|
2636
2627
|
|
|
2637
|
-
declare class
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
* `DOM_DELTA_PAGE`, `DOM_DELTA_PIXEL`.
|
|
2641
|
-
*/
|
|
2642
|
-
deltaMode: number;
|
|
2643
|
-
/** Horizontal scroll amount */
|
|
2644
|
-
deltaX: number;
|
|
2645
|
-
/** Vertical scroll amount */
|
|
2646
|
-
deltaY: number;
|
|
2647
|
-
/** z-axis scroll amount. */
|
|
2648
|
-
deltaZ: number;
|
|
2649
|
-
/** Units specified in pixels. */
|
|
2650
|
-
static readonly DOM_DELTA_PIXEL = 0;
|
|
2651
|
-
/** Units specified in pixels. */
|
|
2652
|
-
readonly DOM_DELTA_PIXEL = 0;
|
|
2653
|
-
/** Units specified in lines. */
|
|
2654
|
-
static readonly DOM_DELTA_LINE = 1;
|
|
2655
|
-
/** Units specified in lines. */
|
|
2656
|
-
readonly DOM_DELTA_LINE = 1;
|
|
2657
|
-
/** Units specified in pages. */
|
|
2658
|
-
static readonly DOM_DELTA_PAGE = 2;
|
|
2659
|
-
/** Units specified in pages. */
|
|
2660
|
-
readonly DOM_DELTA_PAGE = 2;
|
|
2628
|
+
declare class GifLoader extends Loader {
|
|
2629
|
+
load: (url: string) => Promise<Image2DResource>;
|
|
2630
|
+
install(assets: Assets): this;
|
|
2661
2631
|
}
|
|
2662
2632
|
|
|
2663
|
-
declare class
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2633
|
+
declare class JsonLoader extends Loader {
|
|
2634
|
+
load: (url: string) => Promise<Record<string, any>>;
|
|
2635
|
+
install(assets: Assets): this;
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
declare class LottieLoader extends Loader {
|
|
2639
|
+
load: (url: string, canvas: HTMLCanvasElement) => Promise<AnimationItem>;
|
|
2640
|
+
install(assets: Assets): this;
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
declare class TextLoader extends Loader {
|
|
2644
|
+
load: (url: string) => Promise<string>;
|
|
2645
|
+
install(assets: Assets): this;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
declare class TextureLoader extends Loader {
|
|
2649
|
+
load: (url: string) => Promise<Texture2D<ImageBitmap>>;
|
|
2650
|
+
install(assets: Assets): this;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
declare class VideoLoader extends Loader {
|
|
2654
|
+
load: (url: string) => Promise<VideoTexture>;
|
|
2655
|
+
install(assets: Assets): this;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
type AssetHandler = (url: string, options?: any) => any | Promise<any>;
|
|
2659
|
+
interface Assets {
|
|
2660
|
+
font: FontLoader;
|
|
2661
|
+
gif: GifLoader;
|
|
2662
|
+
json: JsonLoader;
|
|
2663
|
+
lottie: LottieLoader;
|
|
2664
|
+
text: TextLoader;
|
|
2665
|
+
texture: TextureLoader;
|
|
2666
|
+
video: VideoLoader;
|
|
2667
|
+
}
|
|
2668
|
+
declare class Assets {
|
|
2669
|
+
defaultHandler: AssetHandler;
|
|
2670
|
+
protected _handlers: Map<string, AssetHandler>;
|
|
2671
|
+
protected _handleing: Map<string, Promise<any>>;
|
|
2672
|
+
protected _handled: Map<string, any>;
|
|
2673
|
+
protected _gc: FinalizationRegistry<string> | undefined;
|
|
2674
|
+
constructor();
|
|
2675
|
+
use(loader: Loader): this;
|
|
2676
|
+
register(mimeType: string, handler: AssetHandler): this;
|
|
2677
|
+
fetch(url: string): Promise<Response>;
|
|
2678
|
+
protected _fixSVG(dataURI: string): string;
|
|
2679
|
+
fetchImageBitmap(url: string, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
|
2680
|
+
get<T>(id: string): T | undefined;
|
|
2681
|
+
set(id: string, value: any): void;
|
|
2682
|
+
loadBy<T>(id: string, handler: () => Promise<T>): Promise<T>;
|
|
2683
|
+
load<T>(url: string, options?: any): Promise<T>;
|
|
2684
|
+
waitUntilLoad(): Promise<void>;
|
|
2685
|
+
gc(): void;
|
|
2686
|
+
}
|
|
2687
|
+
declare const assets: Assets;
|
|
2688
|
+
|
|
2689
|
+
declare class CanvasEditor extends CanvasItem {
|
|
2690
|
+
name: string;
|
|
2691
|
+
hover: Node2D;
|
|
2692
|
+
selectionRect: Node2D;
|
|
2693
|
+
selector: Node2D;
|
|
2694
|
+
scaler: Scaler;
|
|
2695
|
+
xScrollBar: ScrollBar;
|
|
2696
|
+
yScrollBar: ScrollBar;
|
|
2697
|
+
drawboard: Node2D;
|
|
2698
|
+
ruler: Ruler;
|
|
2699
|
+
protected _pointerStart?: CanvasItemStyle;
|
|
2700
|
+
protected _pointerOffset?: {
|
|
2689
2701
|
x: number;
|
|
2690
2702
|
y: number;
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
protected
|
|
2695
|
-
protected
|
|
2696
|
-
protected
|
|
2703
|
+
};
|
|
2704
|
+
selected?: CanvasItem;
|
|
2705
|
+
constructor();
|
|
2706
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2707
|
+
protected _onPointerdown(e: PointerInputEvent): void;
|
|
2708
|
+
protected _onPointermove(e: PointerInputEvent): void;
|
|
2709
|
+
protected _onPointerup(): void;
|
|
2710
|
+
protected _onHover(): void;
|
|
2697
2711
|
}
|
|
2698
2712
|
|
|
2699
2713
|
interface EngineOptions extends WebGLContextAttributes {
|
|
@@ -2701,8 +2715,10 @@ interface EngineOptions extends WebGLContextAttributes {
|
|
|
2701
2715
|
width?: number;
|
|
2702
2716
|
height?: number;
|
|
2703
2717
|
pixelRatio?: number;
|
|
2704
|
-
|
|
2718
|
+
backgroundColor?: ColorValue;
|
|
2705
2719
|
autoResize?: boolean;
|
|
2720
|
+
autoStart?: boolean;
|
|
2721
|
+
timeline?: Timeline;
|
|
2706
2722
|
}
|
|
2707
2723
|
interface EngineEventMap {
|
|
2708
2724
|
pointerdown: (ev: PointerInputEvent) => void;
|
|
@@ -2739,9 +2755,6 @@ declare class Engine extends SceneTree {
|
|
|
2739
2755
|
get height(): number;
|
|
2740
2756
|
get pixelRatio(): number;
|
|
2741
2757
|
set pixelRatio(val: number);
|
|
2742
|
-
protected _background: Color;
|
|
2743
|
-
get background(): ColorValue;
|
|
2744
|
-
set background(val: ColorValue);
|
|
2745
2758
|
protected _resizeObserver: ResizeObserver | undefined;
|
|
2746
2759
|
constructor(options?: EngineOptions);
|
|
2747
2760
|
protected _setupInput(): this;
|
|
@@ -2764,4 +2777,4 @@ interface RenderOptions {
|
|
|
2764
2777
|
}
|
|
2765
2778
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
2766
2779
|
|
|
2767
|
-
export {
|
|
2780
|
+
export { Animation, type AnimationMode, type AnimationProperties, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformProperties, type Batchable2D, BlurEffect, type CanvasBatchable, CanvasContext, CanvasEditor, CanvasItem, type CanvasItemEventMap, type CanvasItemProperties, CanvasItemStyle, type CanvasItemStyleFilter, type CanvasItemStyleFilterKey, type CanvasItemStyleProperties, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectProperties, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, Control, type ControlProperties, CoreObject, type CoreObjectEventMap, type CssFunction, type CssFunctionArg, type Cursor, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DProperties, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InputEvent, type InputEventKey, type InputEventMap, type InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, Loader, Lottie2D, type Lottie2DProperties, LottieLoader, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DProperties, type NodeEventMap, type NodeProperties, type NormalizedKeyframe, PI, PI_2, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, type PointerEvents, PointerInputEvent, type ProcessMode, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, RawWeakMap, Rect2, RefCounted, type RefCountedEventMap, type RenderMode, type RenderOptions, type Renderable, Renderer, Resource, type ResourceEventMap, Ruler, type RulerProperties, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, Scaler, type ScalerEventMap, type ScalerProperties, SceneTree, type SceneTreeEventMap, ScrollBar, type ScrollBarProperties, ShadowEffect, type StrokedGraphics, Text2D, type Text2DProperties, TextLoader, Texture2D, type Texture2DFilterMode, type Texture2DPixelsSource, type Texture2DSource, type Texture2DWrapMode, TextureLoader, TextureRect2D, type TextureRect2DProperties, Ticker, TiltShiftEffect, Timeline, type TimelineEventMap, TimelineNode, type TimelineNodeEventMap, type TimelineNodeProperties, type TimelineProperties, type TimingFunctions, Transform2D, type Transform2DObject, TwistEffect, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DProperties, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };
|