modern-canvas 0.7.12 → 0.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +243 -127
- package/dist/index.d.cts +64 -22
- package/dist/index.d.mts +64 -22
- package/dist/index.d.ts +64 -22
- package/dist/index.js +32 -32
- package/dist/index.mjs +243 -127
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -460,6 +460,10 @@ declare class Projection2D extends Matrix3 {
|
|
|
460
460
|
protected _performUpdateArray(): void;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
+
interface Vector2Data {
|
|
464
|
+
x: number;
|
|
465
|
+
y: number;
|
|
466
|
+
}
|
|
463
467
|
/**
|
|
464
468
|
* Vector2
|
|
465
469
|
*/
|
|
@@ -480,7 +484,7 @@ declare class Vector2 extends Vector {
|
|
|
480
484
|
update(x: number, y: number): this;
|
|
481
485
|
getLength(): number;
|
|
482
486
|
getAngle(): number;
|
|
483
|
-
distanceTo(point:
|
|
487
|
+
distanceTo(point: Vector2Data): number;
|
|
484
488
|
normalize(): this;
|
|
485
489
|
static lerp(a: VectorLike, b: VectorLike, t: number): Vector2;
|
|
486
490
|
}
|
|
@@ -498,9 +502,16 @@ declare class Rect2 {
|
|
|
498
502
|
readonly position: Vector2;
|
|
499
503
|
readonly size: Vector2;
|
|
500
504
|
constructor(from: Rect2);
|
|
501
|
-
constructor(
|
|
505
|
+
constructor(pointArray: Vector2Data[]);
|
|
506
|
+
constructor(position: Vector2Data, size: Vector2Data);
|
|
502
507
|
constructor(x: number, y: number, width: number, height: number);
|
|
503
508
|
update(): this;
|
|
509
|
+
toMinmax(): {
|
|
510
|
+
minX: number;
|
|
511
|
+
minY: number;
|
|
512
|
+
maxX: number;
|
|
513
|
+
maxY: number;
|
|
514
|
+
};
|
|
504
515
|
toArray(): number[];
|
|
505
516
|
toJSON(): {
|
|
506
517
|
x: number;
|
|
@@ -510,7 +521,7 @@ declare class Rect2 {
|
|
|
510
521
|
};
|
|
511
522
|
}
|
|
512
523
|
|
|
513
|
-
interface
|
|
524
|
+
interface TransformObject {
|
|
514
525
|
a: number;
|
|
515
526
|
c: number;
|
|
516
527
|
tx: number;
|
|
@@ -519,6 +530,21 @@ interface Transform2DObject {
|
|
|
519
530
|
ty: number;
|
|
520
531
|
tz: number;
|
|
521
532
|
}
|
|
533
|
+
interface TransformableObject {
|
|
534
|
+
position: {
|
|
535
|
+
x: number;
|
|
536
|
+
y: number;
|
|
537
|
+
};
|
|
538
|
+
scale: {
|
|
539
|
+
x: number;
|
|
540
|
+
y: number;
|
|
541
|
+
};
|
|
542
|
+
skew: {
|
|
543
|
+
x: number;
|
|
544
|
+
y: number;
|
|
545
|
+
};
|
|
546
|
+
rotation: number;
|
|
547
|
+
}
|
|
522
548
|
/**
|
|
523
549
|
* Transform
|
|
524
550
|
*
|
|
@@ -552,10 +578,15 @@ declare class Transform2D extends Matrix3 {
|
|
|
552
578
|
protected _rotateToScale(rad: number): number;
|
|
553
579
|
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
554
580
|
makeRotation(theta: number): this;
|
|
555
|
-
|
|
581
|
+
decompose(pivot?: {
|
|
582
|
+
x: number;
|
|
583
|
+
y: number;
|
|
584
|
+
}, output?: TransformableObject): TransformableObject;
|
|
585
|
+
apply<P extends Vector2Data = Vector2>(pos: Vector2Data, newPos?: P): P;
|
|
556
586
|
inverse(): this;
|
|
587
|
+
applyInverse<P extends Vector2Data = Vector2>(pos: Vector2Data, newPos?: P): P;
|
|
557
588
|
isIdentity(): boolean;
|
|
558
|
-
toObject():
|
|
589
|
+
toObject(): TransformObject;
|
|
559
590
|
}
|
|
560
591
|
|
|
561
592
|
declare const DEG_TO_RAD: number;
|
|
@@ -1431,7 +1462,7 @@ declare class VideoTexture extends Texture2D<HTMLVideoElement> {
|
|
|
1431
1462
|
declare class ViewportTexture extends PixelsTexture {
|
|
1432
1463
|
}
|
|
1433
1464
|
|
|
1434
|
-
type
|
|
1465
|
+
type UvTransform = Transform2D | ((x: number, y: number) => [number, number]);
|
|
1435
1466
|
type VertTransform = Transform2D | (() => Transform2D);
|
|
1436
1467
|
interface CanvasBatchable extends Batchable2D {
|
|
1437
1468
|
type: 'stroke' | 'fill';
|
|
@@ -1442,12 +1473,12 @@ interface StrokeDraw extends Partial<CanvasBatchable> {
|
|
|
1442
1473
|
type: 'stroke';
|
|
1443
1474
|
path: Path2D;
|
|
1444
1475
|
style: LineStyle;
|
|
1445
|
-
uvTransform?:
|
|
1476
|
+
uvTransform?: UvTransform;
|
|
1446
1477
|
}
|
|
1447
1478
|
interface FillDraw extends Partial<CanvasBatchable> {
|
|
1448
1479
|
type: 'fill';
|
|
1449
1480
|
path: Path2D;
|
|
1450
|
-
uvTransform?:
|
|
1481
|
+
uvTransform?: UvTransform;
|
|
1451
1482
|
}
|
|
1452
1483
|
declare class CanvasContext extends Path2D {
|
|
1453
1484
|
fillStyle?: Color$1 | Texture2D;
|
|
@@ -1457,7 +1488,7 @@ declare class CanvasContext extends Path2D {
|
|
|
1457
1488
|
lineJoin?: LineJoin;
|
|
1458
1489
|
lineWidth?: number;
|
|
1459
1490
|
miterLimit?: number;
|
|
1460
|
-
uvTransform?:
|
|
1491
|
+
uvTransform?: UvTransform;
|
|
1461
1492
|
vertTransform?: VertTransform;
|
|
1462
1493
|
protected _defaultStyle: Texture2D<Texture2DSource>;
|
|
1463
1494
|
protected _draws: (StrokeDraw | FillDraw)[];
|
|
@@ -1469,7 +1500,7 @@ declare class CanvasContext extends Path2D {
|
|
|
1469
1500
|
copy(source: CanvasContext): this;
|
|
1470
1501
|
resetStatus(): void;
|
|
1471
1502
|
reset(): this;
|
|
1472
|
-
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, uvTransform?:
|
|
1503
|
+
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, uvTransform?: UvTransform): void;
|
|
1473
1504
|
toBatchables(): CanvasBatchable[];
|
|
1474
1505
|
}
|
|
1475
1506
|
|
|
@@ -1501,7 +1532,7 @@ interface Viewport {
|
|
|
1501
1532
|
declare class Viewport extends Node implements Rectangulable {
|
|
1502
1533
|
flipY: boolean;
|
|
1503
1534
|
readonly projection: Projection2D;
|
|
1504
|
-
readonly
|
|
1535
|
+
readonly worldTransform: Transform2D;
|
|
1505
1536
|
protected _framebufferIndex: number;
|
|
1506
1537
|
protected _framebuffers: ViewportFramebuffer[];
|
|
1507
1538
|
x: number;
|
|
@@ -1526,6 +1557,8 @@ declare class Viewport extends Node implements Rectangulable {
|
|
|
1526
1557
|
activateWithCopy(renderer: WebGLRenderer, target: Viewport): void;
|
|
1527
1558
|
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1528
1559
|
getRect(): Rect2;
|
|
1560
|
+
toGlobal<P extends Vector2Data = Vector2>(worldPos: Vector2Data, newPos?: P): P;
|
|
1561
|
+
toWorld<P extends Vector2Data = Vector2>(globalPos: Vector2Data, newPos?: P): P;
|
|
1529
1562
|
}
|
|
1530
1563
|
|
|
1531
1564
|
interface RenderCall {
|
|
@@ -1921,12 +1954,14 @@ declare class Node2D extends CanvasItem {
|
|
|
1921
1954
|
protected _transformVertices(vertices: Float32Array, vertTransform?: VertTransform): Float32Array;
|
|
1922
1955
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1923
1956
|
protected _process(delta: number): void;
|
|
1957
|
+
toLocal<P extends Vector2Data = Vector2>(globalPos: Vector2Data, newPos?: P): P;
|
|
1958
|
+
toGlobal<P extends Vector2Data = Vector2>(localPos: Vector2Data, newPos?: P): P;
|
|
1924
1959
|
}
|
|
1925
1960
|
|
|
1926
1961
|
interface Camera2DProperties extends Node2DProperties {
|
|
1927
1962
|
}
|
|
1928
1963
|
interface Camera2DEventMap extends Node2DEventMap {
|
|
1929
|
-
|
|
1964
|
+
updateWorldTransform: () => void;
|
|
1930
1965
|
}
|
|
1931
1966
|
interface Camera2D {
|
|
1932
1967
|
on: (<K extends keyof Camera2DEventMap>(type: K, listener: Camera2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
@@ -1950,7 +1985,7 @@ declare class Camera2D extends Node2D {
|
|
|
1950
1985
|
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1951
1986
|
protected _onWheel(e: WheelInputEvent): void;
|
|
1952
1987
|
updateTransform(): void;
|
|
1953
|
-
|
|
1988
|
+
updateWorldTransform(): void;
|
|
1954
1989
|
}
|
|
1955
1990
|
|
|
1956
1991
|
interface BaseElement2DFill extends NormalizedFill {
|
|
@@ -2062,7 +2097,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2062
2097
|
constructor(parent: BaseElement2D);
|
|
2063
2098
|
setProperties(properties?: Text$1): this;
|
|
2064
2099
|
protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2065
|
-
protected _updateText(): void;
|
|
2066
2100
|
setContent(content: TextContent): void;
|
|
2067
2101
|
measure(): MeasureResult;
|
|
2068
2102
|
updateMeasure(): this;
|
|
@@ -2125,16 +2159,24 @@ declare class BaseElement2D extends Node2D implements Rectangulable {
|
|
|
2125
2159
|
getTransform(cb?: (transform: Transform2D) => void): Transform2D;
|
|
2126
2160
|
updateGlobalTransform(): void;
|
|
2127
2161
|
getRect(): Rect2;
|
|
2162
|
+
protected _getPointArray(): Vector2Data[];
|
|
2163
|
+
getAabb(): Rect2;
|
|
2164
|
+
getGlobalAabb(): Rect2;
|
|
2165
|
+
getObb(): {
|
|
2166
|
+
rect: Rect2;
|
|
2167
|
+
rotation: number;
|
|
2168
|
+
};
|
|
2169
|
+
getGlobalObb(): {
|
|
2170
|
+
rect: Rect2;
|
|
2171
|
+
rotation: number;
|
|
2172
|
+
};
|
|
2128
2173
|
protected _updateOverflow(): void;
|
|
2129
2174
|
protected _draw(): void;
|
|
2130
2175
|
protected _drawContent(): void;
|
|
2131
2176
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
2132
2177
|
canPointerEvents(): boolean;
|
|
2133
2178
|
input(event: InputEvent, key: InputEventKey): void;
|
|
2134
|
-
protected
|
|
2135
|
-
x: number;
|
|
2136
|
-
y: number;
|
|
2137
|
-
}, key: InputEventKey): boolean;
|
|
2179
|
+
protected _positionInput(localPos: Vector2Data, key: InputEventKey): boolean;
|
|
2138
2180
|
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2139
2181
|
toJSON(): Record<string, any>;
|
|
2140
2182
|
}
|
|
@@ -2713,7 +2755,7 @@ interface ColorFilterEffectProperties {
|
|
|
2713
2755
|
}
|
|
2714
2756
|
declare class ColorFilterEffect extends Effect {
|
|
2715
2757
|
static material: Material;
|
|
2716
|
-
filter
|
|
2758
|
+
filter?: string;
|
|
2717
2759
|
protected _colorMatrix: ColorMatrix;
|
|
2718
2760
|
constructor(properties?: Partial<ColorFilterEffectProperties>, children?: Node[]);
|
|
2719
2761
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
@@ -2881,7 +2923,7 @@ interface MaskEffectProperties extends EffectProperties {
|
|
|
2881
2923
|
}
|
|
2882
2924
|
declare class MaskEffect extends Effect {
|
|
2883
2925
|
static material: Material;
|
|
2884
|
-
texture
|
|
2926
|
+
texture?: Texture2D<ImageBitmap>;
|
|
2885
2927
|
src: string;
|
|
2886
2928
|
constructor(properties?: Partial<MaskEffectProperties>, children?: Node[]);
|
|
2887
2929
|
load(): Promise<void>;
|
|
@@ -2932,7 +2974,7 @@ interface ZoomBlurEffectProperties extends EffectProperties {
|
|
|
2932
2974
|
}
|
|
2933
2975
|
declare class ZoomBlurEffect extends Effect {
|
|
2934
2976
|
static material: Material;
|
|
2935
|
-
center
|
|
2977
|
+
center?: number[];
|
|
2936
2978
|
innerRadius: number;
|
|
2937
2979
|
radius: number;
|
|
2938
2980
|
strength: number;
|
|
@@ -3269,4 +3311,4 @@ interface RenderOptions {
|
|
|
3269
3311
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3270
3312
|
|
|
3271
3313
|
export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, Camera2D, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GIFLoader, GaussianBlurEffect, Geometry, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JSONLoader, KawaseBlurEffect, KawaseTransition, KeyboardInputEvent, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, 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, SceneTree, ScrollBar, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, Window, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
|
|
3272
|
-
export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, Camera2DEventMap, Camera2DProperties, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DEventMap, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions,
|
|
3314
|
+
export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, Camera2DEventMap, Camera2DProperties, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DEventMap, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions, TransformObject, TransformRect2DProperties, TransformableObject, TransitionProperties, UvTransform, Vector2Data, VectorLike, VectorOperateOutput, VertTransform, VertexAttributeOptions, VertexBufferOptions, Video2DProperties, VideoTextureOptions, VideoTextureSource, ViewportEventMap, ViewportFramebuffer, WebGLBufferMeta, WebGLBufferOptions, WebGLBufferTarget, WebGLBufferUsage, WebGLDrawMode, WebGLDrawOptions, WebGLExtensions, WebGLFramebufferMeta, WebGLFramebufferOptions, WebGLProgramMeta, WebGLProgramOptions, WebGLTarget, WebGLTextureFilterMode, WebGLTextureLocation, WebGLTextureMeta, WebGLTextureOptions, WebGLTextureSource, WebGLTextureTarget, WebGLTextureWrapMode, WebGLVertexArrayObjectMeta, WebGLVertexArrayObjectOptions, WebGLVertexAttrib, WebGLVertexAttribType, WebGLViewport, XScrollBarProperties, YScrollBarProperties, ZoomBlurEffectProperties };
|
package/dist/index.d.mts
CHANGED
|
@@ -460,6 +460,10 @@ declare class Projection2D extends Matrix3 {
|
|
|
460
460
|
protected _performUpdateArray(): void;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
+
interface Vector2Data {
|
|
464
|
+
x: number;
|
|
465
|
+
y: number;
|
|
466
|
+
}
|
|
463
467
|
/**
|
|
464
468
|
* Vector2
|
|
465
469
|
*/
|
|
@@ -480,7 +484,7 @@ declare class Vector2 extends Vector {
|
|
|
480
484
|
update(x: number, y: number): this;
|
|
481
485
|
getLength(): number;
|
|
482
486
|
getAngle(): number;
|
|
483
|
-
distanceTo(point:
|
|
487
|
+
distanceTo(point: Vector2Data): number;
|
|
484
488
|
normalize(): this;
|
|
485
489
|
static lerp(a: VectorLike, b: VectorLike, t: number): Vector2;
|
|
486
490
|
}
|
|
@@ -498,9 +502,16 @@ declare class Rect2 {
|
|
|
498
502
|
readonly position: Vector2;
|
|
499
503
|
readonly size: Vector2;
|
|
500
504
|
constructor(from: Rect2);
|
|
501
|
-
constructor(
|
|
505
|
+
constructor(pointArray: Vector2Data[]);
|
|
506
|
+
constructor(position: Vector2Data, size: Vector2Data);
|
|
502
507
|
constructor(x: number, y: number, width: number, height: number);
|
|
503
508
|
update(): this;
|
|
509
|
+
toMinmax(): {
|
|
510
|
+
minX: number;
|
|
511
|
+
minY: number;
|
|
512
|
+
maxX: number;
|
|
513
|
+
maxY: number;
|
|
514
|
+
};
|
|
504
515
|
toArray(): number[];
|
|
505
516
|
toJSON(): {
|
|
506
517
|
x: number;
|
|
@@ -510,7 +521,7 @@ declare class Rect2 {
|
|
|
510
521
|
};
|
|
511
522
|
}
|
|
512
523
|
|
|
513
|
-
interface
|
|
524
|
+
interface TransformObject {
|
|
514
525
|
a: number;
|
|
515
526
|
c: number;
|
|
516
527
|
tx: number;
|
|
@@ -519,6 +530,21 @@ interface Transform2DObject {
|
|
|
519
530
|
ty: number;
|
|
520
531
|
tz: number;
|
|
521
532
|
}
|
|
533
|
+
interface TransformableObject {
|
|
534
|
+
position: {
|
|
535
|
+
x: number;
|
|
536
|
+
y: number;
|
|
537
|
+
};
|
|
538
|
+
scale: {
|
|
539
|
+
x: number;
|
|
540
|
+
y: number;
|
|
541
|
+
};
|
|
542
|
+
skew: {
|
|
543
|
+
x: number;
|
|
544
|
+
y: number;
|
|
545
|
+
};
|
|
546
|
+
rotation: number;
|
|
547
|
+
}
|
|
522
548
|
/**
|
|
523
549
|
* Transform
|
|
524
550
|
*
|
|
@@ -552,10 +578,15 @@ declare class Transform2D extends Matrix3 {
|
|
|
552
578
|
protected _rotateToScale(rad: number): number;
|
|
553
579
|
protected _rotate3d(x: number, y: number, z: number, rad: number): number[];
|
|
554
580
|
makeRotation(theta: number): this;
|
|
555
|
-
|
|
581
|
+
decompose(pivot?: {
|
|
582
|
+
x: number;
|
|
583
|
+
y: number;
|
|
584
|
+
}, output?: TransformableObject): TransformableObject;
|
|
585
|
+
apply<P extends Vector2Data = Vector2>(pos: Vector2Data, newPos?: P): P;
|
|
556
586
|
inverse(): this;
|
|
587
|
+
applyInverse<P extends Vector2Data = Vector2>(pos: Vector2Data, newPos?: P): P;
|
|
557
588
|
isIdentity(): boolean;
|
|
558
|
-
toObject():
|
|
589
|
+
toObject(): TransformObject;
|
|
559
590
|
}
|
|
560
591
|
|
|
561
592
|
declare const DEG_TO_RAD: number;
|
|
@@ -1431,7 +1462,7 @@ declare class VideoTexture extends Texture2D<HTMLVideoElement> {
|
|
|
1431
1462
|
declare class ViewportTexture extends PixelsTexture {
|
|
1432
1463
|
}
|
|
1433
1464
|
|
|
1434
|
-
type
|
|
1465
|
+
type UvTransform = Transform2D | ((x: number, y: number) => [number, number]);
|
|
1435
1466
|
type VertTransform = Transform2D | (() => Transform2D);
|
|
1436
1467
|
interface CanvasBatchable extends Batchable2D {
|
|
1437
1468
|
type: 'stroke' | 'fill';
|
|
@@ -1442,12 +1473,12 @@ interface StrokeDraw extends Partial<CanvasBatchable> {
|
|
|
1442
1473
|
type: 'stroke';
|
|
1443
1474
|
path: Path2D;
|
|
1444
1475
|
style: LineStyle;
|
|
1445
|
-
uvTransform?:
|
|
1476
|
+
uvTransform?: UvTransform;
|
|
1446
1477
|
}
|
|
1447
1478
|
interface FillDraw extends Partial<CanvasBatchable> {
|
|
1448
1479
|
type: 'fill';
|
|
1449
1480
|
path: Path2D;
|
|
1450
|
-
uvTransform?:
|
|
1481
|
+
uvTransform?: UvTransform;
|
|
1451
1482
|
}
|
|
1452
1483
|
declare class CanvasContext extends Path2D {
|
|
1453
1484
|
fillStyle?: Color$1 | Texture2D;
|
|
@@ -1457,7 +1488,7 @@ declare class CanvasContext extends Path2D {
|
|
|
1457
1488
|
lineJoin?: LineJoin;
|
|
1458
1489
|
lineWidth?: number;
|
|
1459
1490
|
miterLimit?: number;
|
|
1460
|
-
uvTransform?:
|
|
1491
|
+
uvTransform?: UvTransform;
|
|
1461
1492
|
vertTransform?: VertTransform;
|
|
1462
1493
|
protected _defaultStyle: Texture2D<Texture2DSource>;
|
|
1463
1494
|
protected _draws: (StrokeDraw | FillDraw)[];
|
|
@@ -1469,7 +1500,7 @@ declare class CanvasContext extends Path2D {
|
|
|
1469
1500
|
copy(source: CanvasContext): this;
|
|
1470
1501
|
resetStatus(): void;
|
|
1471
1502
|
reset(): this;
|
|
1472
|
-
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, uvTransform?:
|
|
1503
|
+
buildUvs(start: number, vertices: number[], uvs: number[], texture?: Texture2D, uvTransform?: UvTransform): void;
|
|
1473
1504
|
toBatchables(): CanvasBatchable[];
|
|
1474
1505
|
}
|
|
1475
1506
|
|
|
@@ -1501,7 +1532,7 @@ interface Viewport {
|
|
|
1501
1532
|
declare class Viewport extends Node implements Rectangulable {
|
|
1502
1533
|
flipY: boolean;
|
|
1503
1534
|
readonly projection: Projection2D;
|
|
1504
|
-
readonly
|
|
1535
|
+
readonly worldTransform: Transform2D;
|
|
1505
1536
|
protected _framebufferIndex: number;
|
|
1506
1537
|
protected _framebuffers: ViewportFramebuffer[];
|
|
1507
1538
|
x: number;
|
|
@@ -1526,6 +1557,8 @@ declare class Viewport extends Node implements Rectangulable {
|
|
|
1526
1557
|
activateWithCopy(renderer: WebGLRenderer, target: Viewport): void;
|
|
1527
1558
|
render(renderer: WebGLRenderer, next?: () => void): void;
|
|
1528
1559
|
getRect(): Rect2;
|
|
1560
|
+
toGlobal<P extends Vector2Data = Vector2>(worldPos: Vector2Data, newPos?: P): P;
|
|
1561
|
+
toWorld<P extends Vector2Data = Vector2>(globalPos: Vector2Data, newPos?: P): P;
|
|
1529
1562
|
}
|
|
1530
1563
|
|
|
1531
1564
|
interface RenderCall {
|
|
@@ -1921,12 +1954,14 @@ declare class Node2D extends CanvasItem {
|
|
|
1921
1954
|
protected _transformVertices(vertices: Float32Array, vertTransform?: VertTransform): Float32Array;
|
|
1922
1955
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1923
1956
|
protected _process(delta: number): void;
|
|
1957
|
+
toLocal<P extends Vector2Data = Vector2>(globalPos: Vector2Data, newPos?: P): P;
|
|
1958
|
+
toGlobal<P extends Vector2Data = Vector2>(localPos: Vector2Data, newPos?: P): P;
|
|
1924
1959
|
}
|
|
1925
1960
|
|
|
1926
1961
|
interface Camera2DProperties extends Node2DProperties {
|
|
1927
1962
|
}
|
|
1928
1963
|
interface Camera2DEventMap extends Node2DEventMap {
|
|
1929
|
-
|
|
1964
|
+
updateWorldTransform: () => void;
|
|
1930
1965
|
}
|
|
1931
1966
|
interface Camera2D {
|
|
1932
1967
|
on: (<K extends keyof Camera2DEventMap>(type: K, listener: Camera2DEventMap[K], options?: EventListenerOptions) => this) & ((type: string, listener: EventListenerValue, options?: EventListenerOptions) => this);
|
|
@@ -1950,7 +1985,7 @@ declare class Camera2D extends Node2D {
|
|
|
1950
1985
|
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
1951
1986
|
protected _onWheel(e: WheelInputEvent): void;
|
|
1952
1987
|
updateTransform(): void;
|
|
1953
|
-
|
|
1988
|
+
updateWorldTransform(): void;
|
|
1954
1989
|
}
|
|
1955
1990
|
|
|
1956
1991
|
interface BaseElement2DFill extends NormalizedFill {
|
|
@@ -2062,7 +2097,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2062
2097
|
constructor(parent: BaseElement2D);
|
|
2063
2098
|
setProperties(properties?: Text$1): this;
|
|
2064
2099
|
protected _updateProperty(key: string, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
2065
|
-
protected _updateText(): void;
|
|
2066
2100
|
setContent(content: TextContent): void;
|
|
2067
2101
|
measure(): MeasureResult;
|
|
2068
2102
|
updateMeasure(): this;
|
|
@@ -2125,16 +2159,24 @@ declare class BaseElement2D extends Node2D implements Rectangulable {
|
|
|
2125
2159
|
getTransform(cb?: (transform: Transform2D) => void): Transform2D;
|
|
2126
2160
|
updateGlobalTransform(): void;
|
|
2127
2161
|
getRect(): Rect2;
|
|
2162
|
+
protected _getPointArray(): Vector2Data[];
|
|
2163
|
+
getAabb(): Rect2;
|
|
2164
|
+
getGlobalAabb(): Rect2;
|
|
2165
|
+
getObb(): {
|
|
2166
|
+
rect: Rect2;
|
|
2167
|
+
rotation: number;
|
|
2168
|
+
};
|
|
2169
|
+
getGlobalObb(): {
|
|
2170
|
+
rect: Rect2;
|
|
2171
|
+
rotation: number;
|
|
2172
|
+
};
|
|
2128
2173
|
protected _updateOverflow(): void;
|
|
2129
2174
|
protected _draw(): void;
|
|
2130
2175
|
protected _drawContent(): void;
|
|
2131
2176
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
2132
2177
|
canPointerEvents(): boolean;
|
|
2133
2178
|
input(event: InputEvent, key: InputEventKey): void;
|
|
2134
|
-
protected
|
|
2135
|
-
x: number;
|
|
2136
|
-
y: number;
|
|
2137
|
-
}, key: InputEventKey): boolean;
|
|
2179
|
+
protected _positionInput(localPos: Vector2Data, key: InputEventKey): boolean;
|
|
2138
2180
|
protected _input(event: InputEvent, key: InputEventKey): void;
|
|
2139
2181
|
toJSON(): Record<string, any>;
|
|
2140
2182
|
}
|
|
@@ -2713,7 +2755,7 @@ interface ColorFilterEffectProperties {
|
|
|
2713
2755
|
}
|
|
2714
2756
|
declare class ColorFilterEffect extends Effect {
|
|
2715
2757
|
static material: Material;
|
|
2716
|
-
filter
|
|
2758
|
+
filter?: string;
|
|
2717
2759
|
protected _colorMatrix: ColorMatrix;
|
|
2718
2760
|
constructor(properties?: Partial<ColorFilterEffectProperties>, children?: Node[]);
|
|
2719
2761
|
apply(renderer: WebGLRenderer, source: Viewport): void;
|
|
@@ -2881,7 +2923,7 @@ interface MaskEffectProperties extends EffectProperties {
|
|
|
2881
2923
|
}
|
|
2882
2924
|
declare class MaskEffect extends Effect {
|
|
2883
2925
|
static material: Material;
|
|
2884
|
-
texture
|
|
2926
|
+
texture?: Texture2D<ImageBitmap>;
|
|
2885
2927
|
src: string;
|
|
2886
2928
|
constructor(properties?: Partial<MaskEffectProperties>, children?: Node[]);
|
|
2887
2929
|
load(): Promise<void>;
|
|
@@ -2932,7 +2974,7 @@ interface ZoomBlurEffectProperties extends EffectProperties {
|
|
|
2932
2974
|
}
|
|
2933
2975
|
declare class ZoomBlurEffect extends Effect {
|
|
2934
2976
|
static material: Material;
|
|
2935
|
-
center
|
|
2977
|
+
center?: number[];
|
|
2936
2978
|
innerRadius: number;
|
|
2937
2979
|
radius: number;
|
|
2938
2980
|
strength: number;
|
|
@@ -3269,4 +3311,4 @@ interface RenderOptions {
|
|
|
3269
3311
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3270
3312
|
|
|
3271
3313
|
export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, Camera2D, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GIFLoader, GaussianBlurEffect, Geometry, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JSONLoader, KawaseBlurEffect, KawaseTransition, KeyboardInputEvent, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, 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, SceneTree, ScrollBar, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, Window, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
|
|
3272
|
-
export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, Camera2DEventMap, Camera2DProperties, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DEventMap, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions,
|
|
3314
|
+
export type { AnimationEffectMode, AnimationProperties, AssetHandler, AudioWaveformProperties, BaseElement2DEventMap, BaseElement2DProperties, BaseElement2DStyleProperties, Batchable2D, CSSFilterKey, CSSFilters, Camera2DEventMap, Camera2DProperties, CanvasBatchable, CanvasItemEventMap, CanvasItemProperties, ColorAdjustEffectProperties, ColorFilterEffectProperties, ColorOverlayEffectProperties, ColorRemoveEffectProperties, ColorReplaceEffectProperties, ComputedLayout, ControlEventMap, ControlProperties, CoreObjectEventMap, CssFunction, CssFunctionArg, Cursor, CustomPropertyAccessor, DropShadowEffectProperties, Easing, EffectContext, EffectMode, EffectProperties, Element2DEventMap, Element2DProperties, Element2DStyleProperties, EmbossEffectProperties, EngineOptions, FillDraw, FlexBaseElement2DEventMap, FlexElement2DProperties, FlexElement2DStyleProperties, GaussianBlurEffectProperties, GeometryOptions, GlitchEffectProperties, GodrayEffectProperties, IAudioContext, IAudioNode, IPlayOptions, Image2DProperties, ImageFrame, ImageTextureOptions, IndexBufferOptions, InputEventKey, InputEventMap, InternalMode, KawaseBlurEffectProperties, Keyframe, Lottie2DProperties, MainLoopEventMap, MaskColor, MaskData, MaskEffectProperties, MaskObject, MaskRect, Maskable, MaterialOptions, MatrixLike, MatrixOperateOutput, Node2DEventMap, Node2DProperties, NodeEventMap, NodeProperties, NormalizedKeyframe, OutlineEffectProperties, PixelateEffectProperties, PlatformAudio, PlatformSound, ProcessMode, ProcessSortMode, RangeProperties, Rectangulable, RectangulableEventMap, RefCountedEventMap, RenderMode, RenderOptions, Renderable, ResourceEventMap, RulerProperties, ScalerEventMap, ScalerProperties, SceneTreeEventMap, ScrollBarProperties, StrokeDraw, Texture2DFilterMode, Texture2DPixelsSource, Texture2DSource, Texture2DWrapMode, TextureRect2DProperties, TimelineEventMap, TimelineNodeEventMap, TimelineNodeProperties, TimelineProperties, TimingFunctions, TransformObject, TransformRect2DProperties, TransformableObject, TransitionProperties, UvTransform, Vector2Data, VectorLike, VectorOperateOutput, VertTransform, VertexAttributeOptions, VertexBufferOptions, Video2DProperties, VideoTextureOptions, VideoTextureSource, ViewportEventMap, ViewportFramebuffer, WebGLBufferMeta, WebGLBufferOptions, WebGLBufferTarget, WebGLBufferUsage, WebGLDrawMode, WebGLDrawOptions, WebGLExtensions, WebGLFramebufferMeta, WebGLFramebufferOptions, WebGLProgramMeta, WebGLProgramOptions, WebGLTarget, WebGLTextureFilterMode, WebGLTextureLocation, WebGLTextureMeta, WebGLTextureOptions, WebGLTextureSource, WebGLTextureTarget, WebGLTextureWrapMode, WebGLVertexArrayObjectMeta, WebGLVertexArrayObjectOptions, WebGLVertexAttrib, WebGLVertexAttribType, WebGLViewport, XScrollBarProperties, YScrollBarProperties, ZoomBlurEffectProperties };
|