modern-canvas 0.4.5 → 0.4.7
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 +70 -47
- package/dist/index.d.cts +8 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +30 -30
- package/dist/index.mjs +70 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6139,6 +6139,7 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
|
|
|
6139
6139
|
this.computedDuration = parent?.computedDuration ? Math.min(this._startTime + this.duration, parent.endTime) - this._startTime : this.duration;
|
|
6140
6140
|
this._currentTime = this.timelineCurrentTime - this._startTime;
|
|
6141
6141
|
this.emit("updateCurrentTime", this._currentTime);
|
|
6142
|
+
this.insideTimeRange = this.isInsideTimeRange();
|
|
6142
6143
|
}
|
|
6143
6144
|
}
|
|
6144
6145
|
_process(delta) {
|
|
@@ -6155,6 +6156,9 @@ __decorateClass$H([
|
|
|
6155
6156
|
__decorateClass$H([
|
|
6156
6157
|
property({ default: false })
|
|
6157
6158
|
], exports.TimelineNode.prototype, "paused", 2);
|
|
6159
|
+
__decorateClass$H([
|
|
6160
|
+
protectedProperty()
|
|
6161
|
+
], exports.TimelineNode.prototype, "insideTimeRange", 2);
|
|
6158
6162
|
exports.TimelineNode = __decorateClass$H([
|
|
6159
6163
|
customNode("TimelineNode")
|
|
6160
6164
|
], exports.TimelineNode);
|
|
@@ -7252,7 +7256,7 @@ exports.GlitchEffect = class GlitchEffect extends exports.Effect {
|
|
|
7252
7256
|
_texture;
|
|
7253
7257
|
_sizes;
|
|
7254
7258
|
_offsets;
|
|
7255
|
-
|
|
7259
|
+
_needsRedraw = false;
|
|
7256
7260
|
slices = 10;
|
|
7257
7261
|
sampleSize = 512;
|
|
7258
7262
|
offset = 100;
|
|
@@ -7290,8 +7294,8 @@ exports.GlitchEffect = class GlitchEffect extends exports.Effect {
|
|
|
7290
7294
|
texture.requestUpload();
|
|
7291
7295
|
}
|
|
7292
7296
|
apply(renderer, source) {
|
|
7293
|
-
if (!this.
|
|
7294
|
-
this.
|
|
7297
|
+
if (!this._needsRedraw) {
|
|
7298
|
+
this._needsRedraw = true;
|
|
7295
7299
|
this.redraw();
|
|
7296
7300
|
}
|
|
7297
7301
|
const width = source.width;
|
|
@@ -8040,6 +8044,7 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
8040
8044
|
this._updateGlobalOpacity();
|
|
8041
8045
|
break;
|
|
8042
8046
|
case "visible":
|
|
8047
|
+
case "insideTimeRange":
|
|
8043
8048
|
this._updateGlobalVisible();
|
|
8044
8049
|
break;
|
|
8045
8050
|
}
|
|
@@ -8070,7 +8075,7 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
8070
8075
|
}
|
|
8071
8076
|
_updateGlobalVisible() {
|
|
8072
8077
|
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
8073
|
-
this._globalVisible = this.
|
|
8078
|
+
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
8074
8079
|
}
|
|
8075
8080
|
_updateGlobalOpacity() {
|
|
8076
8081
|
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
@@ -8080,23 +8085,28 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
8080
8085
|
this.requestRepaint();
|
|
8081
8086
|
}
|
|
8082
8087
|
}
|
|
8088
|
+
_draw() {
|
|
8089
|
+
this.emit("draw");
|
|
8090
|
+
}
|
|
8091
|
+
_redraw() {
|
|
8092
|
+
this._tree?.log(this.name, "redrawing");
|
|
8093
|
+
this._draw();
|
|
8094
|
+
return this.context.toBatchables();
|
|
8095
|
+
}
|
|
8083
8096
|
_relayout(batchables) {
|
|
8084
|
-
|
|
8097
|
+
this._tree?.log(this.name, "relayouting");
|
|
8098
|
+
return batchables;
|
|
8085
8099
|
}
|
|
8086
8100
|
_repaint(batchables) {
|
|
8101
|
+
this._tree?.log(this.name, "repainting");
|
|
8087
8102
|
return batchables.map((batchable) => {
|
|
8088
8103
|
return {
|
|
8089
8104
|
...batchable,
|
|
8090
8105
|
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
8091
|
-
// backgroundColor: this.style.getComputedBackgroundColor().abgr,
|
|
8092
|
-
// colorMatrix: colorMatrix.toMatrix4().toArray(true),
|
|
8093
|
-
// colorMatrixOffset: colorMatrix.toVector4().toArray(),
|
|
8094
8106
|
blendMode: this.blendMode
|
|
8095
8107
|
};
|
|
8096
8108
|
});
|
|
8097
8109
|
}
|
|
8098
|
-
_draw() {
|
|
8099
|
-
}
|
|
8100
8110
|
_update() {
|
|
8101
8111
|
const parent = this.getParent();
|
|
8102
8112
|
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
@@ -8105,20 +8115,25 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
|
|
|
8105
8115
|
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
8106
8116
|
this._updateGlobalOpacity();
|
|
8107
8117
|
}
|
|
8118
|
+
const redrawing = this._redrawing;
|
|
8119
|
+
let relayouting = this._relayouting;
|
|
8120
|
+
let repainting = this._repainting;
|
|
8108
8121
|
let batchables;
|
|
8109
|
-
if (
|
|
8110
|
-
this.
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8122
|
+
if (redrawing) {
|
|
8123
|
+
this._originalBatchables = this._redraw();
|
|
8124
|
+
relayouting = true;
|
|
8125
|
+
}
|
|
8126
|
+
if (relayouting) {
|
|
8127
|
+
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
8128
|
+
repainting = true;
|
|
8129
|
+
}
|
|
8130
|
+
if (repainting) {
|
|
8131
|
+
batchables = this._repaint(this._layoutedBatchables);
|
|
8132
|
+
}
|
|
8133
|
+
if (redrawing) {
|
|
8114
8134
|
if (this._resetContext) {
|
|
8115
8135
|
this.context.reset();
|
|
8116
8136
|
}
|
|
8117
|
-
} else if (this._relayouting) {
|
|
8118
|
-
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
8119
|
-
batchables = this._layoutedBatchables;
|
|
8120
|
-
} else if (this._repainting) {
|
|
8121
|
-
batchables = this._repaint(this._layoutedBatchables);
|
|
8122
8137
|
}
|
|
8123
8138
|
if (batchables) {
|
|
8124
8139
|
this._batchables = batchables;
|
|
@@ -8282,6 +8297,11 @@ class SceneTree extends MainLoop {
|
|
|
8282
8297
|
break;
|
|
8283
8298
|
}
|
|
8284
8299
|
}
|
|
8300
|
+
log(...args) {
|
|
8301
|
+
if (this.debug) {
|
|
8302
|
+
console.log(`[modern-canvas]`, ...args);
|
|
8303
|
+
}
|
|
8304
|
+
}
|
|
8285
8305
|
_render(renderer, delta = 0) {
|
|
8286
8306
|
this.timeline.addTime(delta);
|
|
8287
8307
|
this.emit("processing");
|
|
@@ -8327,6 +8347,9 @@ __decorateClass$r([
|
|
|
8327
8347
|
__decorateClass$r([
|
|
8328
8348
|
property()
|
|
8329
8349
|
], SceneTree.prototype, "backgroundColor");
|
|
8350
|
+
__decorateClass$r([
|
|
8351
|
+
protectedProperty({ default: false })
|
|
8352
|
+
], SceneTree.prototype, "debug");
|
|
8330
8353
|
|
|
8331
8354
|
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
8332
8355
|
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
@@ -8662,18 +8685,16 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
|
|
|
8662
8685
|
_relayout(batchables) {
|
|
8663
8686
|
this._updateTransform();
|
|
8664
8687
|
this._updateGlobalTransform();
|
|
8665
|
-
return super._relayout(
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
})
|
|
8672
|
-
);
|
|
8688
|
+
return super._relayout(batchables).map((batchable) => {
|
|
8689
|
+
return {
|
|
8690
|
+
...batchable,
|
|
8691
|
+
vertices: this._transformVertices(batchable.vertices)
|
|
8692
|
+
};
|
|
8693
|
+
});
|
|
8673
8694
|
}
|
|
8674
8695
|
_process(delta) {
|
|
8675
8696
|
const parent = this.getParent();
|
|
8676
|
-
if (parent?.
|
|
8697
|
+
if (this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
|
|
8677
8698
|
this.requestRelayout();
|
|
8678
8699
|
}
|
|
8679
8700
|
super._process(delta);
|
|
@@ -8887,6 +8908,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8887
8908
|
}
|
|
8888
8909
|
}
|
|
8889
8910
|
_draw() {
|
|
8911
|
+
super._draw();
|
|
8890
8912
|
this._drawBackground();
|
|
8891
8913
|
this._drawContent();
|
|
8892
8914
|
this._drawBorder();
|
|
@@ -8942,14 +8964,12 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
8942
8964
|
}
|
|
8943
8965
|
_repaint(batchables) {
|
|
8944
8966
|
const colorMatrix = parseCSSFilter(this.style.filter);
|
|
8945
|
-
return batchables.map((batchable) => {
|
|
8967
|
+
return super._repaint(batchables).map((batchable) => {
|
|
8946
8968
|
return {
|
|
8947
8969
|
...batchable,
|
|
8948
8970
|
backgroundColor: this.style.getComputedBackgroundColor().abgr,
|
|
8949
|
-
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
8950
8971
|
colorMatrix: colorMatrix.toMatrix4().toArray(true),
|
|
8951
|
-
colorMatrixOffset: colorMatrix.toVector4().toArray()
|
|
8952
|
-
blendMode: this.blendMode
|
|
8972
|
+
colorMatrixOffset: colorMatrix.toVector4().toArray()
|
|
8953
8973
|
};
|
|
8954
8974
|
});
|
|
8955
8975
|
}
|
|
@@ -13044,6 +13064,7 @@ class Engine extends SceneTree {
|
|
|
13044
13064
|
}) : void 0;
|
|
13045
13065
|
constructor(options = {}) {
|
|
13046
13066
|
const {
|
|
13067
|
+
debug = false,
|
|
13047
13068
|
view,
|
|
13048
13069
|
width,
|
|
13049
13070
|
height,
|
|
@@ -13055,6 +13076,7 @@ class Engine extends SceneTree {
|
|
|
13055
13076
|
...glOptions
|
|
13056
13077
|
} = options;
|
|
13057
13078
|
super(timeline);
|
|
13079
|
+
this.debug = debug;
|
|
13058
13080
|
this.renderer = new WebGLRenderer(view, {
|
|
13059
13081
|
...defaultOptions,
|
|
13060
13082
|
...glOptions
|
|
@@ -13142,25 +13164,25 @@ class Engine extends SceneTree {
|
|
|
13142
13164
|
}
|
|
13143
13165
|
toCanvas2D() {
|
|
13144
13166
|
const imageData = this.toImageData();
|
|
13145
|
-
const
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
const
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13167
|
+
const canvas1 = document.createElement("canvas");
|
|
13168
|
+
canvas1.width = imageData.width;
|
|
13169
|
+
canvas1.height = imageData.height;
|
|
13170
|
+
canvas1.getContext("2d")?.putImageData(imageData, 0, 0);
|
|
13171
|
+
const canvas2 = document.createElement("canvas");
|
|
13172
|
+
canvas2.width = this.width;
|
|
13173
|
+
canvas2.height = this.height;
|
|
13174
|
+
canvas2.getContext("2d")?.drawImage(
|
|
13175
|
+
canvas1,
|
|
13154
13176
|
0,
|
|
13155
13177
|
0,
|
|
13156
|
-
|
|
13157
|
-
|
|
13178
|
+
canvas1.width,
|
|
13179
|
+
canvas1.height,
|
|
13158
13180
|
0,
|
|
13159
13181
|
0,
|
|
13160
|
-
|
|
13161
|
-
|
|
13182
|
+
canvas2.width,
|
|
13183
|
+
canvas2.height
|
|
13162
13184
|
);
|
|
13163
|
-
return
|
|
13185
|
+
return canvas2;
|
|
13164
13186
|
}
|
|
13165
13187
|
}
|
|
13166
13188
|
|
|
@@ -13195,6 +13217,7 @@ async function performRender(options) {
|
|
|
13195
13217
|
}
|
|
13196
13218
|
});
|
|
13197
13219
|
await engine.waitUntilLoad();
|
|
13220
|
+
await options.onBeforeRender?.(engine);
|
|
13198
13221
|
return engine.toCanvas2D();
|
|
13199
13222
|
}
|
|
13200
13223
|
async function render(options) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1571,6 +1571,7 @@ interface SceneTree {
|
|
|
1571
1571
|
declare class SceneTree extends MainLoop {
|
|
1572
1572
|
paused: boolean;
|
|
1573
1573
|
backgroundColor?: ColorValue;
|
|
1574
|
+
debug: boolean;
|
|
1574
1575
|
readonly input: Input;
|
|
1575
1576
|
readonly renderStack: RenderStack;
|
|
1576
1577
|
readonly root: Viewport;
|
|
@@ -1581,6 +1582,7 @@ declare class SceneTree extends MainLoop {
|
|
|
1581
1582
|
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1582
1583
|
constructor(timeline?: Timeline);
|
|
1583
1584
|
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1585
|
+
log(...args: any[]): void;
|
|
1584
1586
|
protected _render(renderer: WebGLRenderer, delta?: number): this;
|
|
1585
1587
|
protected _renderScreen(renderer: WebGLRenderer): void;
|
|
1586
1588
|
free(): void;
|
|
@@ -1723,6 +1725,7 @@ declare class TimelineNode extends Node {
|
|
|
1723
1725
|
delay: number;
|
|
1724
1726
|
duration: number;
|
|
1725
1727
|
paused: boolean;
|
|
1728
|
+
insideTimeRange: boolean;
|
|
1726
1729
|
constructor(properties?: Partial<TimelineNodeProperties>, nodes?: Node[]);
|
|
1727
1730
|
/** Timeline */
|
|
1728
1731
|
computedDuration: number;
|
|
@@ -1786,9 +1789,10 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1786
1789
|
requestRepaint(): void;
|
|
1787
1790
|
protected _updateGlobalVisible(): void;
|
|
1788
1791
|
protected _updateGlobalOpacity(): void;
|
|
1792
|
+
protected _draw(): void;
|
|
1793
|
+
protected _redraw(): CanvasBatchable[];
|
|
1789
1794
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1790
1795
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1791
|
-
protected _draw(): void;
|
|
1792
1796
|
protected _update(): void;
|
|
1793
1797
|
protected _render(renderer: WebGLRenderer): void;
|
|
1794
1798
|
}
|
|
@@ -2661,7 +2665,7 @@ declare class GlitchEffect extends Effect {
|
|
|
2661
2665
|
protected _texture: Texture2D;
|
|
2662
2666
|
protected _sizes: Float32Array;
|
|
2663
2667
|
protected _offsets: Float32Array;
|
|
2664
|
-
protected
|
|
2668
|
+
protected _needsRedraw: boolean;
|
|
2665
2669
|
slices: number;
|
|
2666
2670
|
sampleSize: number;
|
|
2667
2671
|
offset: number;
|
|
@@ -2978,6 +2982,7 @@ declare class CanvasItemEditor extends Control {
|
|
|
2978
2982
|
}
|
|
2979
2983
|
|
|
2980
2984
|
interface EngineOptions extends WebGLContextAttributes {
|
|
2985
|
+
debug?: boolean;
|
|
2981
2986
|
view?: HTMLCanvasElement | WebGLRenderingContext | WebGL2RenderingContext;
|
|
2982
2987
|
width?: number;
|
|
2983
2988
|
height?: number;
|
|
@@ -3041,6 +3046,7 @@ interface RenderOptions {
|
|
|
3041
3046
|
data: Record<string, any> | Node | (Node | Record<string, any>)[];
|
|
3042
3047
|
width: number;
|
|
3043
3048
|
height: number;
|
|
3049
|
+
onBeforeRender?: (engine: Engine) => void | Promise<void>;
|
|
3044
3050
|
}
|
|
3045
3051
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3046
3052
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1571,6 +1571,7 @@ interface SceneTree {
|
|
|
1571
1571
|
declare class SceneTree extends MainLoop {
|
|
1572
1572
|
paused: boolean;
|
|
1573
1573
|
backgroundColor?: ColorValue;
|
|
1574
|
+
debug: boolean;
|
|
1574
1575
|
readonly input: Input;
|
|
1575
1576
|
readonly renderStack: RenderStack;
|
|
1576
1577
|
readonly root: Viewport;
|
|
@@ -1581,6 +1582,7 @@ declare class SceneTree extends MainLoop {
|
|
|
1581
1582
|
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1582
1583
|
constructor(timeline?: Timeline);
|
|
1583
1584
|
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1585
|
+
log(...args: any[]): void;
|
|
1584
1586
|
protected _render(renderer: WebGLRenderer, delta?: number): this;
|
|
1585
1587
|
protected _renderScreen(renderer: WebGLRenderer): void;
|
|
1586
1588
|
free(): void;
|
|
@@ -1723,6 +1725,7 @@ declare class TimelineNode extends Node {
|
|
|
1723
1725
|
delay: number;
|
|
1724
1726
|
duration: number;
|
|
1725
1727
|
paused: boolean;
|
|
1728
|
+
insideTimeRange: boolean;
|
|
1726
1729
|
constructor(properties?: Partial<TimelineNodeProperties>, nodes?: Node[]);
|
|
1727
1730
|
/** Timeline */
|
|
1728
1731
|
computedDuration: number;
|
|
@@ -1786,9 +1789,10 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1786
1789
|
requestRepaint(): void;
|
|
1787
1790
|
protected _updateGlobalVisible(): void;
|
|
1788
1791
|
protected _updateGlobalOpacity(): void;
|
|
1792
|
+
protected _draw(): void;
|
|
1793
|
+
protected _redraw(): CanvasBatchable[];
|
|
1789
1794
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1790
1795
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1791
|
-
protected _draw(): void;
|
|
1792
1796
|
protected _update(): void;
|
|
1793
1797
|
protected _render(renderer: WebGLRenderer): void;
|
|
1794
1798
|
}
|
|
@@ -2661,7 +2665,7 @@ declare class GlitchEffect extends Effect {
|
|
|
2661
2665
|
protected _texture: Texture2D;
|
|
2662
2666
|
protected _sizes: Float32Array;
|
|
2663
2667
|
protected _offsets: Float32Array;
|
|
2664
|
-
protected
|
|
2668
|
+
protected _needsRedraw: boolean;
|
|
2665
2669
|
slices: number;
|
|
2666
2670
|
sampleSize: number;
|
|
2667
2671
|
offset: number;
|
|
@@ -2978,6 +2982,7 @@ declare class CanvasItemEditor extends Control {
|
|
|
2978
2982
|
}
|
|
2979
2983
|
|
|
2980
2984
|
interface EngineOptions extends WebGLContextAttributes {
|
|
2985
|
+
debug?: boolean;
|
|
2981
2986
|
view?: HTMLCanvasElement | WebGLRenderingContext | WebGL2RenderingContext;
|
|
2982
2987
|
width?: number;
|
|
2983
2988
|
height?: number;
|
|
@@ -3041,6 +3046,7 @@ interface RenderOptions {
|
|
|
3041
3046
|
data: Record<string, any> | Node | (Node | Record<string, any>)[];
|
|
3042
3047
|
width: number;
|
|
3043
3048
|
height: number;
|
|
3049
|
+
onBeforeRender?: (engine: Engine) => void | Promise<void>;
|
|
3044
3050
|
}
|
|
3045
3051
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3046
3052
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1571,6 +1571,7 @@ interface SceneTree {
|
|
|
1571
1571
|
declare class SceneTree extends MainLoop {
|
|
1572
1572
|
paused: boolean;
|
|
1573
1573
|
backgroundColor?: ColorValue;
|
|
1574
|
+
debug: boolean;
|
|
1574
1575
|
readonly input: Input;
|
|
1575
1576
|
readonly renderStack: RenderStack;
|
|
1576
1577
|
readonly root: Viewport;
|
|
@@ -1581,6 +1582,7 @@ declare class SceneTree extends MainLoop {
|
|
|
1581
1582
|
setCurrentViewport(viewport: Viewport | undefined): void;
|
|
1582
1583
|
constructor(timeline?: Timeline);
|
|
1583
1584
|
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1585
|
+
log(...args: any[]): void;
|
|
1584
1586
|
protected _render(renderer: WebGLRenderer, delta?: number): this;
|
|
1585
1587
|
protected _renderScreen(renderer: WebGLRenderer): void;
|
|
1586
1588
|
free(): void;
|
|
@@ -1723,6 +1725,7 @@ declare class TimelineNode extends Node {
|
|
|
1723
1725
|
delay: number;
|
|
1724
1726
|
duration: number;
|
|
1725
1727
|
paused: boolean;
|
|
1728
|
+
insideTimeRange: boolean;
|
|
1726
1729
|
constructor(properties?: Partial<TimelineNodeProperties>, nodes?: Node[]);
|
|
1727
1730
|
/** Timeline */
|
|
1728
1731
|
computedDuration: number;
|
|
@@ -1786,9 +1789,10 @@ declare class CanvasItem extends TimelineNode {
|
|
|
1786
1789
|
requestRepaint(): void;
|
|
1787
1790
|
protected _updateGlobalVisible(): void;
|
|
1788
1791
|
protected _updateGlobalOpacity(): void;
|
|
1792
|
+
protected _draw(): void;
|
|
1793
|
+
protected _redraw(): CanvasBatchable[];
|
|
1789
1794
|
protected _relayout(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1790
1795
|
protected _repaint(batchables: CanvasBatchable[]): CanvasBatchable[];
|
|
1791
|
-
protected _draw(): void;
|
|
1792
1796
|
protected _update(): void;
|
|
1793
1797
|
protected _render(renderer: WebGLRenderer): void;
|
|
1794
1798
|
}
|
|
@@ -2661,7 +2665,7 @@ declare class GlitchEffect extends Effect {
|
|
|
2661
2665
|
protected _texture: Texture2D;
|
|
2662
2666
|
protected _sizes: Float32Array;
|
|
2663
2667
|
protected _offsets: Float32Array;
|
|
2664
|
-
protected
|
|
2668
|
+
protected _needsRedraw: boolean;
|
|
2665
2669
|
slices: number;
|
|
2666
2670
|
sampleSize: number;
|
|
2667
2671
|
offset: number;
|
|
@@ -2978,6 +2982,7 @@ declare class CanvasItemEditor extends Control {
|
|
|
2978
2982
|
}
|
|
2979
2983
|
|
|
2980
2984
|
interface EngineOptions extends WebGLContextAttributes {
|
|
2985
|
+
debug?: boolean;
|
|
2981
2986
|
view?: HTMLCanvasElement | WebGLRenderingContext | WebGL2RenderingContext;
|
|
2982
2987
|
width?: number;
|
|
2983
2988
|
height?: number;
|
|
@@ -3041,6 +3046,7 @@ interface RenderOptions {
|
|
|
3041
3046
|
data: Record<string, any> | Node | (Node | Record<string, any>)[];
|
|
3042
3047
|
width: number;
|
|
3043
3048
|
height: number;
|
|
3049
|
+
onBeforeRender?: (engine: Engine) => void | Promise<void>;
|
|
3044
3050
|
}
|
|
3045
3051
|
declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
|
|
3046
3052
|
|