modern-canvas 0.1.10 → 0.2.1
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 +10400 -9568
- package/dist/index.d.cts +1399 -1353
- package/dist/index.d.mts +1399 -1353
- package/dist/index.d.ts +1399 -1353
- package/dist/index.js +123 -104
- package/dist/index.mjs +10394 -9559
- package/package.json +1 -1
package/dist/index.d.ts
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,516 @@ 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 right(): number;
|
|
478
|
+
get bottom(): number;
|
|
479
|
+
get width(): number;
|
|
480
|
+
get height(): number;
|
|
481
|
+
readonly end: Vector2;
|
|
482
|
+
readonly position: Vector2;
|
|
483
|
+
readonly size: Vector2;
|
|
484
|
+
constructor(from: Rect2);
|
|
485
|
+
constructor(position: Vector2, size: Vector2);
|
|
486
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
487
|
+
update(): this;
|
|
488
|
+
toArray(): number[];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
interface Transform2DObject {
|
|
492
|
+
a: number;
|
|
493
|
+
c: number;
|
|
494
|
+
tx: number;
|
|
495
|
+
b: number;
|
|
496
|
+
d: number;
|
|
497
|
+
ty: number;
|
|
498
|
+
tz: number;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Transform
|
|
502
|
+
*
|
|
503
|
+
* | a | c | tx|
|
|
504
|
+
* | b | d | ty|
|
|
505
|
+
* | 0 | 0 | 1 |
|
|
506
|
+
*/
|
|
507
|
+
declare class Transform2D extends Matrix3 {
|
|
508
|
+
autoUpdate: boolean;
|
|
509
|
+
protected _cx: number;
|
|
510
|
+
protected _sx: number;
|
|
511
|
+
protected _cy: number;
|
|
512
|
+
protected _sy: number;
|
|
513
|
+
protected _translateX: number;
|
|
514
|
+
protected _translateY: number;
|
|
515
|
+
protected _translateZ: number;
|
|
516
|
+
protected _scaleX: number;
|
|
517
|
+
protected _scaleY: number;
|
|
518
|
+
protected _skewX: number;
|
|
519
|
+
protected _skewY: number;
|
|
520
|
+
protected _rotate: number;
|
|
521
|
+
dirtyId: number;
|
|
522
|
+
protected _needsUpdateArray: boolean;
|
|
523
|
+
protected _needsUpdateFields: boolean;
|
|
524
|
+
constructor(autoUpdate?: boolean);
|
|
525
|
+
protected _onUpdate(array: number[]): void;
|
|
526
|
+
protected _updateSkew(): void;
|
|
527
|
+
protected _requestUpdateArray(): void;
|
|
528
|
+
protected _requestUpdateFields(): void;
|
|
529
|
+
protected _performUpdateArray(): void;
|
|
530
|
+
protected _performUpdateFields(): void;
|
|
531
|
+
skew(x: number, y: number): this;
|
|
532
|
+
skewX(x: number): this;
|
|
533
|
+
skewY(y: number): this;
|
|
534
|
+
translate(x: number, y: number, z?: number): this;
|
|
535
|
+
translateX(x: number): this;
|
|
536
|
+
translateY(y: number): this;
|
|
537
|
+
translateZ(z: number): this;
|
|
538
|
+
translate3d(x: number, y: number, z: number): this;
|
|
539
|
+
scale(x: number, y: number, _z?: number): this;
|
|
540
|
+
scaleX(x: number): this;
|
|
541
|
+
scaleY(y: number): this;
|
|
542
|
+
scale3d(x: number, y: number, z: number): this;
|
|
543
|
+
rotate(rad: number): this;
|
|
544
|
+
rotateX(x: number): this;
|
|
545
|
+
rotateY(y: number): this;
|
|
546
|
+
rotateZ(z: number): this;
|
|
547
|
+
rotate3d(x: number, y: number, z: number, rad: number): this;
|
|
548
|
+
protected _rotateToScale(rad: number): number;
|
|
549
|
+
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
550
|
+
applyToPoint(x: number, y: number): number[];
|
|
551
|
+
inverse(): this;
|
|
552
|
+
update(): boolean;
|
|
553
|
+
isIdentity(): boolean;
|
|
554
|
+
toObject(): Transform2DObject;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
declare const DEG_TO_RAD: number;
|
|
558
|
+
declare const RAD_TO_DEG: number;
|
|
559
|
+
declare function clamp(min: number, val: number, max: number): number;
|
|
560
|
+
declare function lerp(a: number, b: number, weight: number): number;
|
|
561
|
+
declare const curves: {
|
|
562
|
+
adaptive: boolean;
|
|
563
|
+
maxLength: number;
|
|
564
|
+
minSegments: number;
|
|
565
|
+
maxSegments: number;
|
|
566
|
+
epsilon: number;
|
|
567
|
+
_segmentsCount(length: number, defaultSegments?: number): number;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Vector3
|
|
572
|
+
*/
|
|
573
|
+
declare class Vector3 extends Vector {
|
|
574
|
+
constructor();
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
interface MainLoopEventMap extends CoreObjectEventMap {
|
|
578
|
+
process: (delta: number) => void;
|
|
579
|
+
}
|
|
580
|
+
interface MainLoop {
|
|
581
|
+
on: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
582
|
+
off: (<K extends keyof MainLoopEventMap>(type: K, listener: MainLoopEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
583
|
+
emit: (<K extends keyof EventListenerOptions>(type: K, ...args: Parameters<EventListenerOptions[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
584
|
+
}
|
|
585
|
+
declare class MainLoop extends CoreObject {
|
|
586
|
+
fps: number;
|
|
587
|
+
speed: number;
|
|
588
|
+
protected _starting: boolean;
|
|
589
|
+
protected _nextDeltaTime: number;
|
|
590
|
+
get starting(): boolean;
|
|
591
|
+
get spf(): number;
|
|
592
|
+
constructor();
|
|
593
|
+
start(process: (delta: number) => void): this;
|
|
594
|
+
stop(): this;
|
|
595
|
+
protected _onNextTick(): void;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
interface CssFunctionArg {
|
|
599
|
+
unit: string | null;
|
|
600
|
+
value: string;
|
|
601
|
+
intValue: number;
|
|
602
|
+
normalizedIntValue: number;
|
|
603
|
+
normalizedDefaultIntValue: number;
|
|
604
|
+
}
|
|
605
|
+
interface CssFunction {
|
|
606
|
+
name: string;
|
|
607
|
+
args: CssFunctionArg[];
|
|
608
|
+
}
|
|
609
|
+
interface ParseArgumentContext {
|
|
610
|
+
index?: number;
|
|
611
|
+
fontSize?: number;
|
|
612
|
+
width?: number;
|
|
613
|
+
height?: number;
|
|
614
|
+
}
|
|
615
|
+
declare function getDefaultCssPropertyValue<T extends CssFunctionArg | CssFunction[]>(value: T): T;
|
|
616
|
+
declare function parseCssProperty(name: string, propertyValue: string, context?: ParseArgumentContext): CssFunctionArg | CssFunction[];
|
|
617
|
+
declare function parseCssFunctions(propertyValue: string, context?: ParseArgumentContext): CssFunction[];
|
|
618
|
+
|
|
619
|
+
declare const SUPPORTS_WEBGL2: boolean;
|
|
620
|
+
declare const SUPPORTS_IMAGE_BITMAP: boolean;
|
|
621
|
+
declare const SUPPORTS_RESIZE_OBSERVER: boolean;
|
|
622
|
+
declare const SUPPORTS_POINTER_EVENTS: boolean;
|
|
623
|
+
declare const SUPPORTS_WHEEL_EVENTS: boolean;
|
|
624
|
+
declare const SUPPORTS_MOUSE_EVENTS: boolean;
|
|
625
|
+
declare const SUPPORTS_TOUCH_EVENTS: boolean;
|
|
626
|
+
declare const SUPPORTS_CLICK_EVENTS: boolean;
|
|
627
|
+
declare const SUPPORTS_CREATE_IMAGE_BITMAP: boolean;
|
|
628
|
+
declare const SUPPORTS_AUDIO_CONTEXT: boolean;
|
|
629
|
+
declare const SUPPORTS_WEBKIT_AUDIO_CONTEXT: boolean;
|
|
630
|
+
declare const SUPPORTS_OFFLINE_AUDIO_CONTEXT: boolean;
|
|
631
|
+
declare const SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT: boolean;
|
|
632
|
+
declare const SUPPORTS_WEB_AUDIO: boolean;
|
|
633
|
+
declare const IN_BROWSER: boolean;
|
|
634
|
+
declare const DEVICE_PIXEL_RATIO: number;
|
|
635
|
+
declare const isElementNode: (node: unknown) => node is Element;
|
|
636
|
+
declare const isVideoElement: (node: unknown) => node is HTMLVideoElement;
|
|
637
|
+
declare const isImageElement: (node: unknown) => node is HTMLImageElement;
|
|
638
|
+
declare function isCanvasElement(node: unknown): node is HTMLCanvasElement;
|
|
639
|
+
declare function isWebgl2(gl: unknown): gl is WebGL2RenderingContext;
|
|
640
|
+
declare function createHTMLCanvas(): HTMLCanvasElement | undefined;
|
|
641
|
+
declare function determineCrossOrigin(url: string, loc?: Location): string;
|
|
642
|
+
declare function crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin: boolean | string | null): void;
|
|
643
|
+
|
|
644
|
+
declare class RawWeakMap<K extends WeakKey = WeakKey, V = any> {
|
|
645
|
+
protected _map: WeakMap<K, V>;
|
|
646
|
+
protected _toRaw(value: any): any;
|
|
647
|
+
/**
|
|
648
|
+
* Removes the specified element from the WeakMap.
|
|
649
|
+
* @returns true if the element was successfully removed, or false if it was not present.
|
|
650
|
+
*/
|
|
651
|
+
delete(key: K): boolean;
|
|
652
|
+
/**
|
|
653
|
+
* @returns a specified element.
|
|
654
|
+
*/
|
|
655
|
+
get(key: K): V | undefined;
|
|
656
|
+
/**
|
|
657
|
+
* @returns a boolean indicating whether an element with the specified key exists or not.
|
|
658
|
+
*/
|
|
659
|
+
has(key: K): boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Adds a new element with a specified key and value.
|
|
662
|
+
* @param key Must be an object or symbol.
|
|
663
|
+
*/
|
|
664
|
+
set(key: K, value: V): this;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
declare const PI: number;
|
|
668
|
+
declare const PI_2: number;
|
|
669
|
+
declare function uid(object?: Record<string, any>): number;
|
|
670
|
+
declare function isPow2(v: number): boolean;
|
|
671
|
+
|
|
672
|
+
declare abstract class Renderer {
|
|
673
|
+
view?: HTMLCanvasElement;
|
|
674
|
+
pixelRatio: number;
|
|
675
|
+
readonly screen: {
|
|
676
|
+
x: number;
|
|
677
|
+
y: number;
|
|
678
|
+
width: number;
|
|
679
|
+
height: number;
|
|
680
|
+
};
|
|
681
|
+
readonly related: RawWeakMap<object, any>;
|
|
682
|
+
getRelated<T>(source: object, createFn?: () => T): T;
|
|
683
|
+
resize(width: number, height: number, updateStyle?: boolean): void;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
type WebGLBufferTarget = 'array_buffer' | 'element_array_buffer';
|
|
687
|
+
interface WebGLBufferOptions {
|
|
688
|
+
target?: WebGLBufferTarget;
|
|
689
|
+
usage?: WebGLBufferUsage;
|
|
690
|
+
data: BufferSource | number[] | null;
|
|
691
|
+
}
|
|
692
|
+
type WebGLBufferUsage = 'static_draw' | 'dynamic_draw';
|
|
693
|
+
interface WebGLBufferMeta {
|
|
694
|
+
id: number;
|
|
695
|
+
target?: WebGLBufferTarget;
|
|
696
|
+
usage?: WebGLBufferUsage;
|
|
697
|
+
length: number;
|
|
698
|
+
byteLength: number;
|
|
699
|
+
bytesPerElement: number;
|
|
700
|
+
}
|
|
701
|
+
type WebGLDrawMode = 'points' | 'line_strip' | 'line_loop' | 'lines' | 'triangle_strip' | 'triangle_fan' | 'triangles';
|
|
702
|
+
interface WebGLDrawOptions {
|
|
703
|
+
mode?: WebGLDrawMode;
|
|
704
|
+
count?: number;
|
|
705
|
+
first?: number;
|
|
706
|
+
bytesPerElement?: number;
|
|
193
707
|
instanceCount?: number;
|
|
194
708
|
}
|
|
195
709
|
interface WebGLExtensions {
|
|
@@ -399,14 +913,7 @@ declare class WebGLState {
|
|
|
399
913
|
set blendMode(value: WebGLBlendMode);
|
|
400
914
|
get polygonOffset(): number;
|
|
401
915
|
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
|
-
});
|
|
916
|
+
constructor(options?: Partial<WebGLState>);
|
|
410
917
|
}
|
|
411
918
|
declare class WebGLStateModule extends WebGLModule {
|
|
412
919
|
install(renderer: WebGLRenderer): void;
|
|
@@ -436,7 +943,7 @@ interface Batchable2D {
|
|
|
436
943
|
uvs?: number[];
|
|
437
944
|
texture?: WebGLTexture;
|
|
438
945
|
backgroundColor?: number;
|
|
439
|
-
|
|
946
|
+
modulate?: number;
|
|
440
947
|
colorMatrix?: ArrayLike<number>;
|
|
441
948
|
colorMatrixOffset?: ArrayLike<number>;
|
|
442
949
|
blendMode?: WebGLBlendMode;
|
|
@@ -451,7 +958,7 @@ declare class WebGLBatch2DModule extends WebGLModule {
|
|
|
451
958
|
protected _batchSize: number;
|
|
452
959
|
protected _vertexSize: number;
|
|
453
960
|
protected _drawCallUid: number;
|
|
454
|
-
protected
|
|
961
|
+
protected _defaultModulate: number;
|
|
455
962
|
protected _defaultBackgroundColor: number;
|
|
456
963
|
protected _defaultColorMatrixOffset: number[];
|
|
457
964
|
protected _defaultColorMatrix: number[];
|
|
@@ -638,46 +1145,6 @@ declare class WebGLViewportModule extends WebGLModule {
|
|
|
638
1145
|
reset(): void;
|
|
639
1146
|
}
|
|
640
1147
|
|
|
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
1148
|
interface MaterialOptions {
|
|
682
1149
|
vert?: string;
|
|
683
1150
|
frag?: string;
|
|
@@ -707,7 +1174,7 @@ declare class IndexBuffer extends Resource {
|
|
|
707
1174
|
_glBufferOptions(): WebGLBufferOptions;
|
|
708
1175
|
/** @internal */
|
|
709
1176
|
_glBuffer(renderer: WebGLRenderer): WebGLBuffer;
|
|
710
|
-
protected
|
|
1177
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
711
1178
|
upload(renderer: WebGLRenderer): boolean;
|
|
712
1179
|
}
|
|
713
1180
|
|
|
@@ -724,371 +1191,117 @@ declare class VertexBuffer extends Resource {
|
|
|
724
1191
|
_glBufferOptions(): WebGLBufferOptions;
|
|
725
1192
|
/** @internal */
|
|
726
1193
|
_glBuffer(renderer: WebGLRenderer): WebGLBuffer;
|
|
727
|
-
protected
|
|
1194
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
728
1195
|
upload(renderer: WebGLRenderer): boolean;
|
|
729
1196
|
}
|
|
730
1197
|
|
|
731
|
-
interface VertexAttributeOptions {
|
|
732
|
-
buffer?: VertexBuffer;
|
|
733
|
-
size?: number;
|
|
734
|
-
normalized?: boolean;
|
|
735
|
-
type?: 'float' | 'unsigned_byte' | 'unsigned_short';
|
|
736
|
-
stride?: number;
|
|
737
|
-
offset?: number;
|
|
738
|
-
divisor?: number;
|
|
739
|
-
}
|
|
740
|
-
declare class VertexAttribute extends Resource {
|
|
741
|
-
buffer: VertexBuffer;
|
|
742
|
-
size: number;
|
|
743
|
-
normalized: boolean;
|
|
744
|
-
type: 'float' | 'unsigned_byte' | 'unsigned_short';
|
|
745
|
-
stride?: number;
|
|
746
|
-
offset?: number;
|
|
747
|
-
divisor?: number;
|
|
748
|
-
needsUpload: boolean;
|
|
749
|
-
constructor(options?: VertexAttributeOptions);
|
|
750
|
-
protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
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;
|
|
932
|
-
}
|
|
933
|
-
|
|
934
|
-
/**
|
|
935
|
-
* Matrix4
|
|
936
|
-
*
|
|
937
|
-
* | x0 | y0 | z0 | m0 |
|
|
938
|
-
* | x1 | y1 | z1 | m1 |
|
|
939
|
-
* | x2 | y2 | z2 | m2 |
|
|
940
|
-
*/
|
|
941
|
-
declare class Matrix4 extends Matrix {
|
|
942
|
-
constructor(array?: number[]);
|
|
1198
|
+
interface VertexAttributeOptions {
|
|
1199
|
+
buffer?: VertexBuffer;
|
|
1200
|
+
size?: number;
|
|
1201
|
+
normalized?: boolean;
|
|
1202
|
+
type?: 'float' | 'unsigned_byte' | 'unsigned_short';
|
|
1203
|
+
stride?: number;
|
|
1204
|
+
offset?: number;
|
|
1205
|
+
divisor?: number;
|
|
943
1206
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1207
|
+
declare class VertexAttribute extends Resource {
|
|
1208
|
+
buffer: VertexBuffer;
|
|
1209
|
+
size: number;
|
|
1210
|
+
normalized: boolean;
|
|
1211
|
+
type: 'float' | 'unsigned_byte' | 'unsigned_short';
|
|
1212
|
+
stride?: number;
|
|
1213
|
+
offset?: number;
|
|
1214
|
+
divisor?: number;
|
|
1215
|
+
needsUpload: boolean;
|
|
1216
|
+
constructor(options?: VertexAttributeOptions);
|
|
1217
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1218
|
+
upload(): boolean;
|
|
956
1219
|
}
|
|
957
1220
|
|
|
958
|
-
interface
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
d: number;
|
|
964
|
-
ty: number;
|
|
965
|
-
tz: number;
|
|
1221
|
+
interface GeometryOptions {
|
|
1222
|
+
vertexAttributes?: Record<string, VertexAttribute>;
|
|
1223
|
+
indexBuffer?: IndexBuffer;
|
|
1224
|
+
instanceCount?: number;
|
|
1225
|
+
mode?: WebGLDrawMode;
|
|
966
1226
|
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
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;
|
|
1227
|
+
declare class Geometry extends Resource {
|
|
1228
|
+
vertexAttributes: Map<string, VertexAttribute>;
|
|
1229
|
+
indexBuffer?: IndexBuffer;
|
|
1230
|
+
instanceCount?: number;
|
|
1231
|
+
mode: WebGLDrawMode;
|
|
1232
|
+
protected _materialWeakMap: RawWeakMap<Material, Record<string, any>>;
|
|
1233
|
+
constructor(options?: GeometryOptions);
|
|
1234
|
+
/** @internal */
|
|
1235
|
+
_glVertexArray(renderer: WebGLRenderer): WebGLVertexArrayObjectOptions;
|
|
1236
|
+
/** @internal */
|
|
1237
|
+
_glVertexArrayObject(renderer: WebGLRenderer, material: Material): WebGLVertexArrayObject | null;
|
|
1238
|
+
draw(renderer: WebGLRenderer, material: Material, uniforms?: Record<string, any>): void;
|
|
1022
1239
|
}
|
|
1023
1240
|
|
|
1024
|
-
declare
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
declare function lerp(a: number, b: number, weight: number): number;
|
|
1028
|
-
declare const curves: {
|
|
1029
|
-
adaptive: boolean;
|
|
1030
|
-
maxLength: number;
|
|
1031
|
-
minSegments: number;
|
|
1032
|
-
maxSegments: number;
|
|
1033
|
-
epsilon: number;
|
|
1034
|
-
_segmentsCount(length: number, defaultSegments?: number): number;
|
|
1035
|
-
};
|
|
1241
|
+
declare class QuadGeometry extends Geometry {
|
|
1242
|
+
constructor();
|
|
1243
|
+
}
|
|
1036
1244
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
static lerp(a: VectorLike, b: VectorLike, t: number): Vector2;
|
|
1245
|
+
declare class EffectMaterial extends Material {
|
|
1246
|
+
vert: string;
|
|
1247
|
+
readonly uniforms: Map<string, any>;
|
|
1248
|
+
static RE: {
|
|
1249
|
+
getColor: RegExp;
|
|
1250
|
+
getFromColor: RegExp;
|
|
1251
|
+
getToColor: RegExp;
|
|
1252
|
+
transform: RegExp;
|
|
1253
|
+
transition: RegExp;
|
|
1254
|
+
};
|
|
1255
|
+
has: {
|
|
1256
|
+
getColor: boolean;
|
|
1257
|
+
getFromColor: boolean;
|
|
1258
|
+
getToColor: boolean;
|
|
1259
|
+
transform: boolean;
|
|
1260
|
+
transition: boolean;
|
|
1261
|
+
};
|
|
1262
|
+
constructor(glsl: string);
|
|
1056
1263
|
}
|
|
1057
1264
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
declare class Vector3 extends Vector {
|
|
1265
|
+
declare class UvMaterial extends Material {
|
|
1266
|
+
protected static _instance: UvMaterial;
|
|
1267
|
+
static get instance(): UvMaterial;
|
|
1062
1268
|
constructor();
|
|
1063
1269
|
}
|
|
1064
1270
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
constructor(
|
|
1271
|
+
declare class QuadUvGeometry extends Geometry {
|
|
1272
|
+
protected static _instance: QuadUvGeometry;
|
|
1273
|
+
static get instance(): QuadUvGeometry;
|
|
1274
|
+
static draw(renderer: WebGLRenderer, material?: Material, uniforms?: Record<string, any>): void;
|
|
1275
|
+
constructor();
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
declare class UvGeometry extends Geometry {
|
|
1279
|
+
positionBuffer: VertexBuffer;
|
|
1280
|
+
uvBuffer: VertexBuffer;
|
|
1281
|
+
constructor();
|
|
1282
|
+
update(vertices: Float32Array, uvs: Float32Array, indices: Uint16Array): this;
|
|
1070
1283
|
}
|
|
1071
1284
|
|
|
1072
|
-
type
|
|
1073
|
-
type
|
|
1074
|
-
interface
|
|
1285
|
+
type Texture2DFilterMode = WebGLTextureFilterMode;
|
|
1286
|
+
type Texture2DWrapMode = WebGLTextureWrapMode;
|
|
1287
|
+
interface Texture2DPixelsSource {
|
|
1075
1288
|
width: number;
|
|
1076
1289
|
height: number;
|
|
1077
1290
|
pixels: Uint8Array | null;
|
|
1078
1291
|
}
|
|
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():
|
|
1292
|
+
type Texture2DSource = TexImageSource | Texture2DPixelsSource;
|
|
1293
|
+
declare class Texture2D<T extends Texture2DSource = Texture2DSource> extends Resource {
|
|
1294
|
+
static get EMPTY(): Texture2D;
|
|
1295
|
+
static get WHITE(): Texture2D;
|
|
1296
|
+
static get BLACK(): Texture2D;
|
|
1297
|
+
static get RED(): Texture2D;
|
|
1298
|
+
static get GREEN(): Texture2D;
|
|
1299
|
+
static get BLUE(): Texture2D;
|
|
1087
1300
|
source: T;
|
|
1088
1301
|
width: number;
|
|
1089
1302
|
height: number;
|
|
1090
|
-
filterMode:
|
|
1091
|
-
wrapMode:
|
|
1303
|
+
filterMode: Texture2DFilterMode;
|
|
1304
|
+
wrapMode: Texture2DWrapMode;
|
|
1092
1305
|
pixelRatio: number;
|
|
1093
1306
|
protected _isPowerOfTwo: boolean;
|
|
1094
1307
|
protected _needsUpload: boolean;
|
|
@@ -1096,26 +1309,36 @@ declare class Texture<T extends TextureSource = TextureSource> extends Resource
|
|
|
1096
1309
|
get realWidth(): number;
|
|
1097
1310
|
get realHeight(): number;
|
|
1098
1311
|
constructor(source: T);
|
|
1099
|
-
protected _refreshPOT(): void;
|
|
1100
1312
|
/** @internal */
|
|
1101
1313
|
_glTextureOptions(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): WebGLTextureOptions;
|
|
1102
1314
|
/** @internal */
|
|
1103
1315
|
_glTexture(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): WebGLTexture;
|
|
1104
|
-
protected
|
|
1316
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1317
|
+
protected _updatePOT(): void;
|
|
1105
1318
|
protected _updateSize(): void;
|
|
1106
1319
|
requestUpload(): void;
|
|
1107
1320
|
upload(renderer: WebGLRenderer, options?: Partial<WebGLTextureOptions>): boolean;
|
|
1108
|
-
activate(renderer: WebGLRenderer, location?: number):
|
|
1321
|
+
activate(renderer: WebGLRenderer, location?: number): boolean;
|
|
1109
1322
|
inactivate(renderer: WebGLRenderer): void;
|
|
1110
1323
|
destroy(): void;
|
|
1111
1324
|
}
|
|
1112
1325
|
|
|
1326
|
+
declare class CanvasTexture extends Texture2D<HTMLCanvasElement> {
|
|
1327
|
+
pixelRatio: number;
|
|
1328
|
+
constructor(source?: HTMLCanvasElement);
|
|
1329
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
declare class ColorTexture extends Texture2D {
|
|
1333
|
+
constructor(value: ColorValue);
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1113
1336
|
interface ImageTextureOptions {
|
|
1114
1337
|
autoLoad?: boolean;
|
|
1115
1338
|
useBitmap?: boolean;
|
|
1116
1339
|
crossorigin?: boolean | string | null;
|
|
1117
1340
|
}
|
|
1118
|
-
declare class ImageTexture extends
|
|
1341
|
+
declare class ImageTexture extends Texture2D<HTMLImageElement> {
|
|
1119
1342
|
bitmap?: ImageBitmap;
|
|
1120
1343
|
useBitmap: boolean;
|
|
1121
1344
|
preserveBitmap: boolean;
|
|
@@ -1129,8 +1352,9 @@ declare class ImageTexture extends Texture<HTMLImageElement> {
|
|
|
1129
1352
|
upload(renderer: WebGLRenderer): boolean;
|
|
1130
1353
|
}
|
|
1131
1354
|
|
|
1132
|
-
declare class PixelsTexture extends
|
|
1133
|
-
constructor(pixels?:
|
|
1355
|
+
declare class PixelsTexture extends Texture2D<Texture2DPixelsSource> {
|
|
1356
|
+
constructor(pixels?: number[] | ArrayBufferLike | ArrayBufferView | null, width?: number, height?: number);
|
|
1357
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1134
1358
|
}
|
|
1135
1359
|
|
|
1136
1360
|
interface VideoTextureOptions {
|
|
@@ -1146,7 +1370,7 @@ interface VideoTextureSource {
|
|
|
1146
1370
|
src: string;
|
|
1147
1371
|
mime: string;
|
|
1148
1372
|
}
|
|
1149
|
-
declare class VideoTexture extends
|
|
1373
|
+
declare class VideoTexture extends Texture2D<HTMLVideoElement> {
|
|
1150
1374
|
autoUpdate: boolean;
|
|
1151
1375
|
fps: number;
|
|
1152
1376
|
static readonly mimeTypes: Map<string, string>;
|
|
@@ -1165,7 +1389,7 @@ declare class VideoTexture extends Texture<HTMLVideoElement> {
|
|
|
1165
1389
|
protected _resolve?: (val: this) => void;
|
|
1166
1390
|
protected _reject?: (event: ErrorEvent) => void;
|
|
1167
1391
|
constructor(source: HTMLVideoElement | (string | VideoTextureSource)[] | string, options?: VideoTextureOptions);
|
|
1168
|
-
protected
|
|
1392
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1169
1393
|
protected _onPlayStart: () => void;
|
|
1170
1394
|
protected _onPlayStop: () => void;
|
|
1171
1395
|
protected _onCanPlay: () => void;
|
|
@@ -1179,19 +1403,176 @@ declare class VideoTexture extends Texture<HTMLVideoElement> {
|
|
|
1179
1403
|
destroy(): void;
|
|
1180
1404
|
}
|
|
1181
1405
|
|
|
1182
|
-
declare class ViewportTexture extends PixelsTexture {
|
|
1406
|
+
declare class ViewportTexture extends PixelsTexture {
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
type CanvasItemStyleFilterKey = 'hue-rotate' | 'saturate' | 'brightness' | 'contrast' | 'invert' | 'sepia' | 'opacity' | 'grayscale';
|
|
1410
|
+
type CanvasItemStyleFilter = Record<CanvasItemStyleFilterKey, number>;
|
|
1411
|
+
interface CanvasItemStyleProperties extends IDOCTextStyleDeclaration, IDOCTransformStyleDeclaration {
|
|
1412
|
+
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1413
|
+
backgroundColor?: ColorValue;
|
|
1414
|
+
backgroundImage?: string;
|
|
1415
|
+
filter: string;
|
|
1416
|
+
shadowColor: ColorValue;
|
|
1417
|
+
shadowOffsetX: number;
|
|
1418
|
+
shadowOffsetY: number;
|
|
1419
|
+
shadowBlur: number;
|
|
1420
|
+
opacity: number;
|
|
1421
|
+
borderWidth: number;
|
|
1422
|
+
borderRadius: number;
|
|
1423
|
+
borderColor: ColorValue;
|
|
1424
|
+
borderStyle: string;
|
|
1425
|
+
outlineWidth: number;
|
|
1426
|
+
outlineOffset: number;
|
|
1427
|
+
outlineColor: ColorValue;
|
|
1428
|
+
outlineStyle: string;
|
|
1429
|
+
visibility: Visibility;
|
|
1430
|
+
overflow: Overflow;
|
|
1431
|
+
pointerEvents: PointerEvents;
|
|
1432
|
+
}
|
|
1433
|
+
type PointerEvents = 'auto' | 'none';
|
|
1434
|
+
interface CanvasItemStyle extends CanvasItemStyleProperties {
|
|
1435
|
+
}
|
|
1436
|
+
declare class CanvasItemStyle extends Resource {
|
|
1437
|
+
backgroundColor?: string;
|
|
1438
|
+
backgroundImage?: string;
|
|
1439
|
+
filter: string;
|
|
1440
|
+
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1441
|
+
shadowColor: string;
|
|
1442
|
+
shadowOffsetX: number;
|
|
1443
|
+
shadowOffsetY: number;
|
|
1444
|
+
shadowBlur: number;
|
|
1445
|
+
opacity: number;
|
|
1446
|
+
borderWidth: number;
|
|
1447
|
+
borderRadius: number;
|
|
1448
|
+
borderColor: string;
|
|
1449
|
+
borderStyle: string;
|
|
1450
|
+
outlineWidth: number;
|
|
1451
|
+
outlineOffset: number;
|
|
1452
|
+
outlineColor: string;
|
|
1453
|
+
outlineStyle: string;
|
|
1454
|
+
visibility: Visibility;
|
|
1455
|
+
overflow: Overflow;
|
|
1456
|
+
pointerEvents: PointerEvents;
|
|
1457
|
+
protected _backgroundColor: Color;
|
|
1458
|
+
constructor(properties?: Partial<CanvasItemStyleProperties>);
|
|
1459
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1460
|
+
canPointeEvents(): boolean;
|
|
1461
|
+
getComputedOpacity(): number;
|
|
1462
|
+
getComputedBackgroundColor(): Color;
|
|
1463
|
+
getComputedBackgroundImage(): Promise<Texture2D<ImageBitmap> | undefined>;
|
|
1464
|
+
getComputedTransform(): Transform2D;
|
|
1465
|
+
getComputedTransformOrigin(): number[];
|
|
1466
|
+
getComputedFilter(): CanvasItemStyleFilter;
|
|
1467
|
+
getComputedFilterColorMatrix(): ColorMatrix;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
interface CanvasBatchable extends Batchable2D {
|
|
1471
|
+
type: 'stroke' | 'fill';
|
|
1472
|
+
texture?: Texture2D;
|
|
1473
|
+
}
|
|
1474
|
+
interface StrokedGraphics {
|
|
1475
|
+
path: Path2D;
|
|
1476
|
+
texture?: Texture2D;
|
|
1477
|
+
textureTransform?: Transform2D;
|
|
1478
|
+
style: LineStyle;
|
|
1479
|
+
}
|
|
1480
|
+
interface FilledGraphics {
|
|
1481
|
+
path: Path2D;
|
|
1482
|
+
texture?: Texture2D;
|
|
1483
|
+
textureTransform?: Transform2D;
|
|
1484
|
+
}
|
|
1485
|
+
declare class CanvasContext extends Path2D {
|
|
1486
|
+
textureTransform?: Transform2D;
|
|
1487
|
+
fillStyle?: ColorValue | Texture2D;
|
|
1488
|
+
strokeStyle?: ColorValue | Texture2D;
|
|
1489
|
+
lineCap?: LineCap;
|
|
1490
|
+
lineJoin?: LineJoin;
|
|
1491
|
+
lineWidth?: number;
|
|
1492
|
+
miterLimit?: number;
|
|
1493
|
+
_defaultStyle: Texture2D<Texture2DSource>;
|
|
1494
|
+
_stroke: StrokedGraphics[];
|
|
1495
|
+
_fille: FilledGraphics[];
|
|
1496
|
+
stroke(): void;
|
|
1497
|
+
fillRect(x: number, y: number, width: number, height: number): void;
|
|
1498
|
+
strokeRect(x: number, y: number, width: number, height: number): void;
|
|
1499
|
+
fill(): void;
|
|
1500
|
+
copy(source: CanvasContext): this;
|
|
1501
|
+
reset(): this;
|
|
1502
|
+
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, textureTransform?: Transform2D): void;
|
|
1503
|
+
toBatchables(): CanvasBatchable[];
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
interface RenderCall {
|
|
1507
|
+
renderable: Node;
|
|
1508
|
+
fn: (renderer: WebGLRenderer, next: () => void) => void;
|
|
1509
|
+
parentCall: RenderCall | undefined;
|
|
1510
|
+
calls: RenderCall[];
|
|
1511
|
+
}
|
|
1512
|
+
declare class RenderStack extends Node {
|
|
1513
|
+
currentCall?: RenderCall;
|
|
1514
|
+
calls: RenderCall[];
|
|
1515
|
+
createCall(renderable: Node): RenderCall;
|
|
1516
|
+
push(renderable: Node): RenderCall;
|
|
1517
|
+
render(renderer: WebGLRenderer): void;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
interface TimelineEventMap extends NodeEventMap {
|
|
1521
|
+
updateCurrentTime: (current: number, delta: number) => void;
|
|
1522
|
+
}
|
|
1523
|
+
interface TimelineProperties extends NodeProperties {
|
|
1524
|
+
startTime: number;
|
|
1525
|
+
currentTime: number;
|
|
1526
|
+
endTime: number;
|
|
1527
|
+
loop: boolean;
|
|
1528
|
+
}
|
|
1529
|
+
interface Timeline {
|
|
1530
|
+
on: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1531
|
+
off: (<K extends keyof TimelineEventMap>(type: K, listener: TimelineEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1532
|
+
emit: (<K extends keyof TimelineEventMap>(type: K, ...args: Parameters<TimelineEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1533
|
+
}
|
|
1534
|
+
declare class Timeline extends Node {
|
|
1535
|
+
startTime: number;
|
|
1536
|
+
currentTime: number;
|
|
1537
|
+
endTime: number;
|
|
1538
|
+
loop: boolean;
|
|
1539
|
+
static from(range: number | number[], loop?: boolean): Timeline;
|
|
1540
|
+
constructor(properties?: Partial<TimelineProperties>);
|
|
1541
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1542
|
+
addTime(delta: number): this;
|
|
1543
|
+
protected _process(delta: number): void;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
interface RectangulableEventMap {
|
|
1547
|
+
updateRect: () => void;
|
|
1548
|
+
}
|
|
1549
|
+
interface Rectangulable {
|
|
1550
|
+
on: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1551
|
+
off: (<K extends keyof RectangulableEventMap>(type: K, listener: RectangulableEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1552
|
+
emit: (<K extends keyof RectangulableEventMap>(type: K, ...args: Parameters<RectangulableEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1553
|
+
}
|
|
1554
|
+
interface Rectangulable {
|
|
1555
|
+
getRect: () => Rect2;
|
|
1183
1556
|
}
|
|
1184
1557
|
|
|
1558
|
+
interface ViewportEventMap extends NodeEventMap, RectangulableEventMap {
|
|
1559
|
+
}
|
|
1185
1560
|
interface ViewportFramebuffer {
|
|
1186
1561
|
texture: ViewportTexture;
|
|
1187
1562
|
needsUpload: boolean;
|
|
1188
1563
|
}
|
|
1189
|
-
|
|
1564
|
+
interface Viewport {
|
|
1565
|
+
on: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1566
|
+
off: (<K extends keyof ViewportEventMap>(type: K, listener: ViewportEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1567
|
+
emit: (<K extends keyof ViewportEventMap>(type: K, ...args: Parameters<ViewportEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1568
|
+
}
|
|
1569
|
+
declare class Viewport extends Node implements Rectangulable {
|
|
1190
1570
|
flipY: boolean;
|
|
1191
1571
|
x: number;
|
|
1192
1572
|
y: number;
|
|
1193
1573
|
width: number;
|
|
1194
1574
|
height: number;
|
|
1575
|
+
get valid(): boolean;
|
|
1195
1576
|
protected _projection: Projection2D;
|
|
1196
1577
|
protected _framebufferIndex: number;
|
|
1197
1578
|
protected _framebuffers: ViewportFramebuffer[];
|
|
@@ -1202,14 +1583,15 @@ declare class Viewport extends Node {
|
|
|
1202
1583
|
_glFramebufferOptions(renderer: WebGLRenderer): WebGLFramebufferOptions;
|
|
1203
1584
|
/** @internal */
|
|
1204
1585
|
_glFramebuffer(renderer: WebGLRenderer): WebGLFramebuffer;
|
|
1205
|
-
protected
|
|
1586
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1206
1587
|
requestUpload(): void;
|
|
1207
1588
|
resize(width: number, height: number): void;
|
|
1208
1589
|
upload(renderer: WebGLRenderer): boolean;
|
|
1209
|
-
activate(renderer: WebGLRenderer):
|
|
1210
|
-
redraw(renderer: WebGLRenderer, cb: () => void):
|
|
1590
|
+
activate(renderer: WebGLRenderer): boolean;
|
|
1591
|
+
redraw(renderer: WebGLRenderer, cb: () => void): boolean;
|
|
1211
1592
|
activateWithCopy(renderer: WebGLRenderer, target: Viewport): void;
|
|
1212
1593
|
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1594
|
+
getRect(): Rect2;
|
|
1213
1595
|
toProjectionArray(transpose?: boolean): number[];
|
|
1214
1596
|
}
|
|
1215
1597
|
|
|
@@ -1225,415 +1607,202 @@ interface SceneTree {
|
|
|
1225
1607
|
emit: (<K extends keyof SceneTreeEventMap>(type: K, ...args: Parameters<SceneTreeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1226
1608
|
}
|
|
1227
1609
|
declare class SceneTree extends MainLoop {
|
|
1610
|
+
paused: boolean;
|
|
1611
|
+
backgroundColor?: ColorValue;
|
|
1228
1612
|
readonly renderStack: RenderStack;
|
|
1229
1613
|
readonly root: Viewport;
|
|
1230
|
-
readonly timeline:
|
|
1614
|
+
readonly timeline: Timeline;
|
|
1615
|
+
protected _backgroundColor: Color;
|
|
1231
1616
|
protected _currentViewport?: Viewport;
|
|
1232
1617
|
getCurrentViewport(): Viewport | undefined;
|
|
1233
1618
|
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1619
|
+
constructor(timeline?: Timeline);
|
|
1620
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1234
1621
|
protected _render(renderer: WebGLRenderer, delta?: number): this;
|
|
1235
1622
|
protected _renderScreen(renderer: WebGLRenderer): void;
|
|
1236
1623
|
}
|
|
1237
1624
|
|
|
1238
|
-
interface NodeEventMap extends
|
|
1239
|
-
|
|
1240
|
-
|
|
1625
|
+
interface NodeEventMap extends CoreObjectEventMap, InputEventMap {
|
|
1626
|
+
treeEnter: (tree: SceneTree) => void;
|
|
1627
|
+
treeEntered: (tree: SceneTree) => void;
|
|
1628
|
+
treePostEnter: (tree: SceneTree) => void;
|
|
1629
|
+
treeExit: (oldTree: SceneTree) => void;
|
|
1630
|
+
treeExiting: (oldTree: SceneTree) => void;
|
|
1631
|
+
treeExited: (oldTree: SceneTree) => void;
|
|
1241
1632
|
childExitingTree: (node: Node) => void;
|
|
1242
1633
|
childEnteredTree: (node: Node) => void;
|
|
1243
|
-
postEnterTree: () => void;
|
|
1244
1634
|
ready: () => void;
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
parented: () => void;
|
|
1249
|
-
unparented: () => void;
|
|
1635
|
+
parented: (parent: Node) => void;
|
|
1636
|
+
unparented: (oldParent: Node) => void;
|
|
1637
|
+
processing: (delta?: number) => void;
|
|
1250
1638
|
process: (delta?: number) => void;
|
|
1639
|
+
processed: (delta?: number) => void;
|
|
1251
1640
|
addChild: (child: Node) => void;
|
|
1252
1641
|
removeChild: (child: Node, index: number) => void;
|
|
1253
1642
|
moveChild: (child: Node, newIndex: number, oldIndex: number) => void;
|
|
1254
1643
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
visibleDelay?: number;
|
|
1265
|
-
visibleDuration?: number;
|
|
1644
|
+
type InternalMode = 'default' | 'front' | 'back';
|
|
1645
|
+
type ProcessMode = 'inherit' | 'pausable' | 'when_paused' | 'always' | 'disabled';
|
|
1646
|
+
type RenderMode = 'inherit' | 'always' | 'disabled';
|
|
1647
|
+
interface NodeProperties {
|
|
1648
|
+
name: string;
|
|
1649
|
+
processMode: ProcessMode;
|
|
1650
|
+
renderMode: RenderMode;
|
|
1651
|
+
internalMode: InternalMode;
|
|
1652
|
+
mask: Maskable;
|
|
1266
1653
|
}
|
|
1267
1654
|
interface Node {
|
|
1268
1655
|
on: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1269
1656
|
off: (<K extends keyof NodeEventMap>(type: K, listener: NodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1270
1657
|
emit: (<K extends keyof NodeEventMap>(type: K, ...args: Parameters<NodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1271
1658
|
}
|
|
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 {
|
|
1659
|
+
declare class Node extends CoreObject {
|
|
1285
1660
|
readonly tag: string;
|
|
1286
|
-
renderable?: boolean;
|
|
1287
1661
|
name: string;
|
|
1288
1662
|
mask?: Maskable;
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
/** @internal */
|
|
1293
|
-
_computedVisibleDelay: number;
|
|
1294
|
-
_computedVisibleDuration: number;
|
|
1295
|
-
_computedVisibility: Visibility;
|
|
1296
|
-
/** @internal */
|
|
1297
|
-
_internalMode: InternalMode;
|
|
1663
|
+
processMode: ProcessMode;
|
|
1664
|
+
renderMode: RenderMode;
|
|
1665
|
+
internalMode: InternalMode;
|
|
1298
1666
|
protected _readyed: boolean;
|
|
1299
|
-
|
|
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;
|
|
1667
|
+
constructor(properties?: Partial<NodeProperties>, children?: Node[]);
|
|
1321
1668
|
/** Name */
|
|
1669
|
+
getName(): string;
|
|
1322
1670
|
setName(value: string): this;
|
|
1323
1671
|
/** Tree */
|
|
1672
|
+
protected _tree?: SceneTree;
|
|
1673
|
+
get tree(): SceneTree | undefined;
|
|
1674
|
+
set tree(tree: SceneTree | undefined);
|
|
1324
1675
|
getTree(): SceneTree | undefined;
|
|
1325
1676
|
getViewport(): Viewport | undefined;
|
|
1326
1677
|
getWindow(): Viewport | undefined;
|
|
1327
1678
|
isInsideTree(): boolean;
|
|
1328
|
-
|
|
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;
|
|
1679
|
+
setTree(tree: SceneTree | undefined): this;
|
|
1341
1680
|
/** Parent */
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
protected
|
|
1367
|
-
protected
|
|
1368
|
-
protected
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
protected
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
protected
|
|
1399
|
-
|
|
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;
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
declare abstract class Style2DModule {
|
|
1569
|
-
abstract install(Style2D: new () => Style2D): void;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
interface Style2DBackgroundProperties {
|
|
1573
|
-
backgroundColor?: string;
|
|
1574
|
-
backgroundImage?: string;
|
|
1575
|
-
}
|
|
1576
|
-
interface Style2DBackgroundExtend extends Style2DBackgroundProperties {
|
|
1577
|
-
getComputedBackgroundImage: typeof getComputedBackgroundImage;
|
|
1578
|
-
}
|
|
1579
|
-
declare class Style2DBackgroundModule extends Style2DModule {
|
|
1580
|
-
install(Style2D: new () => Style2D): void;
|
|
1681
|
+
protected _parent?: Node;
|
|
1682
|
+
get parent(): Node | undefined;
|
|
1683
|
+
set parent(parent: Node | undefined);
|
|
1684
|
+
hasParent(): boolean;
|
|
1685
|
+
getParent(): Node | undefined;
|
|
1686
|
+
setParent(parent: Node | undefined): this;
|
|
1687
|
+
/** Children */
|
|
1688
|
+
protected _children: Node[];
|
|
1689
|
+
get siblingIndex(): number;
|
|
1690
|
+
set siblingIndex(toIndex: number);
|
|
1691
|
+
get previousSibling(): Node | undefined;
|
|
1692
|
+
get nextSibling(): Node | undefined;
|
|
1693
|
+
get firstSibling(): Node | undefined;
|
|
1694
|
+
get lastSibling(): Node | undefined;
|
|
1695
|
+
/** Meta */
|
|
1696
|
+
protected _meta: Map<string, unknown>;
|
|
1697
|
+
hasMeta(name: string): boolean;
|
|
1698
|
+
getMeta<T = any>(name: string): T | undefined;
|
|
1699
|
+
getMeta<T = any>(name: string, defaultVal: T): T;
|
|
1700
|
+
setMeta(name: string, value: any): void;
|
|
1701
|
+
deleteMeta(name: string): void;
|
|
1702
|
+
clearMeta(): void;
|
|
1703
|
+
canProcess(): boolean;
|
|
1704
|
+
canRender(): boolean;
|
|
1705
|
+
protected _onTreeEnter(tree: SceneTree): void;
|
|
1706
|
+
protected _onTreeExit(oldTree: SceneTree): void;
|
|
1707
|
+
protected _onParented(parent: Node): void;
|
|
1708
|
+
protected _onUnparented(oldParent: Node): void;
|
|
1709
|
+
protected _onReady(): void;
|
|
1710
|
+
protected _onProcess(delta?: number): void;
|
|
1711
|
+
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1712
|
+
input(event: InputEvent, key: InputEventKey): void;
|
|
1713
|
+
/** Children */
|
|
1714
|
+
getChildren(includeInternal?: boolean | InternalMode): Node[];
|
|
1715
|
+
getIndex(includeInternal?: boolean | InternalMode): number;
|
|
1716
|
+
getNode<T extends Node>(path: string): T | undefined;
|
|
1717
|
+
removeNode(path: string): void;
|
|
1718
|
+
addSibling(sibling: Node): this;
|
|
1719
|
+
append(children: Node[]): this;
|
|
1720
|
+
append(...children: Node[]): this;
|
|
1721
|
+
addChild(child: Node, internalMode?: InternalMode): this;
|
|
1722
|
+
moveChild(child: Node, toIndex: number, internalMode?: InternalMode): this;
|
|
1723
|
+
removeChild(child: Node): this;
|
|
1724
|
+
removeChildren(): void;
|
|
1725
|
+
remove(): void;
|
|
1726
|
+
forEach(fn: (child: Node) => void): this;
|
|
1727
|
+
deepForEach(fn: (descendant: Node) => void): this;
|
|
1728
|
+
is(target: Node | undefined | null): boolean;
|
|
1729
|
+
/** override */
|
|
1730
|
+
protected _ready(): void;
|
|
1731
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
1732
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
1733
|
+
protected _parented(parent: Node): void;
|
|
1734
|
+
protected _unparented(oldParent: Node): void;
|
|
1735
|
+
protected _process(delta: number): void;
|
|
1736
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1737
|
+
protected _render(renderer: WebGLRenderer): void;
|
|
1738
|
+
toJSON(): Record<string, any>;
|
|
1739
|
+
static parse(JSON: Record<string, any>[]): Node[];
|
|
1740
|
+
static parse(JSON: Record<string, any>): Node;
|
|
1581
1741
|
}
|
|
1582
|
-
declare function getComputedBackgroundImage(this: Style2D): Promise<Texture<ImageBitmap> | undefined>;
|
|
1583
1742
|
|
|
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;
|
|
1743
|
+
interface TimelineNodeProperties extends NodeProperties {
|
|
1744
|
+
delay: number;
|
|
1745
|
+
duration: number;
|
|
1746
|
+
paused: boolean;
|
|
1595
1747
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
interface Style2DTextProperties extends IDOCTextStyleDeclaration {
|
|
1600
|
-
direction: 'inherit' | 'ltr' | 'rtl';
|
|
1748
|
+
interface TimelineNodeEventMap extends NodeEventMap {
|
|
1749
|
+
updateCurrentTime: (currentTime: number) => void;
|
|
1601
1750
|
}
|
|
1602
|
-
interface
|
|
1751
|
+
interface TimelineNode {
|
|
1752
|
+
on: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1753
|
+
off: (<K extends keyof TimelineNodeEventMap>(type: K, listener: TimelineNodeEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1754
|
+
emit: (<K extends keyof TimelineNodeEventMap>(type: K, ...args: Parameters<TimelineNodeEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1603
1755
|
}
|
|
1604
|
-
declare class
|
|
1605
|
-
|
|
1756
|
+
declare class TimelineNode extends Node {
|
|
1757
|
+
delay: number;
|
|
1758
|
+
duration: number;
|
|
1759
|
+
paused: boolean;
|
|
1760
|
+
constructor(properties?: Partial<TimelineNodeProperties>, children?: Node[]);
|
|
1761
|
+
/** Timeline */
|
|
1762
|
+
computedDuration: number;
|
|
1763
|
+
protected _currentTime: number;
|
|
1764
|
+
protected _startTime: number;
|
|
1765
|
+
get timeline(): Timeline | undefined;
|
|
1766
|
+
get timelineCurrentTime(): number;
|
|
1767
|
+
get parentStartTime(): number;
|
|
1768
|
+
get currentTime(): number;
|
|
1769
|
+
get startTime(): number;
|
|
1770
|
+
set startTime(val: number);
|
|
1771
|
+
get endTime(): number;
|
|
1772
|
+
get currentTimeProgress(): number;
|
|
1773
|
+
isInsideTimeRange(): boolean;
|
|
1774
|
+
protected _updateCurrentTime(force?: boolean): void;
|
|
1775
|
+
protected _process(delta: number): void;
|
|
1606
1776
|
}
|
|
1607
1777
|
|
|
1608
|
-
interface
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1778
|
+
interface CanvasItemProperties extends TimelineNodeProperties {
|
|
1779
|
+
visible: boolean;
|
|
1780
|
+
style: Partial<CanvasItemStyleProperties>;
|
|
1781
|
+
modulate: ColorValue;
|
|
1782
|
+
blendMode: WebGLBlendMode;
|
|
1613
1783
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1784
|
+
interface CanvasItemEventMap extends TimelineNodeEventMap {
|
|
1785
|
+
updateStyleProperty: (key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration) => void;
|
|
1786
|
+
draw: () => void;
|
|
1616
1787
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
style?: Style2DOptions;
|
|
1622
|
-
tint?: string;
|
|
1623
|
-
blendMode?: WebGLBlendMode;
|
|
1788
|
+
interface CanvasItem {
|
|
1789
|
+
on: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1790
|
+
off: (<K extends keyof CanvasItemEventMap>(type: K, listener: CanvasItemEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
1791
|
+
emit: (<K extends keyof CanvasItemEventMap>(type: K, ...args: Parameters<CanvasItemEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
1624
1792
|
}
|
|
1625
|
-
declare class CanvasItem extends
|
|
1626
|
-
|
|
1793
|
+
declare class CanvasItem extends TimelineNode {
|
|
1794
|
+
visible: boolean;
|
|
1795
|
+
modulate?: ColorValue;
|
|
1627
1796
|
blendMode?: WebGLBlendMode;
|
|
1628
|
-
protected _style:
|
|
1629
|
-
get style():
|
|
1630
|
-
set style(style:
|
|
1797
|
+
protected _style: CanvasItemStyle;
|
|
1798
|
+
get style(): CanvasItemStyle;
|
|
1799
|
+
set style(style: CanvasItemStyle);
|
|
1631
1800
|
/** @internal */
|
|
1632
1801
|
opacity: number;
|
|
1633
1802
|
protected _parentOpacity?: number;
|
|
1634
|
-
protected
|
|
1635
|
-
protected
|
|
1636
|
-
|
|
1803
|
+
protected _modulate: Color;
|
|
1804
|
+
protected _backgroundImage?: Texture2D;
|
|
1805
|
+
_computedVisible: boolean;
|
|
1637
1806
|
context: CanvasContext;
|
|
1638
1807
|
protected _resetContext: boolean;
|
|
1639
1808
|
protected _redrawing: boolean;
|
|
@@ -1642,14 +1811,18 @@ declare class CanvasItem extends Node {
|
|
|
1642
1811
|
protected _originalBatchables: CanvasBatchable[];
|
|
1643
1812
|
protected _layoutedBatchables: CanvasBatchable[];
|
|
1644
1813
|
protected _batchables: CanvasBatchable[];
|
|
1645
|
-
constructor(
|
|
1814
|
+
constructor(properties?: Partial<CanvasItemProperties>, children?: Node[]);
|
|
1646
1815
|
setProperties(properties?: Record<PropertyKey, any>): this;
|
|
1647
|
-
protected
|
|
1648
|
-
protected
|
|
1816
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1817
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1649
1818
|
protected _updateBackgroundColor(): void;
|
|
1650
1819
|
protected _updateBackgroundImage(): Promise<void>;
|
|
1651
1820
|
protected _updateOpacity(): void;
|
|
1652
|
-
|
|
1821
|
+
protected _updateVisible(): void;
|
|
1822
|
+
show(): void;
|
|
1823
|
+
hide(): void;
|
|
1824
|
+
isVisibleInTree(): boolean;
|
|
1825
|
+
canRender(): boolean;
|
|
1653
1826
|
requestRedraw(): void;
|
|
1654
1827
|
requestReflow(): void;
|
|
1655
1828
|
requestRepaint(): void;
|
|
@@ -1657,7 +1830,11 @@ declare class CanvasItem extends Node {
|
|
|
1657
1830
|
protected _draw(): void;
|
|
1658
1831
|
protected _drawBackground(): void;
|
|
1659
1832
|
protected _drawContent(): void;
|
|
1833
|
+
protected _drawBorder(): void;
|
|
1834
|
+
protected _drawOutline(): void;
|
|
1835
|
+
protected _drawBoundingRect(): void;
|
|
1660
1836
|
protected _fill(): void;
|
|
1837
|
+
protected _stroke(): void;
|
|
1661
1838
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1662
1839
|
protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1663
1840
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
@@ -1665,28 +1842,28 @@ declare class CanvasItem extends Node {
|
|
|
1665
1842
|
toJSON(): Record<string, any>;
|
|
1666
1843
|
}
|
|
1667
1844
|
|
|
1668
|
-
interface
|
|
1845
|
+
interface Node2DProperties extends CanvasItemProperties {
|
|
1669
1846
|
}
|
|
1670
1847
|
declare class Node2D extends CanvasItem {
|
|
1671
|
-
|
|
1848
|
+
transform: Transform2D;
|
|
1672
1849
|
protected _parentTransformDirtyId?: number;
|
|
1673
|
-
constructor(
|
|
1674
|
-
|
|
1675
|
-
protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1850
|
+
constructor(properties?: Partial<Node2DProperties>, children?: Node[]);
|
|
1851
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1676
1852
|
protected _updateTransform(): void;
|
|
1677
1853
|
protected _updateOverflow(): void;
|
|
1678
1854
|
protected _transformVertices(vertices: number[]): number[];
|
|
1679
1855
|
protected _reflow(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1680
1856
|
protected _process(delta: number): void;
|
|
1681
|
-
|
|
1857
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1858
|
+
clone(): this;
|
|
1682
1859
|
}
|
|
1683
1860
|
|
|
1684
1861
|
declare class Graphics2D extends Node2D {
|
|
1685
1862
|
protected _resetContext: boolean;
|
|
1686
1863
|
lineCap?: LineCap;
|
|
1687
1864
|
lineJoin?: LineJoin;
|
|
1688
|
-
fillStyle?: ColorValue |
|
|
1689
|
-
strokeStyle?: ColorValue |
|
|
1865
|
+
fillStyle?: ColorValue | Texture2D;
|
|
1866
|
+
strokeStyle?: ColorValue | Texture2D;
|
|
1690
1867
|
lineWidth?: number;
|
|
1691
1868
|
miterLimit?: number;
|
|
1692
1869
|
rect: (x: number, y: number, width: number, height: number) => this;
|
|
@@ -1706,66 +1883,69 @@ declare class Graphics2D extends Node2D {
|
|
|
1706
1883
|
}
|
|
1707
1884
|
|
|
1708
1885
|
interface ImageFrame {
|
|
1709
|
-
texture:
|
|
1886
|
+
texture: Texture2D;
|
|
1710
1887
|
duration: number;
|
|
1711
1888
|
}
|
|
1712
1889
|
declare class Image2DResource extends Resource {
|
|
1713
1890
|
frames: ImageFrame[];
|
|
1714
1891
|
duration: number;
|
|
1715
|
-
constructor(source:
|
|
1892
|
+
constructor(source: Texture2D | ImageFrame[]);
|
|
1716
1893
|
updateDuration(): this;
|
|
1717
1894
|
destroy(): void;
|
|
1718
1895
|
}
|
|
1719
1896
|
|
|
1720
|
-
interface
|
|
1721
|
-
src
|
|
1722
|
-
gif
|
|
1897
|
+
interface Image2DProperties extends Node2DProperties {
|
|
1898
|
+
src: string;
|
|
1899
|
+
gif: boolean;
|
|
1723
1900
|
}
|
|
1724
1901
|
declare class Image2D extends Node2D {
|
|
1725
1902
|
resource?: Image2DResource;
|
|
1726
1903
|
gif: boolean;
|
|
1727
1904
|
src: string;
|
|
1728
|
-
get currentTexture():
|
|
1729
|
-
get
|
|
1905
|
+
get currentTexture(): Texture2D | undefined;
|
|
1906
|
+
get framesDuration(): number;
|
|
1730
1907
|
get naturalWidth(): number;
|
|
1731
1908
|
get naturalHeight(): number;
|
|
1732
1909
|
get complete(): boolean;
|
|
1733
1910
|
protected _frameIndex: number;
|
|
1734
1911
|
protected _complete: boolean;
|
|
1735
1912
|
protected _wait: Promise<void>;
|
|
1736
|
-
constructor(
|
|
1737
|
-
protected
|
|
1913
|
+
constructor(properties?: Partial<Image2DProperties>, children?: Node[]);
|
|
1914
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1738
1915
|
decode(): Promise<void>;
|
|
1739
|
-
setResource(source:
|
|
1916
|
+
setResource(source: Texture2D | ImageFrame[] | Image2DResource): this;
|
|
1740
1917
|
protected _load(src: string): Promise<void>;
|
|
1741
|
-
protected
|
|
1918
|
+
protected _getFrameCurrentTime(): number;
|
|
1742
1919
|
protected _updateFrameIndex(): this;
|
|
1743
1920
|
protected _process(delta: number): void;
|
|
1744
1921
|
protected _drawContent(): void;
|
|
1745
1922
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1746
1923
|
}
|
|
1747
1924
|
|
|
1748
|
-
interface
|
|
1749
|
-
pixelRatio?: number;
|
|
1750
|
-
src?: string;
|
|
1925
|
+
interface TextureRect2DProperties extends Node2DProperties {
|
|
1751
1926
|
}
|
|
1752
|
-
declare class
|
|
1753
|
-
|
|
1927
|
+
declare class TextureRect2D<T extends Texture2D = Texture2D> extends Node2D implements Rectangulable {
|
|
1928
|
+
texture?: T;
|
|
1929
|
+
getRect(): Rect2;
|
|
1930
|
+
protected _drawContent(): void;
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
interface Lottie2DProperties extends TextureRect2DProperties {
|
|
1754
1934
|
src: string;
|
|
1755
|
-
|
|
1756
|
-
|
|
1935
|
+
}
|
|
1936
|
+
declare class Lottie2D extends TextureRect2D {
|
|
1937
|
+
src: string;
|
|
1938
|
+
readonly texture: CanvasTexture;
|
|
1757
1939
|
animation?: AnimationItem;
|
|
1758
|
-
constructor(
|
|
1759
|
-
protected
|
|
1760
|
-
protected
|
|
1940
|
+
constructor(properties?: Partial<Lottie2DProperties>, children?: Node[]);
|
|
1941
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1942
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1761
1943
|
protected _load(): Promise<void>;
|
|
1762
1944
|
protected _process(delta: number): void;
|
|
1763
|
-
protected _drawContent(): void;
|
|
1764
1945
|
}
|
|
1765
1946
|
|
|
1766
|
-
interface
|
|
1767
|
-
|
|
1768
|
-
split?: boolean;
|
|
1947
|
+
interface Text2DProperties extends TextureRect2DProperties, Omit<TextOptions, 'style'> {
|
|
1948
|
+
split: boolean;
|
|
1769
1949
|
}
|
|
1770
1950
|
/**
|
|
1771
1951
|
* @example
|
|
@@ -1777,20 +1957,19 @@ interface Text2DOptions extends Node2DOptions, Omit<TextOptions, 'style'> {
|
|
|
1777
1957
|
* content: 'Text2D',
|
|
1778
1958
|
* })
|
|
1779
1959
|
*/
|
|
1780
|
-
declare class Text2D extends
|
|
1781
|
-
pixelRatio: number;
|
|
1960
|
+
declare class Text2D extends TextureRect2D<CanvasTexture> {
|
|
1782
1961
|
split: boolean;
|
|
1783
1962
|
content: TextOptions['content'];
|
|
1784
1963
|
effects?: TextOptions['effects'];
|
|
1785
1964
|
measureDom?: TextOptions['measureDom'];
|
|
1786
1965
|
fonts?: TextOptions['fonts'];
|
|
1966
|
+
texture: CanvasTexture;
|
|
1787
1967
|
text: Text;
|
|
1788
|
-
readonly texture: Texture<HTMLCanvasElement>;
|
|
1789
1968
|
protected _subTextsCount: number;
|
|
1790
|
-
constructor(
|
|
1791
|
-
protected
|
|
1969
|
+
constructor(properties?: Partial<Text2DProperties>, children?: Node[]);
|
|
1970
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1792
1971
|
protected _updateText(): void;
|
|
1793
|
-
protected
|
|
1972
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
|
|
1794
1973
|
protected _getSubTexts(): Text2D[];
|
|
1795
1974
|
protected _updateSubTexts(): void;
|
|
1796
1975
|
measure(): MeasureResult;
|
|
@@ -1798,92 +1977,81 @@ declare class Text2D extends Node2D {
|
|
|
1798
1977
|
protected _drawContent(): void;
|
|
1799
1978
|
}
|
|
1800
1979
|
|
|
1801
|
-
interface
|
|
1802
|
-
src
|
|
1980
|
+
interface Video2DProperties extends TextureRect2DProperties {
|
|
1981
|
+
src: string;
|
|
1803
1982
|
}
|
|
1804
|
-
declare class Video2D extends
|
|
1983
|
+
declare class Video2D extends TextureRect2D<VideoTexture> {
|
|
1805
1984
|
src: string;
|
|
1806
|
-
|
|
1807
|
-
get duration(): number;
|
|
1985
|
+
get videoDuration(): number;
|
|
1808
1986
|
protected _wait: Promise<void>;
|
|
1809
|
-
constructor(
|
|
1810
|
-
protected
|
|
1987
|
+
constructor(properties?: Partial<Video2DProperties>, children?: Node[]);
|
|
1988
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1811
1989
|
waitLoad(): Promise<void>;
|
|
1812
1990
|
protected _load(src: string): Promise<void>;
|
|
1813
|
-
protected _drawContent(): void;
|
|
1814
1991
|
protected _updateVideoCurrentTime(): void;
|
|
1815
1992
|
protected _process(delta: number): void;
|
|
1816
1993
|
}
|
|
1817
1994
|
|
|
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;
|
|
1995
|
+
declare const linear: (amount: number) => number;
|
|
1996
|
+
declare const ease: (amount: number) => number;
|
|
1997
|
+
declare const easeIn: (amount: number) => number;
|
|
1998
|
+
declare const easeOut: (amount: number) => number;
|
|
1999
|
+
declare const easeInOut: (amount: number) => number;
|
|
2000
|
+
declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (amount: number) => number;
|
|
2001
|
+
declare const timingFunctions: {
|
|
2002
|
+
linear: (amount: number) => number;
|
|
2003
|
+
ease: (amount: number) => number;
|
|
2004
|
+
easeIn: (amount: number) => number;
|
|
2005
|
+
easeOut: (amount: number) => number;
|
|
2006
|
+
easeInOut: (amount: number) => number;
|
|
2007
|
+
};
|
|
2008
|
+
type TimingFunctions = typeof timingFunctions;
|
|
2009
|
+
type Easing = keyof TimingFunctions | `cubic-bezier(${string})`;
|
|
2010
|
+
interface Keyframe {
|
|
2011
|
+
easing?: Easing;
|
|
2012
|
+
offset?: number;
|
|
2013
|
+
[property: string]: string | number | null | undefined;
|
|
1850
2014
|
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
2015
|
+
interface NormalizedKeyframe {
|
|
2016
|
+
easing: (amount: number) => number;
|
|
2017
|
+
offset: number;
|
|
2018
|
+
props: Record<string, any>;
|
|
1855
2019
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
text: TextLoader;
|
|
1864
|
-
texture: TextureLoader;
|
|
1865
|
-
video: VideoLoader;
|
|
2020
|
+
type AnimationMode = 'parent' | 'sibling';
|
|
2021
|
+
interface AnimationProperties extends TimelineNodeProperties {
|
|
2022
|
+
animationMode: AnimationMode;
|
|
2023
|
+
startTime: number;
|
|
2024
|
+
duration: number;
|
|
2025
|
+
loop: boolean;
|
|
2026
|
+
keyframes: Keyframe[];
|
|
1866
2027
|
}
|
|
1867
|
-
declare class
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
protected
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
protected
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2028
|
+
declare class Animation extends TimelineNode {
|
|
2029
|
+
animationMode: AnimationMode;
|
|
2030
|
+
loop: boolean;
|
|
2031
|
+
keyframes: Keyframe[];
|
|
2032
|
+
easing?: Easing;
|
|
2033
|
+
protected _keyframes: NormalizedKeyframe[];
|
|
2034
|
+
protected _isFirstUpdatePosition: boolean;
|
|
2035
|
+
protected _cachedProps: RawWeakMap<any, Map<string, any>>;
|
|
2036
|
+
protected _stoped: boolean;
|
|
2037
|
+
constructor(properties?: Partial<AnimationProperties>, children?: Node[]);
|
|
2038
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
2039
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
2040
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2041
|
+
protected _getTargets(): any[];
|
|
2042
|
+
protected _updateKeyframes(): void;
|
|
2043
|
+
commitStyles(): void;
|
|
2044
|
+
protected _updateCachedProps(): void;
|
|
2045
|
+
protected _parseEasing(easing: Easing | undefined): (amount: number) => number;
|
|
2046
|
+
protected _parseKeyframes(currentTime: number, startProps: Map<string, any>): [NormalizedKeyframe, NormalizedKeyframe] | null;
|
|
2047
|
+
protected _commitStyle(currentTime: number, target: any, startProps: Map<string, any>, previous: NormalizedKeyframe, current: NormalizedKeyframe): void;
|
|
2048
|
+
protected _getDiffValue(name: string, previous: string | undefined, current: string | undefined, weight: number, context: Record<string, any>): any;
|
|
2049
|
+
isPlaying(): boolean;
|
|
2050
|
+
play(): boolean;
|
|
2051
|
+
pause(): boolean;
|
|
2052
|
+
stop(): boolean;
|
|
2053
|
+
cancel(): void;
|
|
1885
2054
|
}
|
|
1886
|
-
declare const assets: Assets;
|
|
1887
2055
|
|
|
1888
2056
|
declare abstract class AudioProcessor {
|
|
1889
2057
|
destination: IAudioNode;
|
|
@@ -2122,7 +2290,7 @@ declare class WebAudio extends AudioPipeline {
|
|
|
2122
2290
|
|
|
2123
2291
|
type PlatformAudio = WebAudio | HTMLAudio;
|
|
2124
2292
|
type PlatformSound = WebSound | HTMLSound;
|
|
2125
|
-
declare class Audio extends
|
|
2293
|
+
declare class Audio extends TimelineNode {
|
|
2126
2294
|
protected static _soundPool: PlatformSound[];
|
|
2127
2295
|
protected _sounds: PlatformSound[];
|
|
2128
2296
|
/** PlatformAudio */
|
|
@@ -2135,7 +2303,7 @@ declare class Audio extends Node {
|
|
|
2135
2303
|
isLoaded: boolean;
|
|
2136
2304
|
get isPlayable(): boolean;
|
|
2137
2305
|
/** Duration */
|
|
2138
|
-
get
|
|
2306
|
+
get audioDuration(): number;
|
|
2139
2307
|
/** Volume */
|
|
2140
2308
|
protected _volume: number;
|
|
2141
2309
|
get volume(): number;
|
|
@@ -2155,14 +2323,11 @@ declare class Audio extends Node {
|
|
|
2155
2323
|
/** IsPlaying */
|
|
2156
2324
|
protected _isPlaying: boolean;
|
|
2157
2325
|
get isPlaying(): boolean;
|
|
2158
|
-
/** Paused */
|
|
2159
|
-
protected _paused: boolean;
|
|
2160
|
-
get paused(): boolean;
|
|
2161
|
-
set paused(val: boolean);
|
|
2162
2326
|
multiple: boolean;
|
|
2163
2327
|
start: number;
|
|
2164
2328
|
end: number;
|
|
2165
2329
|
constructor(src?: string);
|
|
2330
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2166
2331
|
load(): Promise<this>;
|
|
2167
2332
|
pause(): this;
|
|
2168
2333
|
resume(): this;
|
|
@@ -2183,20 +2348,20 @@ declare class Audio extends Node {
|
|
|
2183
2348
|
declare class AudioSpectrum extends Node2D {
|
|
2184
2349
|
}
|
|
2185
2350
|
|
|
2186
|
-
interface
|
|
2187
|
-
src
|
|
2188
|
-
gap
|
|
2189
|
-
color
|
|
2351
|
+
interface AudioWaveformProperties extends Node2DProperties {
|
|
2352
|
+
src: string;
|
|
2353
|
+
gap: number;
|
|
2354
|
+
color: string;
|
|
2190
2355
|
}
|
|
2191
2356
|
declare class AudioWaveform extends Node2D {
|
|
2192
2357
|
src?: string;
|
|
2193
2358
|
gap: number;
|
|
2194
2359
|
color: string;
|
|
2195
2360
|
protected _audioBuffer?: AudioBuffer;
|
|
2196
|
-
protected _src:
|
|
2361
|
+
protected _src: Texture2D<HTMLCanvasElement> | undefined;
|
|
2197
2362
|
protected _needsUpdateTexture: boolean;
|
|
2198
|
-
constructor(options?:
|
|
2199
|
-
protected
|
|
2363
|
+
constructor(options?: Partial<AudioWaveformProperties>);
|
|
2364
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2200
2365
|
_loadSrc(src: string): Promise<void>;
|
|
2201
2366
|
syncTexture(force?: boolean): void;
|
|
2202
2367
|
protected _process(delta: number): void;
|
|
@@ -2204,9 +2369,8 @@ declare class AudioWaveform extends Node2D {
|
|
|
2204
2369
|
}
|
|
2205
2370
|
|
|
2206
2371
|
type EffectMode = 'before' | 'parent' | 'children' | 'transition';
|
|
2207
|
-
interface EffectOptions extends
|
|
2372
|
+
interface EffectOptions extends TimelineNodeProperties {
|
|
2208
2373
|
mode?: EffectMode;
|
|
2209
|
-
duration?: number;
|
|
2210
2374
|
glsl?: string;
|
|
2211
2375
|
glslSrc?: string;
|
|
2212
2376
|
material?: Material;
|
|
@@ -2220,16 +2384,14 @@ interface EffectContext {
|
|
|
2220
2384
|
from?: Viewport;
|
|
2221
2385
|
to?: Viewport;
|
|
2222
2386
|
}
|
|
2223
|
-
declare class Effect extends
|
|
2387
|
+
declare class Effect extends TimelineNode {
|
|
2224
2388
|
material?: Material;
|
|
2225
2389
|
mode?: EffectMode;
|
|
2226
2390
|
glsl: string;
|
|
2227
2391
|
glslSrc: string;
|
|
2228
|
-
delay: number;
|
|
2229
|
-
duration: number;
|
|
2230
2392
|
protected get _mode(): EffectMode;
|
|
2231
2393
|
/** Viewports */
|
|
2232
|
-
readonly
|
|
2394
|
+
readonly viewport1: Viewport;
|
|
2233
2395
|
readonly viewport2: Viewport;
|
|
2234
2396
|
/** Render call */
|
|
2235
2397
|
protected _renderId: number;
|
|
@@ -2238,11 +2400,11 @@ declare class Effect extends Node {
|
|
|
2238
2400
|
protected _previousSibling?: Node;
|
|
2239
2401
|
protected _nextSibling?: Node;
|
|
2240
2402
|
constructor(options?: EffectOptions);
|
|
2241
|
-
protected
|
|
2242
|
-
protected
|
|
2243
|
-
protected
|
|
2244
|
-
protected _onProcessing
|
|
2245
|
-
protected _onNodeProcessed
|
|
2403
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2404
|
+
protected _treeEnter(tree: SceneTree): void;
|
|
2405
|
+
protected _treeExit(oldTree: SceneTree): void;
|
|
2406
|
+
protected _onProcessing(): void;
|
|
2407
|
+
protected _onNodeProcessed(node: Node): void;
|
|
2246
2408
|
protected _processParent(): void;
|
|
2247
2409
|
protected _processChildren(): void;
|
|
2248
2410
|
_onProcess(delta?: number): void;
|
|
@@ -2275,13 +2437,13 @@ declare class ColorAdjustEffect extends Effect {
|
|
|
2275
2437
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2276
2438
|
}
|
|
2277
2439
|
|
|
2278
|
-
interface
|
|
2440
|
+
interface ColorFilterEffectProperties {
|
|
2279
2441
|
filter?: string;
|
|
2280
2442
|
}
|
|
2281
2443
|
declare class ColorFilterEffect extends Effect {
|
|
2282
2444
|
filter: string;
|
|
2283
2445
|
protected _colorMatrix: ColorMatrix;
|
|
2284
|
-
constructor(
|
|
2446
|
+
constructor(properties?: Partial<ColorFilterEffectProperties>);
|
|
2285
2447
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2286
2448
|
static material: Material;
|
|
2287
2449
|
}
|
|
@@ -2310,26 +2472,6 @@ declare class ColorReplaceEffect extends Effect {
|
|
|
2310
2472
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2311
2473
|
}
|
|
2312
2474
|
|
|
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
2475
|
declare class EmbossEffect extends Effect {
|
|
2334
2476
|
strength: number;
|
|
2335
2477
|
constructor(strength?: number);
|
|
@@ -2340,7 +2482,7 @@ declare class EmbossEffect extends Effect {
|
|
|
2340
2482
|
declare class GlitchEffect extends Effect {
|
|
2341
2483
|
static material: Material;
|
|
2342
2484
|
protected _canvas: HTMLCanvasElement;
|
|
2343
|
-
protected _texture:
|
|
2485
|
+
protected _texture: Texture2D;
|
|
2344
2486
|
protected _sizes: Float32Array;
|
|
2345
2487
|
protected _offsets: Float32Array;
|
|
2346
2488
|
protected _redraw: boolean;
|
|
@@ -2385,11 +2527,11 @@ interface MaskEffectOptions extends EffectOptions {
|
|
|
2385
2527
|
src?: string;
|
|
2386
2528
|
}
|
|
2387
2529
|
declare class MaskEffect extends Effect {
|
|
2388
|
-
texture?:
|
|
2530
|
+
texture?: Texture2D<ImageBitmap>;
|
|
2389
2531
|
src: string;
|
|
2390
2532
|
constructor(options?: MaskEffectOptions);
|
|
2391
2533
|
load(): Promise<void>;
|
|
2392
|
-
protected
|
|
2534
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2393
2535
|
apply(renderer: WebGLRenderer, source: Viewport, context: EffectContext): void;
|
|
2394
2536
|
static material: Material;
|
|
2395
2537
|
}
|
|
@@ -2401,299 +2543,204 @@ declare class PixelateEffect extends Effect {
|
|
|
2401
2543
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2402
2544
|
}
|
|
2403
2545
|
|
|
2404
|
-
declare class
|
|
2405
|
-
static material: Material;
|
|
2406
|
-
blur:
|
|
2407
|
-
|
|
2408
|
-
apply(renderer: WebGLRenderer,
|
|
2546
|
+
declare class ShadowEffect extends Effect {
|
|
2547
|
+
static material: Material;
|
|
2548
|
+
blur: BlurEffect;
|
|
2549
|
+
viewport3: Viewport;
|
|
2550
|
+
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
declare class TiltShiftEffect extends Effect {
|
|
2554
|
+
static material: Material;
|
|
2555
|
+
blur: number;
|
|
2556
|
+
gradientBlur: number;
|
|
2557
|
+
apply(renderer: WebGLRenderer, target: Viewport): void;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
declare class TwistEffect extends Effect {
|
|
2561
|
+
static material: Material;
|
|
2562
|
+
radius?: number;
|
|
2563
|
+
angle: number;
|
|
2564
|
+
padding: number;
|
|
2565
|
+
offset?: number;
|
|
2566
|
+
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
declare class ZoomBlurEffect extends Effect {
|
|
2570
|
+
static material: Material;
|
|
2571
|
+
center?: number[];
|
|
2572
|
+
innerRadius: number;
|
|
2573
|
+
radius: number;
|
|
2574
|
+
strength: number;
|
|
2575
|
+
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
interface ControlEventMap extends CanvasItemEventMap, RectangulableEventMap {
|
|
2579
|
+
}
|
|
2580
|
+
interface ControlProperties extends CanvasItemProperties {
|
|
2581
|
+
}
|
|
2582
|
+
interface Control {
|
|
2583
|
+
on: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2584
|
+
off: (<K extends keyof ControlEventMap>(type: K, listener: ControlEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2585
|
+
emit: (<K extends keyof ControlEventMap>(type: K, ...args: Parameters<ControlEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
2586
|
+
}
|
|
2587
|
+
declare class Control extends CanvasItem implements Rectangulable {
|
|
2588
|
+
constructor(properties?: Partial<ControlProperties>, children?: Node[]);
|
|
2589
|
+
protected _parented(parent: any): void;
|
|
2590
|
+
protected _unparented(oldParent: any): void;
|
|
2591
|
+
protected _parentUpdateRect(): void;
|
|
2592
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2593
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2594
|
+
protected _guiInput(event: InputEvent, key: InputEventKey): void;
|
|
2595
|
+
getRect(): Rect2;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
interface RulerProperties extends ControlProperties {
|
|
2599
|
+
offsetX: number;
|
|
2600
|
+
offsetY: number;
|
|
2601
|
+
thickness: number;
|
|
2602
|
+
markHeight: number;
|
|
2603
|
+
color: string;
|
|
2604
|
+
markBackgroundColor: string;
|
|
2605
|
+
markColor: string;
|
|
2606
|
+
gap: number;
|
|
2607
|
+
scale: number;
|
|
2608
|
+
}
|
|
2609
|
+
declare class Ruler extends Control {
|
|
2610
|
+
offsetX: number;
|
|
2611
|
+
offsetY: number;
|
|
2612
|
+
thickness: number;
|
|
2613
|
+
markHeight: number;
|
|
2614
|
+
color: string;
|
|
2615
|
+
markBackgroundColor: string;
|
|
2616
|
+
markColor: string;
|
|
2617
|
+
gap: number;
|
|
2618
|
+
scale: number;
|
|
2619
|
+
texture: CanvasTexture;
|
|
2620
|
+
constructor(properties?: Partial<RulerProperties>, children?: Node[]);
|
|
2621
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2622
|
+
protected _updateStyleProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2623
|
+
protected _drawTexture(): void;
|
|
2624
|
+
protected _draw(): void;
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
interface ScrollBarProperties extends ControlProperties {
|
|
2628
|
+
direction: 'vertical' | 'horizontal';
|
|
2629
|
+
}
|
|
2630
|
+
declare class ScrollBar extends Control {
|
|
2631
|
+
direction: 'vertical' | 'horizontal';
|
|
2632
|
+
padding: number;
|
|
2633
|
+
constructor(properties: Partial<ScrollBarProperties>, children?: Node[]);
|
|
2634
|
+
protected _parentUpdateRect(): void;
|
|
2635
|
+
protected _guiInput(event: InputEvent, key: InputEventKey): void;
|
|
2636
|
+
protected _draw(): void;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
interface ScalerEventMap extends NodeEventMap {
|
|
2640
|
+
updateScale: (scale: number) => void;
|
|
2641
|
+
}
|
|
2642
|
+
interface ScalerProperties extends NodeProperties {
|
|
2643
|
+
}
|
|
2644
|
+
interface Scaler {
|
|
2645
|
+
on: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2646
|
+
off: (<K extends keyof ScalerEventMap>(type: K, listener: ScalerEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
2647
|
+
emit: (<K extends keyof ScalerEventMap>(type: K, ...args: Parameters<ScalerEventMap[K]>) => boolean) & ((type: string, ...args: any[]) => boolean);
|
|
2648
|
+
}
|
|
2649
|
+
declare class Scaler extends Node {
|
|
2650
|
+
scale: number;
|
|
2651
|
+
min: number;
|
|
2652
|
+
max: number;
|
|
2653
|
+
get target(): CanvasItem | undefined;
|
|
2654
|
+
constructor(properties?: Partial<ScalerProperties>, children?: Node[]);
|
|
2655
|
+
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2656
|
+
protected _updateScale(): void;
|
|
2657
|
+
protected _onWheel(e: WheelInputEvent): void;
|
|
2658
|
+
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2409
2659
|
}
|
|
2410
2660
|
|
|
2411
|
-
declare class
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
angle: number;
|
|
2415
|
-
padding: number;
|
|
2416
|
-
offset?: number;
|
|
2417
|
-
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2661
|
+
declare class GifLoader extends Loader {
|
|
2662
|
+
load: (url: string) => Promise<Image2DResource>;
|
|
2663
|
+
install(assets: Assets): this;
|
|
2418
2664
|
}
|
|
2419
2665
|
|
|
2420
|
-
declare class
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
innerRadius: number;
|
|
2424
|
-
radius: number;
|
|
2425
|
-
strength: number;
|
|
2426
|
-
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
2666
|
+
declare class JsonLoader extends Loader {
|
|
2667
|
+
load: (url: string) => Promise<Record<string, any>>;
|
|
2668
|
+
install(assets: Assets): this;
|
|
2427
2669
|
}
|
|
2428
2670
|
|
|
2429
|
-
|
|
2671
|
+
declare class LottieLoader extends Loader {
|
|
2672
|
+
load: (url: string, canvas: HTMLCanvasElement) => Promise<AnimationItem>;
|
|
2673
|
+
install(assets: Assets): this;
|
|
2674
|
+
}
|
|
2430
2675
|
|
|
2431
|
-
declare class
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
readonly cancelable = false;
|
|
2435
|
-
which: number;
|
|
2436
|
-
cancelBubble: boolean;
|
|
2437
|
-
returnValue: boolean;
|
|
2438
|
-
srcElement: EventTarget;
|
|
2439
|
-
readonly composed = false;
|
|
2440
|
-
/** The listeners of the event target that are being notified. */
|
|
2441
|
-
currentTarget: any;
|
|
2442
|
-
/** Flags whether the default response of the user agent was prevent through this event. */
|
|
2443
|
-
defaultPrevented: boolean;
|
|
2444
|
-
/**
|
|
2445
|
-
* The propagation phase.
|
|
2446
|
-
*/
|
|
2447
|
-
eventPhase: number;
|
|
2448
|
-
/** Flags whether this is a user-trusted event */
|
|
2449
|
-
isTrusted: boolean;
|
|
2450
|
-
/** The event target that this will be dispatched to. */
|
|
2451
|
-
target: any;
|
|
2452
|
-
/** The timestamp of when the event was created. */
|
|
2453
|
-
timeStamp: number;
|
|
2454
|
-
/** The type of event, e.g. {@code "mouseup"}. */
|
|
2455
|
-
type: string;
|
|
2456
|
-
/** The native event that caused the foremost original event. */
|
|
2457
|
-
nativeEvent: N;
|
|
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;
|
|
2676
|
+
declare class TextLoader extends Loader {
|
|
2677
|
+
load: (url: string) => Promise<string>;
|
|
2678
|
+
install(assets: Assets): this;
|
|
2496
2679
|
}
|
|
2497
2680
|
|
|
2498
|
-
declare class
|
|
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;
|
|
2681
|
+
declare class TextureLoader extends Loader {
|
|
2682
|
+
load: (url: string) => Promise<Texture2D<ImageBitmap>>;
|
|
2683
|
+
install(assets: Assets): this;
|
|
2564
2684
|
}
|
|
2565
2685
|
|
|
2566
|
-
declare class
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
/**
|
|
2570
|
-
* The unique identifier of the pointer.
|
|
2571
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
|
|
2572
|
-
*/
|
|
2573
|
-
pointerId: number;
|
|
2574
|
-
/**
|
|
2575
|
-
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
2576
|
-
* radiusX of TouchEvents will be represented by this value.
|
|
2577
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
|
|
2578
|
-
*/
|
|
2579
|
-
width: number;
|
|
2580
|
-
/**
|
|
2581
|
-
* The height of the pointer's contact along the y-axis, measured in CSS pixels.
|
|
2582
|
-
* radiusY of TouchEvents will be represented by this value.
|
|
2583
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
|
|
2584
|
-
*/
|
|
2585
|
-
height: number;
|
|
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[];
|
|
2686
|
+
declare class VideoLoader extends Loader {
|
|
2687
|
+
load: (url: string) => Promise<VideoTexture>;
|
|
2688
|
+
install(assets: Assets): this;
|
|
2635
2689
|
}
|
|
2636
2690
|
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2691
|
+
type AssetHandler = (url: string, options?: any) => any | Promise<any>;
|
|
2692
|
+
interface Assets {
|
|
2693
|
+
font: FontLoader;
|
|
2694
|
+
gif: GifLoader;
|
|
2695
|
+
json: JsonLoader;
|
|
2696
|
+
lottie: LottieLoader;
|
|
2697
|
+
text: TextLoader;
|
|
2698
|
+
texture: TextureLoader;
|
|
2699
|
+
video: VideoLoader;
|
|
2700
|
+
}
|
|
2701
|
+
declare class Assets {
|
|
2702
|
+
defaultHandler: AssetHandler;
|
|
2703
|
+
protected _handlers: Map<string, AssetHandler>;
|
|
2704
|
+
protected _handleing: Map<string, Promise<any>>;
|
|
2705
|
+
protected _handled: Map<string, any>;
|
|
2706
|
+
protected _gc: FinalizationRegistry<string> | undefined;
|
|
2707
|
+
constructor();
|
|
2708
|
+
use(loader: Loader): this;
|
|
2709
|
+
register(mimeType: string, handler: AssetHandler): this;
|
|
2710
|
+
fetch(url: string): Promise<Response>;
|
|
2711
|
+
protected _fixSVG(dataURI: string): string;
|
|
2712
|
+
fetchImageBitmap(url: string, options?: ImageBitmapOptions): Promise<ImageBitmap>;
|
|
2713
|
+
get<T>(id: string): T | undefined;
|
|
2714
|
+
set(id: string, value: any): void;
|
|
2715
|
+
loadBy<T>(id: string, handler: () => Promise<T>): Promise<T>;
|
|
2716
|
+
load<T>(url: string, options?: any): Promise<T>;
|
|
2717
|
+
waitUntilLoad(): Promise<void>;
|
|
2718
|
+
gc(): void;
|
|
2661
2719
|
}
|
|
2720
|
+
declare const assets: Assets;
|
|
2662
2721
|
|
|
2663
|
-
declare class
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
setTarget(target: HTMLElement): void;
|
|
2676
|
-
removeEventListeners(): void;
|
|
2677
|
-
addEventListeners(): void;
|
|
2678
|
-
protected normalize(event: WheelEvent): WheelEvent[];
|
|
2679
|
-
protected normalize(event: TouchEvent | PointerEvent | MouseEvent): PointerEvent[];
|
|
2680
|
-
protected cloneWheelEvent(nativeEvent: WheelEvent): WheelInputEvent;
|
|
2681
|
-
protected clonePointerEvent(nativeEvent: PointerEvent): PointerInputEvent;
|
|
2682
|
-
protected copyMouseEvent(event: MouseInputEvent, nativeEvent: MouseEvent): void;
|
|
2683
|
-
/**
|
|
2684
|
-
* Sets the current cursor mode, handling any callbacks or CSS style changes.
|
|
2685
|
-
* @param mode - cursor mode, a key from the cursorStyles dictionary
|
|
2686
|
-
*/
|
|
2687
|
-
setCursor(mode: string): void;
|
|
2688
|
-
mapPositionToPoint(point: {
|
|
2722
|
+
declare class CanvasEditor extends Control {
|
|
2723
|
+
name: string;
|
|
2724
|
+
hover: Node2D;
|
|
2725
|
+
selectionRect: Node2D;
|
|
2726
|
+
selector: Node2D;
|
|
2727
|
+
scaler: Scaler;
|
|
2728
|
+
xScrollBar: ScrollBar;
|
|
2729
|
+
yScrollBar: ScrollBar;
|
|
2730
|
+
drawboard: Node2D;
|
|
2731
|
+
ruler: Ruler;
|
|
2732
|
+
protected _pointerStart?: CanvasItemStyle;
|
|
2733
|
+
protected _pointerOffset?: {
|
|
2689
2734
|
x: number;
|
|
2690
2735
|
y: number;
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
protected
|
|
2695
|
-
protected
|
|
2696
|
-
protected
|
|
2736
|
+
};
|
|
2737
|
+
selected?: CanvasItem;
|
|
2738
|
+
constructor();
|
|
2739
|
+
protected _guiInput(event: InputEvent, key: InputEventKey): void;
|
|
2740
|
+
protected _onPointerdown(e: PointerInputEvent): void;
|
|
2741
|
+
protected _onPointermove(e: PointerInputEvent): void;
|
|
2742
|
+
protected _onPointerup(): void;
|
|
2743
|
+
protected _onHover(): void;
|
|
2697
2744
|
}
|
|
2698
2745
|
|
|
2699
2746
|
interface EngineOptions extends WebGLContextAttributes {
|
|
@@ -2701,8 +2748,10 @@ interface EngineOptions extends WebGLContextAttributes {
|
|
|
2701
2748
|
width?: number;
|
|
2702
2749
|
height?: number;
|
|
2703
2750
|
pixelRatio?: number;
|
|
2704
|
-
|
|
2751
|
+
backgroundColor?: ColorValue;
|
|
2705
2752
|
autoResize?: boolean;
|
|
2753
|
+
autoStart?: boolean;
|
|
2754
|
+
timeline?: Timeline;
|
|
2706
2755
|
}
|
|
2707
2756
|
interface EngineEventMap {
|
|
2708
2757
|
pointerdown: (ev: PointerInputEvent) => void;
|
|
@@ -2739,9 +2788,6 @@ declare class Engine extends SceneTree {
|
|
|
2739
2788
|
get height(): number;
|
|
2740
2789
|
get pixelRatio(): number;
|
|
2741
2790
|
set pixelRatio(val: number);
|
|
2742
|
-
protected _background: Color;
|
|
2743
|
-
get background(): ColorValue;
|
|
2744
|
-
set background(val: ColorValue);
|
|
2745
2791
|
protected _resizeObserver: ResizeObserver | undefined;
|
|
2746
2792
|
constructor(options?: EngineOptions);
|
|
2747
2793
|
protected _setupInput(): this;
|
|
@@ -2764,4 +2810,4 @@ interface RenderOptions {
|
|
|
2764
2810
|
}
|
|
2765
2811
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
2766
2812
|
|
|
2767
|
-
export {
|
|
2813
|
+
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 ControlEventMap, 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 ViewportEventMap, 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 };
|