modern-canvas 0.6.13 → 0.7.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 +6 -4
- package/dist/index.cjs +1737 -1741
- package/dist/index.d.cts +160 -169
- package/dist/index.d.mts +160 -169
- package/dist/index.d.ts +160 -169
- package/dist/index.js +42 -42
- package/dist/index.mjs +1740 -1744
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineProperty, EventEmitter, getDeclarations, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, clearUndef, idGenerator,
|
|
1
|
+
import { defineProperty, EventEmitter, getDeclarations, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, isColorFillObject, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText } from 'modern-idoc';
|
|
2
2
|
import { extend } from 'colord';
|
|
3
3
|
import namesPlugin from 'colord/plugins/names';
|
|
4
4
|
import { Path2D, Path2DSet, svgToDom, svgToPath2DSet, Matrix3 as Matrix3$1 } from 'modern-path2d';
|
|
5
|
-
import { Text
|
|
5
|
+
import { Text } from 'modern-text';
|
|
6
6
|
import { loadYoga, BoxSizing, PositionType, Edge, Overflow, Gutter, Justify, Wrap, FlexDirection, Display, Direction, Align } from 'yoga-layout/load';
|
|
7
7
|
|
|
8
8
|
const customNodes = /* @__PURE__ */ new Map();
|
|
@@ -1075,7 +1075,7 @@ class Vector extends EventEmitter {
|
|
|
1075
1075
|
get length() {
|
|
1076
1076
|
return this.dim;
|
|
1077
1077
|
}
|
|
1078
|
-
|
|
1078
|
+
operate(operator, target, output) {
|
|
1079
1079
|
const { dim: length, _array: array } = this;
|
|
1080
1080
|
let targetArray;
|
|
1081
1081
|
if (typeof target === "number") {
|
|
@@ -1161,29 +1161,41 @@ class Vector extends EventEmitter {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
return outputObject?.set(outputArray) ?? outputArray;
|
|
1163
1163
|
}
|
|
1164
|
-
add(value,
|
|
1165
|
-
|
|
1164
|
+
add(value, ...args) {
|
|
1165
|
+
if (args.length && typeof value === "number") {
|
|
1166
|
+
value = [value, ...args];
|
|
1167
|
+
}
|
|
1168
|
+
return this.operate("+", value);
|
|
1166
1169
|
}
|
|
1167
|
-
sub(value,
|
|
1168
|
-
|
|
1170
|
+
sub(value, ...args) {
|
|
1171
|
+
if (args.length && typeof value === "number") {
|
|
1172
|
+
value = [value, ...args];
|
|
1173
|
+
}
|
|
1174
|
+
return this.operate("-", value);
|
|
1169
1175
|
}
|
|
1170
|
-
multiply(value,
|
|
1171
|
-
|
|
1176
|
+
multiply(value, ...args) {
|
|
1177
|
+
if (args.length && typeof value === "number") {
|
|
1178
|
+
value = [value, ...args];
|
|
1179
|
+
}
|
|
1180
|
+
return this.operate("*", value);
|
|
1172
1181
|
}
|
|
1173
|
-
divide(value,
|
|
1174
|
-
|
|
1182
|
+
divide(value, ...args) {
|
|
1183
|
+
if (args.length && typeof value === "number") {
|
|
1184
|
+
value = [value, ...args];
|
|
1185
|
+
}
|
|
1186
|
+
return this.operate("/", value);
|
|
1175
1187
|
}
|
|
1176
1188
|
rotate(angle) {
|
|
1177
|
-
return this.
|
|
1189
|
+
return this.operate("rot", angle);
|
|
1178
1190
|
}
|
|
1179
1191
|
set(value, ...args) {
|
|
1180
1192
|
if (args.length && typeof value === "number") {
|
|
1181
1193
|
value = [value, ...args];
|
|
1182
1194
|
}
|
|
1183
|
-
return this.
|
|
1195
|
+
return this.operate("=", value);
|
|
1184
1196
|
}
|
|
1185
1197
|
equals(value) {
|
|
1186
|
-
return this.
|
|
1198
|
+
return this.operate("==", value);
|
|
1187
1199
|
}
|
|
1188
1200
|
copy(value) {
|
|
1189
1201
|
return this.set(value);
|
|
@@ -1195,11 +1207,14 @@ class Vector extends EventEmitter {
|
|
|
1195
1207
|
}
|
|
1196
1208
|
_onUpdate(_array) {
|
|
1197
1209
|
}
|
|
1210
|
+
toName() {
|
|
1211
|
+
return `Vector${this.dim}`;
|
|
1212
|
+
}
|
|
1198
1213
|
toArray() {
|
|
1199
1214
|
return this._array.slice();
|
|
1200
1215
|
}
|
|
1201
|
-
|
|
1202
|
-
return
|
|
1216
|
+
toJSON() {
|
|
1217
|
+
return this.toArray();
|
|
1203
1218
|
}
|
|
1204
1219
|
}
|
|
1205
1220
|
|
|
@@ -1219,7 +1234,7 @@ class Matrix extends EventEmitter {
|
|
|
1219
1234
|
get length() {
|
|
1220
1235
|
return this.cols * this.rows;
|
|
1221
1236
|
}
|
|
1222
|
-
|
|
1237
|
+
operate(operator, target, output) {
|
|
1223
1238
|
const { cols, rows, length, _array: array } = this;
|
|
1224
1239
|
let targetArray;
|
|
1225
1240
|
if (typeof target === "number") {
|
|
@@ -1306,7 +1321,7 @@ class Matrix extends EventEmitter {
|
|
|
1306
1321
|
return this.set(array);
|
|
1307
1322
|
}
|
|
1308
1323
|
set(value) {
|
|
1309
|
-
return this.
|
|
1324
|
+
return this.operate("=", value);
|
|
1310
1325
|
}
|
|
1311
1326
|
copy(value) {
|
|
1312
1327
|
return this.set(value);
|
|
@@ -1317,7 +1332,7 @@ class Matrix extends EventEmitter {
|
|
|
1317
1332
|
return cloned;
|
|
1318
1333
|
}
|
|
1319
1334
|
multiply(value, output) {
|
|
1320
|
-
return this.
|
|
1335
|
+
return this.operate("*", value, output);
|
|
1321
1336
|
}
|
|
1322
1337
|
_onUpdate(_array) {
|
|
1323
1338
|
this.dirtyId++;
|
|
@@ -1339,7 +1354,7 @@ class Matrix extends EventEmitter {
|
|
|
1339
1354
|
return `Matrix${this.rows}(${this.rows}x${this.cols})`;
|
|
1340
1355
|
}
|
|
1341
1356
|
toJSON() {
|
|
1342
|
-
return this._array;
|
|
1357
|
+
return this._array.slice();
|
|
1343
1358
|
}
|
|
1344
1359
|
}
|
|
1345
1360
|
|
|
@@ -1351,7 +1366,7 @@ class Matrix4 extends Matrix {
|
|
|
1351
1366
|
|
|
1352
1367
|
const DEG_TO_RAD = PI / 180;
|
|
1353
1368
|
const RAD_TO_DEG = 180 / PI;
|
|
1354
|
-
function clamp(
|
|
1369
|
+
function clamp(val, min, max) {
|
|
1355
1370
|
return Math.max(min, Math.min(val, max));
|
|
1356
1371
|
}
|
|
1357
1372
|
function lerp(a, b, weight) {
|
|
@@ -1380,7 +1395,7 @@ const curves = {
|
|
|
1380
1395
|
class Vector4 extends Vector {
|
|
1381
1396
|
constructor(x = 0, y = 0, z = 0, m = 0) {
|
|
1382
1397
|
super(4);
|
|
1383
|
-
this.set(
|
|
1398
|
+
this.set(x, y, z, m);
|
|
1384
1399
|
}
|
|
1385
1400
|
}
|
|
1386
1401
|
|
|
@@ -1521,7 +1536,7 @@ class ColorMatrix extends Matrix {
|
|
|
1521
1536
|
]);
|
|
1522
1537
|
}
|
|
1523
1538
|
sepia(amount = 1) {
|
|
1524
|
-
const v = clamp(
|
|
1539
|
+
const v = clamp(amount, 0, 1);
|
|
1525
1540
|
return this.multiply([
|
|
1526
1541
|
lerp(1, 0.393, v),
|
|
1527
1542
|
lerp(0, 0.7689999, v),
|
|
@@ -1570,7 +1585,7 @@ class ColorMatrix extends Matrix {
|
|
|
1570
1585
|
]);
|
|
1571
1586
|
}
|
|
1572
1587
|
grayscale(amount = 1) {
|
|
1573
|
-
const v = clamp(
|
|
1588
|
+
const v = clamp(amount, 0, 1);
|
|
1574
1589
|
const r = lerp(1, 0.3, v);
|
|
1575
1590
|
const rr = lerp(0, 0.3, v);
|
|
1576
1591
|
const g = lerp(1, 0.59, v);
|
|
@@ -1833,7 +1848,7 @@ class Vector2 extends Vector {
|
|
|
1833
1848
|
return this;
|
|
1834
1849
|
}
|
|
1835
1850
|
static lerp(a, b, t) {
|
|
1836
|
-
return new Vector2(b).clone().sub(
|
|
1851
|
+
return new Vector2(b).clone().sub(a).multiply(t).add(a);
|
|
1837
1852
|
}
|
|
1838
1853
|
}
|
|
1839
1854
|
|
|
@@ -1899,6 +1914,14 @@ class Rect2 {
|
|
|
1899
1914
|
toArray() {
|
|
1900
1915
|
return [this.x, this.y, this.width, this.height];
|
|
1901
1916
|
}
|
|
1917
|
+
toJSON() {
|
|
1918
|
+
return {
|
|
1919
|
+
x: this.x,
|
|
1920
|
+
y: this.y,
|
|
1921
|
+
width: this.width,
|
|
1922
|
+
height: this.height
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1902
1925
|
}
|
|
1903
1926
|
|
|
1904
1927
|
class Transform2D extends Matrix3 {
|
|
@@ -2073,13 +2096,13 @@ class Vector3 extends Vector {
|
|
|
2073
2096
|
}
|
|
2074
2097
|
}
|
|
2075
2098
|
|
|
2076
|
-
var __defProp$
|
|
2077
|
-
var __decorateClass$
|
|
2099
|
+
var __defProp$P = Object.defineProperty;
|
|
2100
|
+
var __decorateClass$Z = (decorators, target, key, kind) => {
|
|
2078
2101
|
var result = void 0 ;
|
|
2079
2102
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2080
2103
|
if (decorator = decorators[i])
|
|
2081
2104
|
result = (decorator(target, key, result) ) || result;
|
|
2082
|
-
if (result) __defProp$
|
|
2105
|
+
if (result) __defProp$P(target, key, result);
|
|
2083
2106
|
return result;
|
|
2084
2107
|
};
|
|
2085
2108
|
class MainLoop extends CoreObject {
|
|
@@ -2122,10 +2145,10 @@ class MainLoop extends CoreObject {
|
|
|
2122
2145
|
this.stop();
|
|
2123
2146
|
}
|
|
2124
2147
|
}
|
|
2125
|
-
__decorateClass$
|
|
2126
|
-
property({ fallback:
|
|
2148
|
+
__decorateClass$Z([
|
|
2149
|
+
property({ fallback: 60 })
|
|
2127
2150
|
], MainLoop.prototype, "fps");
|
|
2128
|
-
__decorateClass$
|
|
2151
|
+
__decorateClass$Z([
|
|
2129
2152
|
property({ fallback: 1 })
|
|
2130
2153
|
], MainLoop.prototype, "speed");
|
|
2131
2154
|
|
|
@@ -3451,6 +3474,33 @@ function getVarTypeSize(type) {
|
|
|
3451
3474
|
}
|
|
3452
3475
|
}
|
|
3453
3476
|
|
|
3477
|
+
function applyMatrixToPoint(m, x, y) {
|
|
3478
|
+
const [a, d, g, b, e, h, c, f, i] = m;
|
|
3479
|
+
const xp = a * x + b * y + c;
|
|
3480
|
+
const yp = d * x + e * y + f;
|
|
3481
|
+
const wp = g * x + h * y + i;
|
|
3482
|
+
return { x: xp / wp, y: yp / wp };
|
|
3483
|
+
}
|
|
3484
|
+
function transformRectToAABB(m, rect) {
|
|
3485
|
+
const { x, y, width, height } = rect;
|
|
3486
|
+
const p1 = applyMatrixToPoint(m, x, y);
|
|
3487
|
+
const p2 = applyMatrixToPoint(m, x + width, y);
|
|
3488
|
+
const p3 = applyMatrixToPoint(m, x + width, y + height);
|
|
3489
|
+
const p4 = applyMatrixToPoint(m, x, y + height);
|
|
3490
|
+
const pts = [p1, p2, p3, p4];
|
|
3491
|
+
const xs = pts.map((p) => p.x);
|
|
3492
|
+
const ys = pts.map((p) => p.y);
|
|
3493
|
+
const minX = Math.min(...xs);
|
|
3494
|
+
const maxX = Math.max(...xs);
|
|
3495
|
+
const minY = Math.min(...ys);
|
|
3496
|
+
const maxY = Math.max(...ys);
|
|
3497
|
+
return {
|
|
3498
|
+
x: minX,
|
|
3499
|
+
y: minY,
|
|
3500
|
+
width: maxX - minX,
|
|
3501
|
+
height: maxY - minY
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3454
3504
|
class WebGLScissorModule extends WebGLModule {
|
|
3455
3505
|
install(renderer) {
|
|
3456
3506
|
super.install(renderer);
|
|
@@ -3476,19 +3526,21 @@ class WebGLScissorModule extends WebGLModule {
|
|
|
3476
3526
|
}
|
|
3477
3527
|
use() {
|
|
3478
3528
|
const renderer = this._renderer;
|
|
3479
|
-
const { pixelRatio, mask, viewport, screen, gl } = renderer;
|
|
3480
|
-
const
|
|
3481
|
-
|
|
3529
|
+
const { pixelRatio, mask, viewport, screen, gl, program } = renderer;
|
|
3530
|
+
const { worldTransformMatrix } = program.uniforms;
|
|
3531
|
+
const rect = transformRectToAABB(worldTransformMatrix, mask.last.mask);
|
|
3532
|
+
const { x, y, width, height } = rect;
|
|
3533
|
+
let scissorY;
|
|
3482
3534
|
if (viewport.boundViewport) {
|
|
3483
|
-
|
|
3535
|
+
scissorY = viewport.boundViewport.height - (height + y) * pixelRatio;
|
|
3484
3536
|
} else {
|
|
3485
|
-
|
|
3537
|
+
scissorY = (screen.height - (height + y)) * pixelRatio;
|
|
3486
3538
|
}
|
|
3487
3539
|
gl.scissor(
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3540
|
+
x * pixelRatio,
|
|
3541
|
+
scissorY,
|
|
3542
|
+
width * pixelRatio,
|
|
3543
|
+
height * pixelRatio
|
|
3492
3544
|
);
|
|
3493
3545
|
}
|
|
3494
3546
|
}
|
|
@@ -4165,15 +4217,13 @@ class WebGLRenderer extends Renderer {
|
|
|
4165
4217
|
this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
|
|
4166
4218
|
this.extensions.loseContext?.loseContext();
|
|
4167
4219
|
}
|
|
4168
|
-
toPixels() {
|
|
4169
|
-
const width = this.gl.drawingBufferWidth;
|
|
4170
|
-
const height = this.gl.drawingBufferHeight;
|
|
4220
|
+
toPixels(x = 0, y = 0, width = this.gl.drawingBufferWidth, height = this.gl.drawingBufferHeight) {
|
|
4171
4221
|
const length = width * height * 4;
|
|
4172
4222
|
const row = width * 4;
|
|
4173
4223
|
const end = (height - 1) * row;
|
|
4174
4224
|
const flipedPixels = new Uint8Array(length);
|
|
4175
4225
|
const pixels = new Uint8ClampedArray(length);
|
|
4176
|
-
this.gl.readPixels(
|
|
4226
|
+
this.gl.readPixels(x, y, width, height, this.gl.RGBA, this.gl.UNSIGNED_BYTE, flipedPixels);
|
|
4177
4227
|
for (let i = 0; i < length; i += row) {
|
|
4178
4228
|
pixels.set(flipedPixels.subarray(i, i + row), end - i);
|
|
4179
4229
|
}
|
|
@@ -4205,152 +4255,6 @@ class FontLoader extends Loader {
|
|
|
4205
4255
|
}
|
|
4206
4256
|
}
|
|
4207
4257
|
|
|
4208
|
-
const defaultFilters = {
|
|
4209
|
-
"brightness": 1,
|
|
4210
|
-
"contrast": 1,
|
|
4211
|
-
"grayscale": 0,
|
|
4212
|
-
"hue-rotate": 0,
|
|
4213
|
-
"invert": 0,
|
|
4214
|
-
"opacity": 1,
|
|
4215
|
-
"saturate": 1,
|
|
4216
|
-
"sepia": 0
|
|
4217
|
-
};
|
|
4218
|
-
function parseCSSFilter(filter) {
|
|
4219
|
-
const m = new ColorMatrix();
|
|
4220
|
-
if (filter === "none") {
|
|
4221
|
-
return m;
|
|
4222
|
-
}
|
|
4223
|
-
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
4224
|
-
filter2[name] = args[0].normalizedIntValue;
|
|
4225
|
-
return filter2;
|
|
4226
|
-
}, {});
|
|
4227
|
-
Object.keys(defaultFilters).forEach((name) => {
|
|
4228
|
-
filters[name] = filters[name] ?? defaultFilters[name];
|
|
4229
|
-
});
|
|
4230
|
-
for (const name in filters) {
|
|
4231
|
-
const value = filters[name];
|
|
4232
|
-
switch (name) {
|
|
4233
|
-
case "hue-rotate":
|
|
4234
|
-
m.hueRotate(value * PI_2);
|
|
4235
|
-
break;
|
|
4236
|
-
case "saturate":
|
|
4237
|
-
m.saturate(value);
|
|
4238
|
-
break;
|
|
4239
|
-
case "brightness":
|
|
4240
|
-
m.brightness(value);
|
|
4241
|
-
break;
|
|
4242
|
-
case "contrast":
|
|
4243
|
-
m.contrast(value);
|
|
4244
|
-
break;
|
|
4245
|
-
case "invert":
|
|
4246
|
-
m.invert(value);
|
|
4247
|
-
break;
|
|
4248
|
-
case "sepia":
|
|
4249
|
-
m.sepia(value);
|
|
4250
|
-
break;
|
|
4251
|
-
case "opacity":
|
|
4252
|
-
m.opacity(value);
|
|
4253
|
-
break;
|
|
4254
|
-
case "grayscale":
|
|
4255
|
-
m.grayscale(value);
|
|
4256
|
-
break;
|
|
4257
|
-
}
|
|
4258
|
-
}
|
|
4259
|
-
return m;
|
|
4260
|
-
}
|
|
4261
|
-
|
|
4262
|
-
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4263
|
-
transform = !transform || transform === "none" ? "" : transform;
|
|
4264
|
-
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
4265
|
-
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4266
|
-
switch (name) {
|
|
4267
|
-
case "translate":
|
|
4268
|
-
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
4269
|
-
break;
|
|
4270
|
-
case "translateX":
|
|
4271
|
-
output.translateX(values[0] * width);
|
|
4272
|
-
break;
|
|
4273
|
-
case "translateY":
|
|
4274
|
-
output.translateY(values[0] * height);
|
|
4275
|
-
break;
|
|
4276
|
-
case "translateZ":
|
|
4277
|
-
output.translateZ(values[0]);
|
|
4278
|
-
break;
|
|
4279
|
-
case "translate3d":
|
|
4280
|
-
output.translate3d(
|
|
4281
|
-
values[0] * width,
|
|
4282
|
-
(values[1] ?? values[0]) * height,
|
|
4283
|
-
values[2] ?? values[1] ?? values[0]
|
|
4284
|
-
);
|
|
4285
|
-
break;
|
|
4286
|
-
case "scale":
|
|
4287
|
-
output.scale(values[0], values[1] ?? values[0]);
|
|
4288
|
-
break;
|
|
4289
|
-
case "scaleX":
|
|
4290
|
-
output.scaleX(values[0]);
|
|
4291
|
-
break;
|
|
4292
|
-
case "scaleY":
|
|
4293
|
-
output.scaleY(values[0]);
|
|
4294
|
-
break;
|
|
4295
|
-
case "scale3d":
|
|
4296
|
-
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
4297
|
-
break;
|
|
4298
|
-
case "rotate":
|
|
4299
|
-
output.rotate(values[0] * PI_2);
|
|
4300
|
-
break;
|
|
4301
|
-
case "rotateX":
|
|
4302
|
-
output.rotateX(values[0] * PI_2);
|
|
4303
|
-
break;
|
|
4304
|
-
case "rotateY":
|
|
4305
|
-
output.rotateY(values[0] * PI_2);
|
|
4306
|
-
break;
|
|
4307
|
-
case "rotateZ":
|
|
4308
|
-
output.rotateZ(values[0] * PI_2);
|
|
4309
|
-
break;
|
|
4310
|
-
case "rotate3d":
|
|
4311
|
-
output.rotate3d(
|
|
4312
|
-
values[0] * PI_2,
|
|
4313
|
-
(values[1] ?? values[0]) * PI_2,
|
|
4314
|
-
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
4315
|
-
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
4316
|
-
);
|
|
4317
|
-
break;
|
|
4318
|
-
case "skew":
|
|
4319
|
-
output.skew(values[0], values[0] ?? values[1]);
|
|
4320
|
-
break;
|
|
4321
|
-
case "skewX":
|
|
4322
|
-
output.skewX(values[0]);
|
|
4323
|
-
break;
|
|
4324
|
-
case "skewY":
|
|
4325
|
-
output.skewY(values[0]);
|
|
4326
|
-
break;
|
|
4327
|
-
case "matrix":
|
|
4328
|
-
output.set(values);
|
|
4329
|
-
break;
|
|
4330
|
-
}
|
|
4331
|
-
});
|
|
4332
|
-
return output;
|
|
4333
|
-
}
|
|
4334
|
-
|
|
4335
|
-
function parseCSSTransformOrigin(transformOrigin) {
|
|
4336
|
-
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
4337
|
-
return [originX, originY].map((val) => {
|
|
4338
|
-
val = val.trim();
|
|
4339
|
-
switch (val) {
|
|
4340
|
-
case "left":
|
|
4341
|
-
case "top":
|
|
4342
|
-
return 0;
|
|
4343
|
-
case "center":
|
|
4344
|
-
return 0.5;
|
|
4345
|
-
case "right":
|
|
4346
|
-
case "bottom":
|
|
4347
|
-
return 1;
|
|
4348
|
-
default:
|
|
4349
|
-
return Number(val);
|
|
4350
|
-
}
|
|
4351
|
-
});
|
|
4352
|
-
}
|
|
4353
|
-
|
|
4354
4258
|
class Geometry extends Resource {
|
|
4355
4259
|
vertexAttributes;
|
|
4356
4260
|
indexBuffer;
|
|
@@ -4436,13 +4340,13 @@ class Geometry extends Resource {
|
|
|
4436
4340
|
}
|
|
4437
4341
|
}
|
|
4438
4342
|
|
|
4439
|
-
var __defProp$
|
|
4440
|
-
var __decorateClass$
|
|
4343
|
+
var __defProp$O = Object.defineProperty;
|
|
4344
|
+
var __decorateClass$Y = (decorators, target, key, kind) => {
|
|
4441
4345
|
var result = void 0 ;
|
|
4442
4346
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4443
4347
|
if (decorator = decorators[i])
|
|
4444
4348
|
result = (decorator(target, key, result) ) || result;
|
|
4445
|
-
if (result) __defProp$
|
|
4349
|
+
if (result) __defProp$O(target, key, result);
|
|
4446
4350
|
return result;
|
|
4447
4351
|
};
|
|
4448
4352
|
class IndexBuffer extends Resource {
|
|
@@ -4486,20 +4390,20 @@ class IndexBuffer extends Resource {
|
|
|
4486
4390
|
return result;
|
|
4487
4391
|
}
|
|
4488
4392
|
}
|
|
4489
|
-
__decorateClass$
|
|
4393
|
+
__decorateClass$Y([
|
|
4490
4394
|
property({ protected: true, default: null })
|
|
4491
4395
|
], IndexBuffer.prototype, "data");
|
|
4492
|
-
__decorateClass$
|
|
4396
|
+
__decorateClass$Y([
|
|
4493
4397
|
property({ protected: true, fallback: false })
|
|
4494
4398
|
], IndexBuffer.prototype, "dynamic");
|
|
4495
4399
|
|
|
4496
|
-
var __defProp$
|
|
4497
|
-
var __decorateClass$
|
|
4400
|
+
var __defProp$N = Object.defineProperty;
|
|
4401
|
+
var __decorateClass$X = (decorators, target, key, kind) => {
|
|
4498
4402
|
var result = void 0 ;
|
|
4499
4403
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4500
4404
|
if (decorator = decorators[i])
|
|
4501
4405
|
result = (decorator(target, key, result) ) || result;
|
|
4502
|
-
if (result) __defProp$
|
|
4406
|
+
if (result) __defProp$N(target, key, result);
|
|
4503
4407
|
return result;
|
|
4504
4408
|
};
|
|
4505
4409
|
class VertexBuffer extends Resource {
|
|
@@ -4543,20 +4447,20 @@ class VertexBuffer extends Resource {
|
|
|
4543
4447
|
return result;
|
|
4544
4448
|
}
|
|
4545
4449
|
}
|
|
4546
|
-
__decorateClass$
|
|
4450
|
+
__decorateClass$X([
|
|
4547
4451
|
property({ protected: true, default: null })
|
|
4548
4452
|
], VertexBuffer.prototype, "data");
|
|
4549
|
-
__decorateClass$
|
|
4453
|
+
__decorateClass$X([
|
|
4550
4454
|
property({ protected: true, fallback: false })
|
|
4551
4455
|
], VertexBuffer.prototype, "dynamic");
|
|
4552
4456
|
|
|
4553
|
-
var __defProp$
|
|
4554
|
-
var __decorateClass$
|
|
4457
|
+
var __defProp$M = Object.defineProperty;
|
|
4458
|
+
var __decorateClass$W = (decorators, target, key, kind) => {
|
|
4555
4459
|
var result = void 0 ;
|
|
4556
4460
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4557
4461
|
if (decorator = decorators[i])
|
|
4558
4462
|
result = (decorator(target, key, result) ) || result;
|
|
4559
|
-
if (result) __defProp$
|
|
4463
|
+
if (result) __defProp$M(target, key, result);
|
|
4560
4464
|
return result;
|
|
4561
4465
|
};
|
|
4562
4466
|
class VertexAttribute extends Resource {
|
|
@@ -4590,25 +4494,25 @@ class VertexAttribute extends Resource {
|
|
|
4590
4494
|
return result;
|
|
4591
4495
|
}
|
|
4592
4496
|
}
|
|
4593
|
-
__decorateClass$
|
|
4497
|
+
__decorateClass$W([
|
|
4594
4498
|
property({ protected: true })
|
|
4595
4499
|
], VertexAttribute.prototype, "buffer");
|
|
4596
|
-
__decorateClass$
|
|
4500
|
+
__decorateClass$W([
|
|
4597
4501
|
property({ fallback: 0 })
|
|
4598
4502
|
], VertexAttribute.prototype, "size");
|
|
4599
|
-
__decorateClass$
|
|
4503
|
+
__decorateClass$W([
|
|
4600
4504
|
property({ fallback: false })
|
|
4601
4505
|
], VertexAttribute.prototype, "normalized");
|
|
4602
|
-
__decorateClass$
|
|
4506
|
+
__decorateClass$W([
|
|
4603
4507
|
property({ fallback: "float" })
|
|
4604
4508
|
], VertexAttribute.prototype, "type");
|
|
4605
|
-
__decorateClass$
|
|
4509
|
+
__decorateClass$W([
|
|
4606
4510
|
property()
|
|
4607
4511
|
], VertexAttribute.prototype, "stride");
|
|
4608
|
-
__decorateClass$
|
|
4512
|
+
__decorateClass$W([
|
|
4609
4513
|
property()
|
|
4610
4514
|
], VertexAttribute.prototype, "offset");
|
|
4611
|
-
__decorateClass$
|
|
4515
|
+
__decorateClass$W([
|
|
4612
4516
|
property()
|
|
4613
4517
|
], VertexAttribute.prototype, "divisor");
|
|
4614
4518
|
|
|
@@ -4852,13 +4756,13 @@ class UvGeometry extends Geometry {
|
|
|
4852
4756
|
}
|
|
4853
4757
|
}
|
|
4854
4758
|
|
|
4855
|
-
var __defProp$
|
|
4856
|
-
var __decorateClass$
|
|
4759
|
+
var __defProp$L = Object.defineProperty;
|
|
4760
|
+
var __decorateClass$V = (decorators, target, key, kind) => {
|
|
4857
4761
|
var result = void 0 ;
|
|
4858
4762
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4859
4763
|
if (decorator = decorators[i])
|
|
4860
4764
|
result = (decorator(target, key, result) ) || result;
|
|
4861
|
-
if (result) __defProp$
|
|
4765
|
+
if (result) __defProp$L(target, key, result);
|
|
4862
4766
|
return result;
|
|
4863
4767
|
};
|
|
4864
4768
|
class Texture2D extends Resource {
|
|
@@ -4984,22 +4888,22 @@ class Texture2D extends Resource {
|
|
|
4984
4888
|
}
|
|
4985
4889
|
}
|
|
4986
4890
|
}
|
|
4987
|
-
__decorateClass$
|
|
4891
|
+
__decorateClass$V([
|
|
4988
4892
|
property({ protected: true })
|
|
4989
4893
|
], Texture2D.prototype, "source");
|
|
4990
|
-
__decorateClass$
|
|
4894
|
+
__decorateClass$V([
|
|
4991
4895
|
property({ fallback: 0 })
|
|
4992
4896
|
], Texture2D.prototype, "width");
|
|
4993
|
-
__decorateClass$
|
|
4897
|
+
__decorateClass$V([
|
|
4994
4898
|
property({ fallback: 0 })
|
|
4995
4899
|
], Texture2D.prototype, "height");
|
|
4996
|
-
__decorateClass$
|
|
4900
|
+
__decorateClass$V([
|
|
4997
4901
|
property({ fallback: "linear" })
|
|
4998
4902
|
], Texture2D.prototype, "filterMode");
|
|
4999
|
-
__decorateClass$
|
|
4903
|
+
__decorateClass$V([
|
|
5000
4904
|
property({ fallback: "clamp_to_edge" })
|
|
5001
4905
|
], Texture2D.prototype, "wrapMode");
|
|
5002
|
-
__decorateClass$
|
|
4906
|
+
__decorateClass$V([
|
|
5003
4907
|
property({ fallback: 1 })
|
|
5004
4908
|
], Texture2D.prototype, "pixelRatio");
|
|
5005
4909
|
|
|
@@ -5029,13 +4933,13 @@ class AnimatedTexture extends Resource {
|
|
|
5029
4933
|
}
|
|
5030
4934
|
}
|
|
5031
4935
|
|
|
5032
|
-
var __defProp$
|
|
5033
|
-
var __decorateClass$
|
|
4936
|
+
var __defProp$K = Object.defineProperty;
|
|
4937
|
+
var __decorateClass$U = (decorators, target, key, kind) => {
|
|
5034
4938
|
var result = void 0 ;
|
|
5035
4939
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5036
4940
|
if (decorator = decorators[i])
|
|
5037
4941
|
result = (decorator(target, key, result) ) || result;
|
|
5038
|
-
if (result) __defProp$
|
|
4942
|
+
if (result) __defProp$K(target, key, result);
|
|
5039
4943
|
return result;
|
|
5040
4944
|
};
|
|
5041
4945
|
class CanvasTexture extends Texture2D {
|
|
@@ -5054,7 +4958,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5054
4958
|
super._updateProperty(key, value, oldValue, declaration);
|
|
5055
4959
|
}
|
|
5056
4960
|
}
|
|
5057
|
-
__decorateClass$
|
|
4961
|
+
__decorateClass$U([
|
|
5058
4962
|
property({ fallback: 2 })
|
|
5059
4963
|
], CanvasTexture.prototype, "pixelRatio");
|
|
5060
4964
|
|
|
@@ -5274,13 +5178,13 @@ class PixelsTexture extends Texture2D {
|
|
|
5274
5178
|
}
|
|
5275
5179
|
}
|
|
5276
5180
|
|
|
5277
|
-
var __defProp$
|
|
5278
|
-
var __decorateClass$
|
|
5181
|
+
var __defProp$J = Object.defineProperty;
|
|
5182
|
+
var __decorateClass$T = (decorators, target, key, kind) => {
|
|
5279
5183
|
var result = void 0 ;
|
|
5280
5184
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5281
5185
|
if (decorator = decorators[i])
|
|
5282
5186
|
result = (decorator(target, key, result) ) || result;
|
|
5283
|
-
if (result) __defProp$
|
|
5187
|
+
if (result) __defProp$J(target, key, result);
|
|
5284
5188
|
return result;
|
|
5285
5189
|
};
|
|
5286
5190
|
function resolveOptions(options) {
|
|
@@ -5524,10 +5428,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5524
5428
|
}
|
|
5525
5429
|
}
|
|
5526
5430
|
};
|
|
5527
|
-
__decorateClass$
|
|
5431
|
+
__decorateClass$T([
|
|
5528
5432
|
property({ protected: true, fallback: true })
|
|
5529
5433
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5530
|
-
__decorateClass$
|
|
5434
|
+
__decorateClass$T([
|
|
5531
5435
|
property({ protected: true, fallback: 0 })
|
|
5532
5436
|
], _VideoTexture.prototype, "fps");
|
|
5533
5437
|
let VideoTexture = _VideoTexture;
|
|
@@ -5536,7 +5440,178 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5536
5440
|
//
|
|
5537
5441
|
}
|
|
5538
5442
|
|
|
5539
|
-
class
|
|
5443
|
+
class CanvasContext extends Path2D {
|
|
5444
|
+
fillStyle;
|
|
5445
|
+
strokeStyle;
|
|
5446
|
+
lineCap;
|
|
5447
|
+
lineJoin;
|
|
5448
|
+
lineWidth;
|
|
5449
|
+
miterLimit;
|
|
5450
|
+
// custom
|
|
5451
|
+
uvTransform;
|
|
5452
|
+
vertTransform;
|
|
5453
|
+
_defaultStyle = Texture2D.EMPTY;
|
|
5454
|
+
_draws = [];
|
|
5455
|
+
_toTexture(source) {
|
|
5456
|
+
if (source instanceof Texture2D) {
|
|
5457
|
+
return source;
|
|
5458
|
+
} else {
|
|
5459
|
+
return ColorTexture.get(source);
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
stroke(options) {
|
|
5463
|
+
if (!this.curves.length) {
|
|
5464
|
+
return;
|
|
5465
|
+
}
|
|
5466
|
+
let strokeStyle = this.strokeStyle;
|
|
5467
|
+
if (!strokeStyle && this.style.stroke) {
|
|
5468
|
+
switch (typeof this.style.stroke) {
|
|
5469
|
+
case "string":
|
|
5470
|
+
strokeStyle = this.style.stroke;
|
|
5471
|
+
break;
|
|
5472
|
+
case "object":
|
|
5473
|
+
if (isColorFillObject(this.style.stroke)) {
|
|
5474
|
+
strokeStyle = this.style.stroke.color;
|
|
5475
|
+
}
|
|
5476
|
+
break;
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
this._draws.push({
|
|
5480
|
+
...options,
|
|
5481
|
+
type: "stroke",
|
|
5482
|
+
path: new Path2D(this),
|
|
5483
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
5484
|
+
uvTransform: this.uvTransform,
|
|
5485
|
+
vertTransform: this.vertTransform,
|
|
5486
|
+
style: {
|
|
5487
|
+
alignment: 0.5,
|
|
5488
|
+
cap: this.lineCap ?? "butt",
|
|
5489
|
+
join: this.lineJoin ?? "miter",
|
|
5490
|
+
width: this.lineWidth ?? 1,
|
|
5491
|
+
miterLimit: this.miterLimit ?? 10
|
|
5492
|
+
}
|
|
5493
|
+
});
|
|
5494
|
+
super.reset();
|
|
5495
|
+
}
|
|
5496
|
+
fillRect(x, y, width, height) {
|
|
5497
|
+
this.rect(x, y, width, height).fill();
|
|
5498
|
+
}
|
|
5499
|
+
strokeRect(x, y, width, height) {
|
|
5500
|
+
this.rect(x, y, width, height).stroke();
|
|
5501
|
+
}
|
|
5502
|
+
fill(options) {
|
|
5503
|
+
if (!this.curves.length) {
|
|
5504
|
+
return;
|
|
5505
|
+
}
|
|
5506
|
+
let fillStyle = this.fillStyle;
|
|
5507
|
+
if (!fillStyle && this.style.fill) {
|
|
5508
|
+
switch (typeof this.style.fill) {
|
|
5509
|
+
case "string":
|
|
5510
|
+
fillStyle = this.style.fill;
|
|
5511
|
+
break;
|
|
5512
|
+
case "object":
|
|
5513
|
+
if (isColorFillObject(this.style.fill)) {
|
|
5514
|
+
fillStyle = this.style.fill.color;
|
|
5515
|
+
}
|
|
5516
|
+
break;
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
this._draws.push({
|
|
5520
|
+
...options,
|
|
5521
|
+
type: "fill",
|
|
5522
|
+
path: new Path2D(this),
|
|
5523
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
5524
|
+
uvTransform: this.uvTransform,
|
|
5525
|
+
vertTransform: this.vertTransform
|
|
5526
|
+
});
|
|
5527
|
+
super.reset();
|
|
5528
|
+
}
|
|
5529
|
+
copy(source) {
|
|
5530
|
+
super.copy(source);
|
|
5531
|
+
this.strokeStyle = source.strokeStyle;
|
|
5532
|
+
this.fillStyle = source.fillStyle;
|
|
5533
|
+
this.uvTransform = source.uvTransform;
|
|
5534
|
+
this.vertTransform = source.vertTransform;
|
|
5535
|
+
this.lineCap = source.lineCap;
|
|
5536
|
+
this.lineJoin = source.lineJoin;
|
|
5537
|
+
this.lineWidth = source.lineWidth;
|
|
5538
|
+
this.miterLimit = source.miterLimit;
|
|
5539
|
+
this._draws = source._draws.slice();
|
|
5540
|
+
return this;
|
|
5541
|
+
}
|
|
5542
|
+
reset() {
|
|
5543
|
+
super.reset();
|
|
5544
|
+
this.strokeStyle = void 0;
|
|
5545
|
+
this.fillStyle = void 0;
|
|
5546
|
+
this.uvTransform = void 0;
|
|
5547
|
+
this.vertTransform = void 0;
|
|
5548
|
+
this.lineCap = void 0;
|
|
5549
|
+
this.lineJoin = void 0;
|
|
5550
|
+
this.lineWidth = void 0;
|
|
5551
|
+
this.miterLimit = void 0;
|
|
5552
|
+
this._draws.length = 0;
|
|
5553
|
+
return this;
|
|
5554
|
+
}
|
|
5555
|
+
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
5556
|
+
if (texture) {
|
|
5557
|
+
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
5558
|
+
const w = texture.width;
|
|
5559
|
+
const h = texture.height;
|
|
5560
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5561
|
+
const x = vertices[i];
|
|
5562
|
+
const y = vertices[i + 1];
|
|
5563
|
+
let uvX;
|
|
5564
|
+
let uvY;
|
|
5565
|
+
if (_uvTransform) {
|
|
5566
|
+
[uvX, uvY] = _uvTransform(x, y);
|
|
5567
|
+
} else {
|
|
5568
|
+
[uvX, uvY] = [x / w, y / h];
|
|
5569
|
+
}
|
|
5570
|
+
uvs.push(uvX, uvY);
|
|
5571
|
+
}
|
|
5572
|
+
} else {
|
|
5573
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5574
|
+
uvs.push(0, 0);
|
|
5575
|
+
}
|
|
5576
|
+
}
|
|
5577
|
+
}
|
|
5578
|
+
toBatchables() {
|
|
5579
|
+
const batchables = [];
|
|
5580
|
+
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
5581
|
+
const current = this._draws[i];
|
|
5582
|
+
const vertices = [];
|
|
5583
|
+
const indices = [];
|
|
5584
|
+
const uvs = [];
|
|
5585
|
+
if (current.type === "fill") {
|
|
5586
|
+
current.path.fillTriangulate({
|
|
5587
|
+
vertices,
|
|
5588
|
+
indices
|
|
5589
|
+
});
|
|
5590
|
+
} else {
|
|
5591
|
+
current.path.strokeTriangulate({
|
|
5592
|
+
vertices,
|
|
5593
|
+
indices,
|
|
5594
|
+
lineStyle: current.style,
|
|
5595
|
+
flipAlignment: false,
|
|
5596
|
+
closed: true
|
|
5597
|
+
});
|
|
5598
|
+
}
|
|
5599
|
+
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
5600
|
+
batchables.push({
|
|
5601
|
+
vertices,
|
|
5602
|
+
indices,
|
|
5603
|
+
uvs,
|
|
5604
|
+
texture: current.texture,
|
|
5605
|
+
type: current.type,
|
|
5606
|
+
disableWrapMode: current.disableWrapMode,
|
|
5607
|
+
vertTransform: current.vertTransform
|
|
5608
|
+
});
|
|
5609
|
+
}
|
|
5610
|
+
return batchables;
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
|
|
5614
|
+
class Children extends Array {
|
|
5540
5615
|
front = [];
|
|
5541
5616
|
back = [];
|
|
5542
5617
|
get internal() {
|
|
@@ -5586,14 +5661,14 @@ class Children extends Array {
|
|
|
5586
5661
|
}
|
|
5587
5662
|
}
|
|
5588
5663
|
|
|
5589
|
-
var __defProp$
|
|
5590
|
-
var __getOwnPropDesc$
|
|
5591
|
-
var __decorateClass$
|
|
5592
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5664
|
+
var __defProp$I = Object.defineProperty;
|
|
5665
|
+
var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
|
|
5666
|
+
var __decorateClass$S = (decorators, target, key, kind) => {
|
|
5667
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$J(target, key) : target;
|
|
5593
5668
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5594
5669
|
if (decorator = decorators[i])
|
|
5595
5670
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5596
|
-
if (kind && result) __defProp$
|
|
5671
|
+
if (kind && result) __defProp$I(target, key, result);
|
|
5597
5672
|
return result;
|
|
5598
5673
|
};
|
|
5599
5674
|
const iidMap = {};
|
|
@@ -5654,7 +5729,7 @@ let Node = class extends CoreObject {
|
|
|
5654
5729
|
return this._tree;
|
|
5655
5730
|
}
|
|
5656
5731
|
getViewport() {
|
|
5657
|
-
return this.
|
|
5732
|
+
return this.parent?.getViewport() ?? this.getWindow();
|
|
5658
5733
|
}
|
|
5659
5734
|
getWindow() {
|
|
5660
5735
|
return this._tree?.root;
|
|
@@ -6077,42 +6152,42 @@ let Node = class extends CoreObject {
|
|
|
6077
6152
|
return node;
|
|
6078
6153
|
}
|
|
6079
6154
|
};
|
|
6080
|
-
__decorateClass$
|
|
6155
|
+
__decorateClass$S([
|
|
6081
6156
|
property({ fallback: idGenerator() })
|
|
6082
6157
|
], Node.prototype, "id", 2);
|
|
6083
|
-
__decorateClass$
|
|
6158
|
+
__decorateClass$S([
|
|
6084
6159
|
property({ fallback: idGenerator() })
|
|
6085
6160
|
], Node.prototype, "name", 2);
|
|
6086
|
-
__decorateClass$
|
|
6161
|
+
__decorateClass$S([
|
|
6087
6162
|
property({ fallback: "inherit" })
|
|
6088
6163
|
], Node.prototype, "processMode", 2);
|
|
6089
|
-
__decorateClass$
|
|
6164
|
+
__decorateClass$S([
|
|
6090
6165
|
property({ fallback: "default" })
|
|
6091
6166
|
], Node.prototype, "processSortMode", 2);
|
|
6092
|
-
__decorateClass$
|
|
6167
|
+
__decorateClass$S([
|
|
6093
6168
|
property({ fallback: "inherit" })
|
|
6094
6169
|
], Node.prototype, "renderMode", 2);
|
|
6095
|
-
__decorateClass$
|
|
6170
|
+
__decorateClass$S([
|
|
6096
6171
|
property({ fallback: "default" })
|
|
6097
6172
|
], Node.prototype, "internalMode", 2);
|
|
6098
|
-
__decorateClass$
|
|
6173
|
+
__decorateClass$S([
|
|
6099
6174
|
property({ default: () => ({}) })
|
|
6100
6175
|
], Node.prototype, "meta", 2);
|
|
6101
|
-
__decorateClass$
|
|
6176
|
+
__decorateClass$S([
|
|
6102
6177
|
property({ protected: true })
|
|
6103
6178
|
], Node.prototype, "mask", 2);
|
|
6104
|
-
Node = __decorateClass$
|
|
6179
|
+
Node = __decorateClass$S([
|
|
6105
6180
|
customNode("Node")
|
|
6106
6181
|
], Node);
|
|
6107
6182
|
|
|
6108
|
-
var __defProp$
|
|
6109
|
-
var __getOwnPropDesc$
|
|
6110
|
-
var __decorateClass$
|
|
6111
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6183
|
+
var __defProp$H = Object.defineProperty;
|
|
6184
|
+
var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
|
|
6185
|
+
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
6186
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
|
|
6112
6187
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6113
6188
|
if (decorator = decorators[i])
|
|
6114
6189
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6115
|
-
if (kind && result) __defProp$
|
|
6190
|
+
if (kind && result) __defProp$H(target, key, result);
|
|
6116
6191
|
return result;
|
|
6117
6192
|
};
|
|
6118
6193
|
let TimelineNode = class extends Node {
|
|
@@ -6134,7 +6209,7 @@ let TimelineNode = class extends Node {
|
|
|
6134
6209
|
return this._parent?.startTime ?? 0;
|
|
6135
6210
|
}
|
|
6136
6211
|
get currentTime() {
|
|
6137
|
-
return clamp(
|
|
6212
|
+
return clamp(this._currentTime, 0, this.computedDuration);
|
|
6138
6213
|
}
|
|
6139
6214
|
get startTime() {
|
|
6140
6215
|
return this._startTime;
|
|
@@ -6147,7 +6222,7 @@ let TimelineNode = class extends Node {
|
|
|
6147
6222
|
return this._startTime + this.computedDuration;
|
|
6148
6223
|
}
|
|
6149
6224
|
get currentTimeProgress() {
|
|
6150
|
-
return this.computedDuration ? clamp(
|
|
6225
|
+
return this.computedDuration ? clamp(this._currentTime / this.computedDuration, 0, 1) : 0;
|
|
6151
6226
|
}
|
|
6152
6227
|
isInsideTimeRange() {
|
|
6153
6228
|
const current = this._currentTime;
|
|
@@ -6172,60 +6247,239 @@ let TimelineNode = class extends Node {
|
|
|
6172
6247
|
this._updateCurrentTime();
|
|
6173
6248
|
}
|
|
6174
6249
|
};
|
|
6175
|
-
__decorateClass$
|
|
6250
|
+
__decorateClass$R([
|
|
6176
6251
|
property({ fallback: 0 })
|
|
6177
6252
|
], TimelineNode.prototype, "delay", 2);
|
|
6178
|
-
__decorateClass$
|
|
6253
|
+
__decorateClass$R([
|
|
6179
6254
|
property({ fallback: 0 })
|
|
6180
6255
|
], TimelineNode.prototype, "duration", 2);
|
|
6181
|
-
__decorateClass$
|
|
6256
|
+
__decorateClass$R([
|
|
6182
6257
|
property({ fallback: false })
|
|
6183
6258
|
], TimelineNode.prototype, "paused", 2);
|
|
6184
|
-
__decorateClass$
|
|
6259
|
+
__decorateClass$R([
|
|
6185
6260
|
property({ protected: true, fallback: false })
|
|
6186
6261
|
], TimelineNode.prototype, "insideTimeRange", 2);
|
|
6187
|
-
TimelineNode = __decorateClass$
|
|
6262
|
+
TimelineNode = __decorateClass$R([
|
|
6188
6263
|
customNode("TimelineNode")
|
|
6189
6264
|
], TimelineNode);
|
|
6190
6265
|
|
|
6191
|
-
var __defProp$
|
|
6192
|
-
var __getOwnPropDesc$
|
|
6193
|
-
var __decorateClass$
|
|
6194
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6266
|
+
var __defProp$G = Object.defineProperty;
|
|
6267
|
+
var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
|
|
6268
|
+
var __decorateClass$Q = (decorators, target, key, kind) => {
|
|
6269
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
|
|
6195
6270
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6196
6271
|
if (decorator = decorators[i])
|
|
6197
6272
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6198
|
-
if (kind && result) __defProp$
|
|
6273
|
+
if (kind && result) __defProp$G(target, key, result);
|
|
6199
6274
|
return result;
|
|
6200
6275
|
};
|
|
6201
|
-
let
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
this.
|
|
6206
|
-
}
|
|
6207
|
-
_projection = new Projection2D();
|
|
6208
|
-
_framebufferIndex = 0;
|
|
6209
|
-
_framebuffers = [
|
|
6210
|
-
{ texture: new ViewportTexture(), needsUpload: false },
|
|
6211
|
-
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6212
|
-
];
|
|
6213
|
-
get valid() {
|
|
6214
|
-
return Boolean(this.width && this.height);
|
|
6215
|
-
}
|
|
6216
|
-
get framebuffer() {
|
|
6217
|
-
return this._framebuffers[this._framebufferIndex];
|
|
6276
|
+
let CanvasItem = class extends TimelineNode {
|
|
6277
|
+
_parentGlobalVisible;
|
|
6278
|
+
_globalVisible;
|
|
6279
|
+
get globalVisible() {
|
|
6280
|
+
return this._globalVisible ?? true;
|
|
6218
6281
|
}
|
|
6219
|
-
|
|
6220
|
-
|
|
6282
|
+
_parentGlobalOpacity;
|
|
6283
|
+
_globalOpacity;
|
|
6284
|
+
get globalOpacity() {
|
|
6285
|
+
return this._globalOpacity ?? 1;
|
|
6221
6286
|
}
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6287
|
+
_modulate = new Color(4294967295);
|
|
6288
|
+
// Batch render
|
|
6289
|
+
context = new CanvasContext();
|
|
6290
|
+
_resetContext = true;
|
|
6291
|
+
_redrawing = true;
|
|
6292
|
+
_relayouting = false;
|
|
6293
|
+
_repainting = false;
|
|
6294
|
+
_originalBatchables = [];
|
|
6295
|
+
_layoutedBatchables = [];
|
|
6296
|
+
_batchables = [];
|
|
6297
|
+
constructor(properties, nodes = []) {
|
|
6298
|
+
super();
|
|
6299
|
+
this.setProperties(properties).append(nodes);
|
|
6300
|
+
}
|
|
6301
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
6302
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
6303
|
+
switch (key) {
|
|
6304
|
+
case "modulate":
|
|
6305
|
+
this._modulate.value = value;
|
|
6306
|
+
this.requestRepaint();
|
|
6307
|
+
break;
|
|
6308
|
+
case "blendMode":
|
|
6309
|
+
this.requestRepaint();
|
|
6310
|
+
break;
|
|
6311
|
+
case "opacity":
|
|
6312
|
+
this._updateGlobalOpacity();
|
|
6313
|
+
break;
|
|
6314
|
+
case "visible":
|
|
6315
|
+
case "insideTimeRange":
|
|
6316
|
+
this._updateGlobalVisible();
|
|
6317
|
+
break;
|
|
6318
|
+
}
|
|
6319
|
+
}
|
|
6320
|
+
show() {
|
|
6321
|
+
this.visible = true;
|
|
6322
|
+
}
|
|
6323
|
+
hide() {
|
|
6324
|
+
this.visible = false;
|
|
6325
|
+
}
|
|
6326
|
+
isVisibleInTree() {
|
|
6327
|
+
return this.globalOpacity > 0 && this.globalVisible;
|
|
6328
|
+
}
|
|
6329
|
+
canRender() {
|
|
6330
|
+
return super.canRender() && this.isVisibleInTree();
|
|
6331
|
+
}
|
|
6332
|
+
requestRedraw() {
|
|
6333
|
+
this._redrawing = true;
|
|
6334
|
+
}
|
|
6335
|
+
requestRelayout() {
|
|
6336
|
+
this._relayouting = true;
|
|
6337
|
+
}
|
|
6338
|
+
requestRepaint() {
|
|
6339
|
+
this._repainting = true;
|
|
6340
|
+
}
|
|
6341
|
+
_updateGlobalVisible() {
|
|
6342
|
+
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
6343
|
+
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
6344
|
+
}
|
|
6345
|
+
_updateGlobalOpacity() {
|
|
6346
|
+
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
6347
|
+
const globalOpacity = clamp(this.opacity, 0, 1) * (this._parentGlobalOpacity ?? 1);
|
|
6348
|
+
if (this._globalOpacity !== globalOpacity) {
|
|
6349
|
+
this._globalOpacity = globalOpacity;
|
|
6350
|
+
this.requestRepaint();
|
|
6351
|
+
}
|
|
6352
|
+
}
|
|
6353
|
+
_draw() {
|
|
6354
|
+
this.emit("draw");
|
|
6355
|
+
}
|
|
6356
|
+
_redraw() {
|
|
6357
|
+
this.log(this.name, "drawing");
|
|
6358
|
+
this._draw();
|
|
6359
|
+
return this.context.toBatchables();
|
|
6360
|
+
}
|
|
6361
|
+
_relayout(batchables) {
|
|
6362
|
+
this.log(this.name, "layouting");
|
|
6363
|
+
return batchables;
|
|
6364
|
+
}
|
|
6365
|
+
_repaint(batchables) {
|
|
6366
|
+
this.log(this.name, "painting");
|
|
6367
|
+
return batchables.map((batchable) => {
|
|
6368
|
+
return {
|
|
6369
|
+
...batchable,
|
|
6370
|
+
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
6371
|
+
blendMode: this.blendMode
|
|
6372
|
+
};
|
|
6373
|
+
});
|
|
6374
|
+
}
|
|
6375
|
+
_process(delta) {
|
|
6376
|
+
super._process(delta);
|
|
6377
|
+
const parent = this.getParent();
|
|
6378
|
+
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
6379
|
+
this._updateGlobalVisible();
|
|
6380
|
+
}
|
|
6381
|
+
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
6382
|
+
this._updateGlobalOpacity();
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
_updateBatchables() {
|
|
6386
|
+
const redrawing = this._redrawing;
|
|
6387
|
+
let relayouting = this._relayouting;
|
|
6388
|
+
let repainting = this._repainting;
|
|
6389
|
+
let batchables;
|
|
6390
|
+
if (redrawing) {
|
|
6391
|
+
this._originalBatchables = this._redraw();
|
|
6392
|
+
relayouting = true;
|
|
6393
|
+
}
|
|
6394
|
+
if (relayouting) {
|
|
6395
|
+
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
6396
|
+
repainting = true;
|
|
6397
|
+
}
|
|
6398
|
+
if (repainting) {
|
|
6399
|
+
batchables = this._repaint(this._layoutedBatchables);
|
|
6400
|
+
}
|
|
6401
|
+
if (redrawing) {
|
|
6402
|
+
if (this._resetContext) {
|
|
6403
|
+
this.context.reset();
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
if (batchables) {
|
|
6407
|
+
this._batchables = batchables;
|
|
6408
|
+
this._redrawing = false;
|
|
6409
|
+
this._relayouting = false;
|
|
6410
|
+
this._repainting = false;
|
|
6411
|
+
}
|
|
6412
|
+
}
|
|
6413
|
+
_render(renderer) {
|
|
6414
|
+
this._updateBatchables();
|
|
6415
|
+
this._batchables.forEach((batchable) => {
|
|
6416
|
+
batchable.texture?.upload(renderer);
|
|
6417
|
+
renderer.batch2D.render({
|
|
6418
|
+
...batchable,
|
|
6419
|
+
texture: batchable.texture?._glTexture(renderer)
|
|
6420
|
+
});
|
|
6421
|
+
});
|
|
6422
|
+
super._render(renderer);
|
|
6423
|
+
}
|
|
6424
|
+
};
|
|
6425
|
+
__decorateClass$Q([
|
|
6426
|
+
property()
|
|
6427
|
+
], CanvasItem.prototype, "modulate", 2);
|
|
6428
|
+
__decorateClass$Q([
|
|
6429
|
+
property()
|
|
6430
|
+
], CanvasItem.prototype, "blendMode", 2);
|
|
6431
|
+
__decorateClass$Q([
|
|
6432
|
+
property({ protected: true, fallback: true })
|
|
6433
|
+
], CanvasItem.prototype, "visible", 2);
|
|
6434
|
+
__decorateClass$Q([
|
|
6435
|
+
property({ protected: true, fallback: 1 })
|
|
6436
|
+
], CanvasItem.prototype, "opacity", 2);
|
|
6437
|
+
CanvasItem = __decorateClass$Q([
|
|
6438
|
+
customNode("CanvasItem")
|
|
6439
|
+
], CanvasItem);
|
|
6440
|
+
|
|
6441
|
+
var __defProp$F = Object.defineProperty;
|
|
6442
|
+
var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
|
|
6443
|
+
var __decorateClass$P = (decorators, target, key, kind) => {
|
|
6444
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
|
|
6445
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6446
|
+
if (decorator = decorators[i])
|
|
6447
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6448
|
+
if (kind && result) __defProp$F(target, key, result);
|
|
6449
|
+
return result;
|
|
6450
|
+
};
|
|
6451
|
+
let Viewport = class extends Node {
|
|
6452
|
+
constructor(flipY = false) {
|
|
6453
|
+
super();
|
|
6454
|
+
this.flipY = flipY;
|
|
6455
|
+
this.projection.flipY(flipY);
|
|
6456
|
+
}
|
|
6457
|
+
projection = new Projection2D();
|
|
6458
|
+
canvasTransform = new Transform2D();
|
|
6459
|
+
_framebufferIndex = 0;
|
|
6460
|
+
_framebuffers = [
|
|
6461
|
+
{ texture: new ViewportTexture(), needsUpload: false },
|
|
6462
|
+
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6463
|
+
];
|
|
6464
|
+
get valid() {
|
|
6465
|
+
return Boolean(this.width && this.height);
|
|
6466
|
+
}
|
|
6467
|
+
get framebuffer() {
|
|
6468
|
+
return this._framebuffers[this._framebufferIndex];
|
|
6469
|
+
}
|
|
6470
|
+
get texture() {
|
|
6471
|
+
return this.framebuffer.texture;
|
|
6472
|
+
}
|
|
6473
|
+
getViewport() {
|
|
6474
|
+
return this;
|
|
6475
|
+
}
|
|
6476
|
+
/** @internal */
|
|
6477
|
+
_glFramebufferOptions(renderer) {
|
|
6478
|
+
const { width, height } = this;
|
|
6479
|
+
const { pixelRatio } = renderer;
|
|
6480
|
+
this._framebuffers.forEach((framebuffer) => {
|
|
6481
|
+
const texture = framebuffer.texture;
|
|
6482
|
+
texture.width = width;
|
|
6229
6483
|
texture.height = height;
|
|
6230
6484
|
texture.pixelRatio = pixelRatio;
|
|
6231
6485
|
texture.upload(renderer);
|
|
@@ -6250,13 +6504,13 @@ let Viewport = class extends Node {
|
|
|
6250
6504
|
case "x":
|
|
6251
6505
|
case "y":
|
|
6252
6506
|
this.requestUpload();
|
|
6253
|
-
this.
|
|
6507
|
+
this.projection.translate(this.x, this.y);
|
|
6254
6508
|
this.emit("updateRect");
|
|
6255
6509
|
break;
|
|
6256
6510
|
case "width":
|
|
6257
6511
|
case "height":
|
|
6258
6512
|
this.requestUpload();
|
|
6259
|
-
this.
|
|
6513
|
+
this.projection.resize(this.width, this.height);
|
|
6260
6514
|
this.emit("updateRect");
|
|
6261
6515
|
break;
|
|
6262
6516
|
}
|
|
@@ -6315,6 +6569,8 @@ let Viewport = class extends Node {
|
|
|
6315
6569
|
}
|
|
6316
6570
|
render(renderer, next) {
|
|
6317
6571
|
const oldViewport = this._tree?.getCurrentViewport();
|
|
6572
|
+
renderer.program.uniforms.projectionMatrix = this.projection.toArray(true);
|
|
6573
|
+
renderer.program.uniforms.worldTransformMatrix = this.canvasTransform.toArray(true);
|
|
6318
6574
|
this.activate(renderer);
|
|
6319
6575
|
renderer.clear();
|
|
6320
6576
|
super.render(renderer, next);
|
|
@@ -6329,9 +6585,6 @@ let Viewport = class extends Node {
|
|
|
6329
6585
|
getRect() {
|
|
6330
6586
|
return new Rect2(this.x, this.y, this.width, this.height);
|
|
6331
6587
|
}
|
|
6332
|
-
toProjectionArray(transpose = false) {
|
|
6333
|
-
return this._projection.toArray(transpose);
|
|
6334
|
-
}
|
|
6335
6588
|
};
|
|
6336
6589
|
__decorateClass$P([
|
|
6337
6590
|
property({ fallback: 0 })
|
|
@@ -6349,14 +6602,14 @@ Viewport = __decorateClass$P([
|
|
|
6349
6602
|
customNode("Viewport")
|
|
6350
6603
|
], Viewport);
|
|
6351
6604
|
|
|
6352
|
-
var __defProp$
|
|
6605
|
+
var __defProp$E = Object.defineProperty;
|
|
6353
6606
|
var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
|
|
6354
6607
|
var __decorateClass$O = (decorators, target, key, kind) => {
|
|
6355
6608
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
|
|
6356
6609
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6357
6610
|
if (decorator = decorators[i])
|
|
6358
6611
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6359
|
-
if (kind && result) __defProp$
|
|
6612
|
+
if (kind && result) __defProp$E(target, key, result);
|
|
6360
6613
|
return result;
|
|
6361
6614
|
};
|
|
6362
6615
|
let Effect = class extends TimelineNode {
|
|
@@ -6614,1044 +6867,1048 @@ Effect = __decorateClass$O([
|
|
|
6614
6867
|
customNode("Effect")
|
|
6615
6868
|
], Effect);
|
|
6616
6869
|
|
|
6617
|
-
|
|
6870
|
+
class RenderStack {
|
|
6871
|
+
currentCall;
|
|
6872
|
+
calls = [];
|
|
6873
|
+
createCall(renderable) {
|
|
6874
|
+
return {
|
|
6875
|
+
renderable,
|
|
6876
|
+
parentCall: this.currentCall,
|
|
6877
|
+
fn: renderable.render.bind(renderable),
|
|
6878
|
+
calls: []
|
|
6879
|
+
};
|
|
6880
|
+
}
|
|
6881
|
+
push(renderable) {
|
|
6882
|
+
const call = this.createCall(renderable);
|
|
6883
|
+
(this.currentCall?.calls ?? this.calls).push(call);
|
|
6884
|
+
return call;
|
|
6885
|
+
}
|
|
6886
|
+
render(renderer) {
|
|
6887
|
+
this.calls.forEach(function render(call) {
|
|
6888
|
+
call.fn(renderer, () => {
|
|
6889
|
+
call.calls.forEach(render);
|
|
6890
|
+
});
|
|
6891
|
+
});
|
|
6892
|
+
this.calls = [];
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
|
|
6896
|
+
var __defProp$D = Object.defineProperty;
|
|
6618
6897
|
var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
|
|
6619
|
-
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6620
6898
|
var __decorateClass$N = (decorators, target, key, kind) => {
|
|
6621
6899
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
|
|
6622
6900
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6623
6901
|
if (decorator = decorators[i])
|
|
6624
6902
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6625
|
-
if (kind && result) __defProp$
|
|
6903
|
+
if (kind && result) __defProp$D(target, key, result);
|
|
6626
6904
|
return result;
|
|
6627
6905
|
};
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
source.redraw(renderer, () => {
|
|
6636
|
-
QuadUvGeometry.draw(renderer, ColorAdjustEffect.material, {
|
|
6637
|
-
sampler: 0,
|
|
6638
|
-
saturation: this.saturation,
|
|
6639
|
-
contrast: this.contrast,
|
|
6640
|
-
brightness: this.brightness,
|
|
6641
|
-
red: this.red,
|
|
6642
|
-
green: this.green,
|
|
6643
|
-
blue: this.blue,
|
|
6644
|
-
alpha: this.alpha,
|
|
6645
|
-
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
6646
|
-
});
|
|
6906
|
+
let Timeline = class extends Node {
|
|
6907
|
+
static from(range, loop = false) {
|
|
6908
|
+
const [startTime, endTime] = range ? Array.isArray(range) ? range : [0, range] : [];
|
|
6909
|
+
return new Timeline({
|
|
6910
|
+
startTime,
|
|
6911
|
+
endTime,
|
|
6912
|
+
loop
|
|
6647
6913
|
});
|
|
6648
6914
|
}
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
attribute vec2 position;
|
|
6653
|
-
attribute vec2 uv;
|
|
6654
|
-
varying vec2 vUv;
|
|
6655
|
-
void main() {
|
|
6656
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
6657
|
-
vUv = uv;
|
|
6658
|
-
}`,
|
|
6659
|
-
frag: `varying vec2 vUv;
|
|
6660
|
-
uniform sampler2D sampler;
|
|
6661
|
-
uniform float gamma;
|
|
6662
|
-
uniform float contrast;
|
|
6663
|
-
uniform float saturation;
|
|
6664
|
-
uniform float brightness;
|
|
6665
|
-
uniform float red;
|
|
6666
|
-
uniform float green;
|
|
6667
|
-
uniform float blue;
|
|
6668
|
-
uniform float alpha;
|
|
6669
|
-
|
|
6670
|
-
void main(void) {
|
|
6671
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6672
|
-
if (c.a > 0.0) {
|
|
6673
|
-
c.rgb /= c.a;
|
|
6674
|
-
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
6675
|
-
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
6676
|
-
rgb.r *= red;
|
|
6677
|
-
rgb.g *= green;
|
|
6678
|
-
rgb.b *= blue;
|
|
6679
|
-
c.rgb = rgb * brightness;
|
|
6680
|
-
c.rgb *= c.a;
|
|
6915
|
+
constructor(properties) {
|
|
6916
|
+
super();
|
|
6917
|
+
this.setProperties(properties);
|
|
6681
6918
|
}
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6919
|
+
_updateProperty(key, value, oldValue) {
|
|
6920
|
+
super._updateProperty(key, value, oldValue);
|
|
6921
|
+
switch (key) {
|
|
6922
|
+
case "startTime":
|
|
6923
|
+
this.startTime = Math.min(value, this.endTime);
|
|
6924
|
+
break;
|
|
6925
|
+
case "endTime":
|
|
6926
|
+
this.endTime = value || Number.MAX_SAFE_INTEGER;
|
|
6927
|
+
break;
|
|
6928
|
+
}
|
|
6929
|
+
}
|
|
6930
|
+
addTime(delta) {
|
|
6931
|
+
const start = this.startTime;
|
|
6932
|
+
const end = this.endTime;
|
|
6933
|
+
let current = this.currentTime;
|
|
6934
|
+
current = current + delta;
|
|
6935
|
+
if (this.loop && current > end) {
|
|
6936
|
+
current = start + current % end;
|
|
6937
|
+
}
|
|
6938
|
+
current = clamp(current, start, end);
|
|
6939
|
+
this.currentTime = current;
|
|
6940
|
+
this.emit("updateCurrentTime", current, delta);
|
|
6941
|
+
return this;
|
|
6942
|
+
}
|
|
6943
|
+
_process(delta) {
|
|
6944
|
+
super._process(delta);
|
|
6945
|
+
this.addTime(delta);
|
|
6946
|
+
}
|
|
6947
|
+
};
|
|
6697
6948
|
__decorateClass$N([
|
|
6698
|
-
property()
|
|
6699
|
-
],
|
|
6949
|
+
property({ fallback: 0 })
|
|
6950
|
+
], Timeline.prototype, "startTime", 2);
|
|
6700
6951
|
__decorateClass$N([
|
|
6701
|
-
property()
|
|
6702
|
-
],
|
|
6952
|
+
property({ fallback: 0 })
|
|
6953
|
+
], Timeline.prototype, "currentTime", 2);
|
|
6703
6954
|
__decorateClass$N([
|
|
6704
|
-
property()
|
|
6705
|
-
],
|
|
6955
|
+
property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
6956
|
+
], Timeline.prototype, "endTime", 2);
|
|
6706
6957
|
__decorateClass$N([
|
|
6707
|
-
property()
|
|
6708
|
-
],
|
|
6709
|
-
|
|
6710
|
-
customNode("
|
|
6711
|
-
],
|
|
6958
|
+
property({ fallback: false })
|
|
6959
|
+
], Timeline.prototype, "loop", 2);
|
|
6960
|
+
Timeline = __decorateClass$N([
|
|
6961
|
+
customNode("Timeline")
|
|
6962
|
+
], Timeline);
|
|
6712
6963
|
|
|
6713
|
-
var __defProp$E = Object.defineProperty;
|
|
6714
6964
|
var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
|
|
6715
|
-
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6716
6965
|
var __decorateClass$M = (decorators, target, key, kind) => {
|
|
6717
6966
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
|
|
6718
6967
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6719
6968
|
if (decorator = decorators[i])
|
|
6720
|
-
result = (
|
|
6721
|
-
if (kind && result) __defProp$E(target, key, result);
|
|
6969
|
+
result = (decorator(result)) || result;
|
|
6722
6970
|
return result;
|
|
6723
6971
|
};
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
_colorMatrix = new ColorMatrix();
|
|
6727
|
-
constructor(properties, children = []) {
|
|
6728
|
-
super();
|
|
6729
|
-
this.setProperties(properties).append(children);
|
|
6730
|
-
}
|
|
6731
|
-
apply(renderer, source) {
|
|
6732
|
-
if (!this.filter)
|
|
6733
|
-
return;
|
|
6734
|
-
const funs = parseCssFunctions(this.filter);
|
|
6735
|
-
const matrix = this._colorMatrix.identity();
|
|
6736
|
-
funs.forEach(({ name, args }) => {
|
|
6737
|
-
const values = args.map((arg) => arg.normalizedIntValue);
|
|
6738
|
-
switch (name) {
|
|
6739
|
-
case "hue-rotate":
|
|
6740
|
-
case "hueRotate":
|
|
6741
|
-
matrix.hueRotate(values[0] * PI_2);
|
|
6742
|
-
break;
|
|
6743
|
-
case "saturate":
|
|
6744
|
-
matrix.saturate(values[0]);
|
|
6745
|
-
break;
|
|
6746
|
-
case "brightness":
|
|
6747
|
-
matrix.brightness(values[0]);
|
|
6748
|
-
break;
|
|
6749
|
-
case "contrast":
|
|
6750
|
-
matrix.contrast(values[0]);
|
|
6751
|
-
break;
|
|
6752
|
-
case "invert":
|
|
6753
|
-
matrix.invert(values[0]);
|
|
6754
|
-
break;
|
|
6755
|
-
case "sepia":
|
|
6756
|
-
matrix.sepia(values[0]);
|
|
6757
|
-
break;
|
|
6758
|
-
case "opacity":
|
|
6759
|
-
matrix.opacity(values[0]);
|
|
6760
|
-
break;
|
|
6761
|
-
case "grayscale":
|
|
6762
|
-
matrix.grayscale(values[0]);
|
|
6763
|
-
break;
|
|
6764
|
-
}
|
|
6765
|
-
});
|
|
6766
|
-
source.redraw(renderer, () => {
|
|
6767
|
-
QuadUvGeometry.draw(renderer, ColorFilterEffect.material, {
|
|
6768
|
-
sampler: 0,
|
|
6769
|
-
m: matrix.toArray()
|
|
6770
|
-
});
|
|
6771
|
-
});
|
|
6772
|
-
}
|
|
6972
|
+
let Window = class extends Viewport {
|
|
6973
|
+
//
|
|
6773
6974
|
};
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
attribute vec2 uv;
|
|
6778
|
-
varying vec2 vUv;
|
|
6779
|
-
void main() {
|
|
6780
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
6781
|
-
vUv = uv;
|
|
6782
|
-
}`,
|
|
6783
|
-
frag: `precision highp float;
|
|
6784
|
-
varying vec2 vUv;
|
|
6785
|
-
uniform sampler2D sampler;
|
|
6786
|
-
uniform float m[20];
|
|
6787
|
-
|
|
6788
|
-
void main(void) {
|
|
6789
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6790
|
-
if (c.a > 0.0) {
|
|
6791
|
-
c.rgb /= c.a;
|
|
6792
|
-
}
|
|
6793
|
-
gl_FragColor = vec4(
|
|
6794
|
-
m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,
|
|
6795
|
-
m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,
|
|
6796
|
-
m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,
|
|
6797
|
-
m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0
|
|
6798
|
-
);
|
|
6799
|
-
}`
|
|
6800
|
-
}));
|
|
6801
|
-
__decorateClass$M([
|
|
6802
|
-
property()
|
|
6803
|
-
], ColorFilterEffect.prototype, "filter", 2);
|
|
6804
|
-
ColorFilterEffect = __decorateClass$M([
|
|
6805
|
-
customNode("ColorFilterEffect")
|
|
6806
|
-
], ColorFilterEffect);
|
|
6975
|
+
Window = __decorateClass$M([
|
|
6976
|
+
customNode("Window")
|
|
6977
|
+
], Window);
|
|
6807
6978
|
|
|
6808
|
-
var __defProp$
|
|
6809
|
-
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
6810
|
-
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6979
|
+
var __defProp$C = Object.defineProperty;
|
|
6811
6980
|
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
6812
|
-
var result =
|
|
6981
|
+
var result = void 0 ;
|
|
6813
6982
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6814
6983
|
if (decorator = decorators[i])
|
|
6815
|
-
result = (
|
|
6816
|
-
if (
|
|
6984
|
+
result = (decorator(target, key, result) ) || result;
|
|
6985
|
+
if (result) __defProp$C(target, key, result);
|
|
6817
6986
|
return result;
|
|
6818
6987
|
};
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6988
|
+
class SceneTree extends MainLoop {
|
|
6989
|
+
input = new Input();
|
|
6990
|
+
renderStack = new RenderStack();
|
|
6991
|
+
root = new Window(true).setTree(this);
|
|
6992
|
+
timeline;
|
|
6993
|
+
_backgroundColor = new Color();
|
|
6994
|
+
_currentViewport;
|
|
6995
|
+
getCurrentViewport() {
|
|
6996
|
+
return this._currentViewport;
|
|
6826
6997
|
}
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
const colors = this.colors.map((val) => {
|
|
6830
|
-
this._color.value = val;
|
|
6831
|
-
const rgba = this._color.toArray();
|
|
6832
|
-
rgba[3] = this.alpha;
|
|
6833
|
-
return rgba;
|
|
6834
|
-
});
|
|
6835
|
-
while (colors.length < MAX_COLORS$1) {
|
|
6836
|
-
colors.push([0, 0, 0, 0]);
|
|
6837
|
-
}
|
|
6838
|
-
QuadUvGeometry.draw(renderer, ColorOverlayEffect.material, {
|
|
6839
|
-
sampler: 0,
|
|
6840
|
-
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
6841
|
-
});
|
|
6842
|
-
});
|
|
6998
|
+
setCurrentViewport(viewport) {
|
|
6999
|
+
this._currentViewport = viewport;
|
|
6843
7000
|
}
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
frag: `precision mediump float;
|
|
6855
|
-
uniform sampler2D sampler;
|
|
6856
|
-
uniform vec4 colors[${MAX_COLORS$1}];
|
|
6857
|
-
varying vec2 vUv;
|
|
6858
|
-
|
|
6859
|
-
float calcWidth() {
|
|
6860
|
-
return distance(vec2(0, 0), vec2(1, 0));
|
|
6861
|
-
}
|
|
6862
|
-
|
|
6863
|
-
int calcCount() {
|
|
6864
|
-
int count = 0;
|
|
6865
|
-
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
6866
|
-
if (colors[i] != vec4(0,0,0,0)){
|
|
6867
|
-
count++;
|
|
6868
|
-
}
|
|
7001
|
+
constructor(timeline = new Timeline()) {
|
|
7002
|
+
super();
|
|
7003
|
+
this.timeline = timeline.setTree(this);
|
|
7004
|
+
}
|
|
7005
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
7006
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
7007
|
+
switch (key) {
|
|
7008
|
+
case "backgroundColor":
|
|
7009
|
+
this._backgroundColor.value = value;
|
|
7010
|
+
break;
|
|
6869
7011
|
}
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
float perUnit = calcWidth() / float(calcCount());
|
|
6875
|
-
int index = int(x / perUnit);
|
|
6876
|
-
|
|
6877
|
-
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
6878
|
-
if(i==index){
|
|
6879
|
-
return colors[i];
|
|
7012
|
+
}
|
|
7013
|
+
log(...args) {
|
|
7014
|
+
if (this.debug) {
|
|
7015
|
+
console.log(`[modern-canvas][${performance.now().toFixed(4)}ms]`, ...args);
|
|
6880
7016
|
}
|
|
6881
7017
|
}
|
|
6882
|
-
|
|
6883
|
-
|
|
7018
|
+
_process(delta = 0) {
|
|
7019
|
+
this.timeline.emit("process", delta);
|
|
7020
|
+
this.emit("processing");
|
|
7021
|
+
this.root.emit("process", delta);
|
|
7022
|
+
this.emit("processed");
|
|
7023
|
+
}
|
|
7024
|
+
_render(renderer) {
|
|
7025
|
+
this.emit("rendering");
|
|
7026
|
+
this.renderStack.render(renderer);
|
|
7027
|
+
this._renderScreen(renderer);
|
|
7028
|
+
this.emit("rendered");
|
|
7029
|
+
}
|
|
7030
|
+
_renderScreen(renderer) {
|
|
7031
|
+
renderer.state.reset();
|
|
7032
|
+
renderer.framebuffer.bind(null);
|
|
7033
|
+
renderer.viewport.bind({
|
|
7034
|
+
x: 0,
|
|
7035
|
+
y: 0,
|
|
7036
|
+
width: this.root.width * renderer.pixelRatio,
|
|
7037
|
+
height: this.root.height * renderer.pixelRatio
|
|
7038
|
+
});
|
|
7039
|
+
if (this.backgroundColor) {
|
|
7040
|
+
renderer.gl.clearColor(...this._backgroundColor.toArray());
|
|
7041
|
+
}
|
|
7042
|
+
renderer.clear();
|
|
7043
|
+
if (this.backgroundColor) {
|
|
7044
|
+
renderer.gl.clearColor(0, 0, 0, 0);
|
|
7045
|
+
}
|
|
7046
|
+
const texture = this.root.texture;
|
|
7047
|
+
texture.activate(renderer, 0);
|
|
7048
|
+
QuadUvGeometry.draw(renderer);
|
|
7049
|
+
renderer.texture.unbind(texture);
|
|
7050
|
+
}
|
|
7051
|
+
free() {
|
|
7052
|
+
super.free();
|
|
7053
|
+
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7054
|
+
this.input.removeEventListeners();
|
|
7055
|
+
}
|
|
6884
7056
|
}
|
|
6885
|
-
|
|
6886
|
-
void main(void) {
|
|
6887
|
-
vec4 color = texture2D(sampler, vUv);
|
|
6888
|
-
vec4 mask = calcColor(vUv.x);
|
|
6889
|
-
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
6890
|
-
}`
|
|
6891
|
-
}));
|
|
6892
7057
|
__decorateClass$L([
|
|
6893
|
-
property()
|
|
6894
|
-
],
|
|
7058
|
+
property({ fallback: false })
|
|
7059
|
+
], SceneTree.prototype, "processPaused");
|
|
6895
7060
|
__decorateClass$L([
|
|
6896
7061
|
property()
|
|
6897
|
-
],
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
],
|
|
7062
|
+
], SceneTree.prototype, "backgroundColor");
|
|
7063
|
+
__decorateClass$L([
|
|
7064
|
+
property({ protected: true, fallback: false })
|
|
7065
|
+
], SceneTree.prototype, "debug");
|
|
6901
7066
|
|
|
6902
|
-
var
|
|
6903
|
-
var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
|
|
6904
|
-
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7067
|
+
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
6905
7068
|
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
6906
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7069
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
|
|
6907
7070
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6908
7071
|
if (decorator = decorators[i])
|
|
6909
|
-
result = (
|
|
6910
|
-
if (kind && result) __defProp$C(target, key, result);
|
|
7072
|
+
result = (decorator(result)) || result;
|
|
6911
7073
|
return result;
|
|
6912
7074
|
};
|
|
6913
|
-
|
|
6914
|
-
let ColorRemoveEffect = class extends Effect {
|
|
6915
|
-
_color = new Color();
|
|
7075
|
+
let Transition = class extends Effect {
|
|
6916
7076
|
constructor(properties, children = []) {
|
|
6917
7077
|
super();
|
|
6918
7078
|
this.setProperties(properties).append(children);
|
|
6919
7079
|
}
|
|
6920
|
-
apply(renderer, source) {
|
|
6921
|
-
const maxColors = 50;
|
|
6922
|
-
const originalColors = new Float32Array(maxColors * 3);
|
|
6923
|
-
const colors = this.colors.map((val) => {
|
|
6924
|
-
this._color.value = val;
|
|
6925
|
-
return this._color.toArray().slice(0, 3);
|
|
6926
|
-
});
|
|
6927
|
-
while (colors.length < maxColors) {
|
|
6928
|
-
colors.push([-1, 0, 0]);
|
|
6929
|
-
}
|
|
6930
|
-
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
6931
|
-
originalColors[i * 3] = originalColor[0];
|
|
6932
|
-
originalColors[i * 3 + 1] = originalColor[1];
|
|
6933
|
-
originalColors[i * 3 + 2] = originalColor[2];
|
|
6934
|
-
});
|
|
6935
|
-
source.redraw(renderer, () => {
|
|
6936
|
-
QuadUvGeometry.draw(renderer, ColorRemoveEffect.material, {
|
|
6937
|
-
sampler: 0,
|
|
6938
|
-
epsilon: this.epsilon,
|
|
6939
|
-
originalColors
|
|
6940
|
-
});
|
|
6941
|
-
});
|
|
6942
|
-
}
|
|
6943
7080
|
};
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
vUv = uv;
|
|
6952
|
-
}`,
|
|
6953
|
-
frag: `varying vec2 vUv;
|
|
6954
|
-
uniform sampler2D sampler;
|
|
6955
|
-
uniform float epsilon;
|
|
6956
|
-
const int MAX_COLORS = 50;
|
|
6957
|
-
uniform vec3 originalColors[MAX_COLORS];
|
|
6958
|
-
|
|
6959
|
-
void main(void) {
|
|
6960
|
-
vec4 color = texture2D(sampler, vUv);
|
|
6961
|
-
|
|
6962
|
-
for (int i = 0; i < MAX_COLORS; i++) {
|
|
6963
|
-
vec3 origColor = originalColors[i];
|
|
6964
|
-
if (origColor.r < 0.0) {
|
|
6965
|
-
break;
|
|
6966
|
-
}
|
|
6967
|
-
vec3 colorDiff = origColor - color.rgb;
|
|
6968
|
-
if (length(colorDiff) < epsilon) {
|
|
6969
|
-
gl_FragColor = vec4(0, 0, 0, 0);
|
|
6970
|
-
return;
|
|
6971
|
-
}
|
|
6972
|
-
}
|
|
6973
|
-
|
|
6974
|
-
gl_FragColor = color;
|
|
6975
|
-
}`
|
|
6976
|
-
}));
|
|
6977
|
-
__decorateClass$K([
|
|
6978
|
-
property()
|
|
6979
|
-
], ColorRemoveEffect.prototype, "colors", 2);
|
|
6980
|
-
__decorateClass$K([
|
|
6981
|
-
property()
|
|
6982
|
-
], ColorRemoveEffect.prototype, "epsilon", 2);
|
|
6983
|
-
ColorRemoveEffect = __decorateClass$K([
|
|
6984
|
-
customNode("ColorRemoveEffect")
|
|
6985
|
-
], ColorRemoveEffect);
|
|
7081
|
+
Transition = __decorateClass$K([
|
|
7082
|
+
customNode("Transition", {
|
|
7083
|
+
effectMode: "transition",
|
|
7084
|
+
processMode: "pausable",
|
|
7085
|
+
duration: 2e3
|
|
7086
|
+
})
|
|
7087
|
+
], Transition);
|
|
6986
7088
|
|
|
6987
7089
|
var __defProp$B = Object.defineProperty;
|
|
6988
|
-
var __getOwnPropDesc$
|
|
6989
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7090
|
+
var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
|
|
6990
7091
|
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
6991
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7092
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
|
|
6992
7093
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6993
7094
|
if (decorator = decorators[i])
|
|
6994
7095
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6995
7096
|
if (kind && result) __defProp$B(target, key, result);
|
|
6996
7097
|
return result;
|
|
6997
7098
|
};
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7099
|
+
let Node2D = class extends CanvasItem {
|
|
7100
|
+
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7101
|
+
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
7102
|
+
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7103
|
+
transform = new Transform2D();
|
|
7104
|
+
globalPosition = new Vector2();
|
|
7105
|
+
globalScale = new Vector2();
|
|
7106
|
+
globalSkew = new Vector2();
|
|
7107
|
+
globalTransform = new Transform2D();
|
|
7108
|
+
_parentTransformDirtyId;
|
|
7109
|
+
constructor(properties, nodes = []) {
|
|
7003
7110
|
super();
|
|
7004
|
-
this.setProperties(properties).append(
|
|
7111
|
+
this.setProperties(properties).append(nodes);
|
|
7005
7112
|
}
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
return [
|
|
7013
|
-
color0,
|
|
7014
|
-
color1
|
|
7015
|
-
];
|
|
7016
|
-
});
|
|
7017
|
-
const epsilon = this.epsilon;
|
|
7018
|
-
const originalColors = new Float32Array(MAX_COLORS * 3);
|
|
7019
|
-
const targetColors = new Float32Array(MAX_COLORS * 3);
|
|
7020
|
-
while (colors.length < MAX_COLORS) {
|
|
7021
|
-
colors.push([
|
|
7022
|
-
[-1, 0, 0],
|
|
7023
|
-
[0, 0, 0, 1]
|
|
7024
|
-
]);
|
|
7113
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
7114
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
7115
|
+
switch (key) {
|
|
7116
|
+
case "rotation":
|
|
7117
|
+
this.requestRelayout();
|
|
7118
|
+
break;
|
|
7025
7119
|
}
|
|
7026
|
-
colors.slice(0, MAX_COLORS).forEach(([originalColor, targetColor], i) => {
|
|
7027
|
-
originalColors[i * 3] = originalColor[0];
|
|
7028
|
-
originalColors[i * 3 + 1] = originalColor[1];
|
|
7029
|
-
originalColors[i * 3 + 2] = originalColor[2];
|
|
7030
|
-
targetColors[i * 3] = targetColor[0];
|
|
7031
|
-
targetColors[i * 3 + 1] = targetColor[1];
|
|
7032
|
-
targetColors[i * 3 + 2] = targetColor[2];
|
|
7033
|
-
});
|
|
7034
|
-
source.redraw(renderer, () => {
|
|
7035
|
-
QuadUvGeometry.draw(renderer, ColorReplaceEffect.material, {
|
|
7036
|
-
sampler: 0,
|
|
7037
|
-
epsilon,
|
|
7038
|
-
originalColors,
|
|
7039
|
-
targetColors
|
|
7040
|
-
});
|
|
7041
|
-
});
|
|
7042
|
-
}
|
|
7043
|
-
};
|
|
7044
|
-
__publicField$e(ColorReplaceEffect, "material", new Material({
|
|
7045
|
-
vert: `precision mediump float;
|
|
7046
|
-
attribute vec2 position;
|
|
7047
|
-
attribute vec2 uv;
|
|
7048
|
-
varying vec2 vUv;
|
|
7049
|
-
void main() {
|
|
7050
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
7051
|
-
vUv = uv;
|
|
7052
|
-
}`,
|
|
7053
|
-
frag: `varying vec2 vUv;
|
|
7054
|
-
uniform sampler2D sampler;
|
|
7055
|
-
uniform float epsilon;
|
|
7056
|
-
const int MAX_COLORS = ${MAX_COLORS};
|
|
7057
|
-
uniform vec3 originalColors[MAX_COLORS];
|
|
7058
|
-
uniform vec3 targetColors[MAX_COLORS];
|
|
7059
|
-
|
|
7060
|
-
void main(void) {
|
|
7061
|
-
gl_FragColor = texture2D(sampler, vUv);
|
|
7062
|
-
|
|
7063
|
-
float alpha = gl_FragColor.a;
|
|
7064
|
-
if (alpha < 0.0001) {
|
|
7065
|
-
return;
|
|
7066
7120
|
}
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
for(int i = 0; i < MAX_COLORS; i++) {
|
|
7071
|
-
vec3 origColor = originalColors[i];
|
|
7072
|
-
if (origColor.r < 0.0) {
|
|
7073
|
-
break;
|
|
7074
|
-
}
|
|
7075
|
-
vec3 colorDiff = origColor - color;
|
|
7076
|
-
if (length(colorDiff) < epsilon) {
|
|
7077
|
-
vec3 targetColor = targetColors[i];
|
|
7078
|
-
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7079
|
-
return;
|
|
7080
|
-
}
|
|
7121
|
+
getTransformOrigin() {
|
|
7122
|
+
return new Vector2(0, 0);
|
|
7081
7123
|
}
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
// custom
|
|
7102
|
-
uvTransform;
|
|
7103
|
-
vertTransform;
|
|
7104
|
-
_defaultStyle = Texture2D.EMPTY;
|
|
7105
|
-
_draws = [];
|
|
7106
|
-
_toTexture(source) {
|
|
7107
|
-
if (source instanceof Texture2D) {
|
|
7108
|
-
return source;
|
|
7124
|
+
getTransform(cb) {
|
|
7125
|
+
const origin = this.getTransformOrigin();
|
|
7126
|
+
const transform = new Transform2D();
|
|
7127
|
+
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
7128
|
+
cb?.(transform);
|
|
7129
|
+
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
7130
|
+
return transform;
|
|
7131
|
+
}
|
|
7132
|
+
updateTransform() {
|
|
7133
|
+
this.transform.copy(this.getTransform());
|
|
7134
|
+
}
|
|
7135
|
+
updateGlobalTransform() {
|
|
7136
|
+
this.updateTransform();
|
|
7137
|
+
const parent = this.getParent();
|
|
7138
|
+
if (parent?.globalTransform) {
|
|
7139
|
+
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
7140
|
+
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
7141
|
+
this.globalRotation = parent.globalRotation + this.rotation;
|
|
7142
|
+
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
7109
7143
|
} else {
|
|
7110
|
-
|
|
7144
|
+
this.globalScale.copy(this.scale);
|
|
7145
|
+
this.globalRotation = this.rotation;
|
|
7146
|
+
this.globalTransform.copy(this.transform);
|
|
7111
7147
|
}
|
|
7148
|
+
const [
|
|
7149
|
+
a,
|
|
7150
|
+
c,
|
|
7151
|
+
tx,
|
|
7152
|
+
b,
|
|
7153
|
+
d,
|
|
7154
|
+
ty
|
|
7155
|
+
] = this.globalTransform.toArray();
|
|
7156
|
+
this.globalPosition.set(tx, ty);
|
|
7157
|
+
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
7158
|
+
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
7159
|
+
this.requestRelayout();
|
|
7112
7160
|
}
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7161
|
+
_transformVertices(vertices, vertTransform) {
|
|
7162
|
+
let a, c, tx, b, d, ty;
|
|
7163
|
+
if (vertTransform) {
|
|
7164
|
+
const globalTransform = this.globalTransform.clone();
|
|
7165
|
+
globalTransform.multiply(
|
|
7166
|
+
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
7167
|
+
);
|
|
7168
|
+
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
7169
|
+
} else {
|
|
7170
|
+
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
7116
7171
|
}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
case "object":
|
|
7124
|
-
if (isColorFillObject(this.style.stroke)) {
|
|
7125
|
-
strokeStyle = this.style.stroke.color;
|
|
7126
|
-
}
|
|
7127
|
-
break;
|
|
7128
|
-
}
|
|
7172
|
+
const newVertices = vertices.slice();
|
|
7173
|
+
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
7174
|
+
const x = vertices[i];
|
|
7175
|
+
const y = vertices[i + 1];
|
|
7176
|
+
newVertices[i] = a * x + c * y + tx;
|
|
7177
|
+
newVertices[i + 1] = b * x + d * y + ty;
|
|
7129
7178
|
}
|
|
7130
|
-
|
|
7131
|
-
...options,
|
|
7132
|
-
type: "stroke",
|
|
7133
|
-
path: new Path2D(this),
|
|
7134
|
-
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7135
|
-
uvTransform: this.uvTransform,
|
|
7136
|
-
vertTransform: this.vertTransform,
|
|
7137
|
-
style: {
|
|
7138
|
-
alignment: 0.5,
|
|
7139
|
-
cap: this.lineCap ?? "butt",
|
|
7140
|
-
join: this.lineJoin ?? "miter",
|
|
7141
|
-
width: this.lineWidth ?? 1,
|
|
7142
|
-
miterLimit: this.miterLimit ?? 10
|
|
7143
|
-
}
|
|
7144
|
-
});
|
|
7145
|
-
super.reset();
|
|
7146
|
-
}
|
|
7147
|
-
fillRect(x, y, width, height) {
|
|
7148
|
-
this.rect(x, y, width, height).fill();
|
|
7179
|
+
return newVertices;
|
|
7149
7180
|
}
|
|
7150
|
-
|
|
7151
|
-
|
|
7181
|
+
_relayout(batchables) {
|
|
7182
|
+
batchables = super._relayout(batchables);
|
|
7183
|
+
this.updateGlobalTransform();
|
|
7184
|
+
return batchables.map((batchable) => {
|
|
7185
|
+
return {
|
|
7186
|
+
...batchable,
|
|
7187
|
+
vertices: this._transformVertices(batchable.vertices, batchable.vertTransform)
|
|
7188
|
+
};
|
|
7189
|
+
});
|
|
7152
7190
|
}
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
if (!fillStyle && this.style.fill) {
|
|
7159
|
-
switch (typeof this.style.fill) {
|
|
7160
|
-
case "string":
|
|
7161
|
-
fillStyle = this.style.fill;
|
|
7162
|
-
break;
|
|
7163
|
-
case "object":
|
|
7164
|
-
if (isColorFillObject(this.style.fill)) {
|
|
7165
|
-
fillStyle = this.style.fill.color;
|
|
7166
|
-
}
|
|
7167
|
-
break;
|
|
7168
|
-
}
|
|
7191
|
+
_process(delta) {
|
|
7192
|
+
super._process(delta);
|
|
7193
|
+
const parent = this.getParent();
|
|
7194
|
+
if (parent?.globalTransform && this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
|
|
7195
|
+
this.requestRelayout();
|
|
7169
7196
|
}
|
|
7170
|
-
this._draws.push({
|
|
7171
|
-
...options,
|
|
7172
|
-
type: "fill",
|
|
7173
|
-
path: new Path2D(this),
|
|
7174
|
-
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7175
|
-
uvTransform: this.uvTransform,
|
|
7176
|
-
vertTransform: this.vertTransform
|
|
7177
|
-
});
|
|
7178
|
-
super.reset();
|
|
7179
7197
|
}
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7198
|
+
};
|
|
7199
|
+
__decorateClass$J([
|
|
7200
|
+
property({ protected: true, fallback: 0 })
|
|
7201
|
+
], Node2D.prototype, "rotation", 2);
|
|
7202
|
+
__decorateClass$J([
|
|
7203
|
+
property({ protected: true, fallback: 0 })
|
|
7204
|
+
], Node2D.prototype, "globalRotation", 2);
|
|
7205
|
+
Node2D = __decorateClass$J([
|
|
7206
|
+
customNode("Node2D")
|
|
7207
|
+
], Node2D);
|
|
7208
|
+
|
|
7209
|
+
var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
|
|
7210
|
+
var __decorateClass$I = (decorators, target, key, kind) => {
|
|
7211
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
|
|
7212
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7213
|
+
if (decorator = decorators[i])
|
|
7214
|
+
result = (decorator(result)) || result;
|
|
7215
|
+
return result;
|
|
7216
|
+
};
|
|
7217
|
+
let Camera2D = class extends Node2D {
|
|
7218
|
+
zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
|
|
7219
|
+
maxZoom = new Vector2(6, 6);
|
|
7220
|
+
minZoom = new Vector2(0.1, 0.1);
|
|
7221
|
+
constructor(properties, nodes = []) {
|
|
7222
|
+
super();
|
|
7223
|
+
this.setProperties(properties).append(nodes);
|
|
7224
|
+
}
|
|
7225
|
+
addZoom(x, y = x) {
|
|
7226
|
+
this.zoom.set(
|
|
7227
|
+
clamp(this.zoom.x + x, this.minZoom.x, this.maxZoom.x),
|
|
7228
|
+
clamp(this.zoom.y + y, this.minZoom.y, this.maxZoom.y)
|
|
7229
|
+
);
|
|
7191
7230
|
return this;
|
|
7192
7231
|
}
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
this.vertTransform = void 0;
|
|
7199
|
-
this.lineCap = void 0;
|
|
7200
|
-
this.lineJoin = void 0;
|
|
7201
|
-
this.lineWidth = void 0;
|
|
7202
|
-
this.miterLimit = void 0;
|
|
7203
|
-
this._draws.length = 0;
|
|
7232
|
+
setZoom(x, y = x) {
|
|
7233
|
+
this.zoom.set(
|
|
7234
|
+
clamp(x, this.minZoom.x, this.maxZoom.x),
|
|
7235
|
+
clamp(y, this.minZoom.y, this.maxZoom.y)
|
|
7236
|
+
);
|
|
7204
7237
|
return this;
|
|
7205
7238
|
}
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
const
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7239
|
+
_input(event, key) {
|
|
7240
|
+
super._input(event, key);
|
|
7241
|
+
if (key === "wheel") {
|
|
7242
|
+
const e = event;
|
|
7243
|
+
if (e.ctrlKey) {
|
|
7244
|
+
const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
|
|
7245
|
+
if (!isTouchPad) {
|
|
7246
|
+
e.preventDefault();
|
|
7247
|
+
const oldZoom = this.zoom.x;
|
|
7248
|
+
this.addZoom(e.deltaY * -0.015);
|
|
7249
|
+
const ratio = 1 - this.zoom.x / oldZoom;
|
|
7250
|
+
this.position.add(
|
|
7251
|
+
(e.screenX - this.position.x) * ratio,
|
|
7252
|
+
(e.screenY - this.position.y) * ratio
|
|
7253
|
+
);
|
|
7220
7254
|
}
|
|
7221
|
-
uvs.push(uvX, uvY);
|
|
7222
|
-
}
|
|
7223
|
-
} else {
|
|
7224
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7225
|
-
uvs.push(0, 0);
|
|
7226
|
-
}
|
|
7227
|
-
}
|
|
7228
|
-
}
|
|
7229
|
-
toBatchables() {
|
|
7230
|
-
const batchables = [];
|
|
7231
|
-
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
7232
|
-
const current = this._draws[i];
|
|
7233
|
-
const vertices = [];
|
|
7234
|
-
const indices = [];
|
|
7235
|
-
const uvs = [];
|
|
7236
|
-
if (current.type === "fill") {
|
|
7237
|
-
current.path.fillTriangulate({
|
|
7238
|
-
vertices,
|
|
7239
|
-
indices
|
|
7240
|
-
});
|
|
7241
7255
|
} else {
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
indices,
|
|
7245
|
-
lineStyle: current.style,
|
|
7246
|
-
flipAlignment: false,
|
|
7247
|
-
closed: true
|
|
7248
|
-
});
|
|
7256
|
+
e.preventDefault();
|
|
7257
|
+
this.position.add(-e.deltaX, -e.deltaY);
|
|
7249
7258
|
}
|
|
7250
|
-
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
7251
|
-
batchables.push({
|
|
7252
|
-
vertices,
|
|
7253
|
-
indices,
|
|
7254
|
-
uvs,
|
|
7255
|
-
texture: current.texture,
|
|
7256
|
-
type: current.type,
|
|
7257
|
-
disableWrapMode: current.disableWrapMode,
|
|
7258
|
-
vertTransform: current.vertTransform
|
|
7259
|
-
});
|
|
7260
7259
|
}
|
|
7261
|
-
return batchables;
|
|
7262
7260
|
}
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
|
|
7267
|
-
var __decorateClass$I = (decorators, target, key, kind) => {
|
|
7268
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
|
|
7269
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7270
|
-
if (decorator = decorators[i])
|
|
7271
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7272
|
-
if (kind && result) __defProp$A(target, key, result);
|
|
7273
|
-
return result;
|
|
7274
|
-
};
|
|
7275
|
-
let CanvasItem = class extends TimelineNode {
|
|
7276
|
-
_parentGlobalVisible;
|
|
7277
|
-
_globalVisible;
|
|
7278
|
-
get globalVisible() {
|
|
7279
|
-
return this._globalVisible ?? true;
|
|
7261
|
+
updateTransform() {
|
|
7262
|
+
super.updateTransform();
|
|
7263
|
+
this.updateCanvasTransform();
|
|
7280
7264
|
}
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7265
|
+
updateCanvasTransform() {
|
|
7266
|
+
const viewport = this.getViewport();
|
|
7267
|
+
if (!viewport)
|
|
7268
|
+
return;
|
|
7269
|
+
viewport.canvasTransform.identity().scale(this.zoom.x, this.zoom.y).translate(this.position.x, this.position.y);
|
|
7270
|
+
this.emit("updateCanvasTransform");
|
|
7285
7271
|
}
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7272
|
+
};
|
|
7273
|
+
Camera2D = __decorateClass$I([
|
|
7274
|
+
customNode("Camera2D", {
|
|
7275
|
+
processMode: "disabled",
|
|
7276
|
+
renderMode: "disabled"
|
|
7277
|
+
})
|
|
7278
|
+
], Camera2D);
|
|
7279
|
+
|
|
7280
|
+
const defaultFilters = {
|
|
7281
|
+
"brightness": 1,
|
|
7282
|
+
"contrast": 1,
|
|
7283
|
+
"grayscale": 0,
|
|
7284
|
+
"hue-rotate": 0,
|
|
7285
|
+
"invert": 0,
|
|
7286
|
+
"opacity": 1,
|
|
7287
|
+
"saturate": 1,
|
|
7288
|
+
"sepia": 0
|
|
7289
|
+
};
|
|
7290
|
+
function parseCSSFilter(filter) {
|
|
7291
|
+
const m = new ColorMatrix();
|
|
7292
|
+
if (filter === "none") {
|
|
7293
|
+
return m;
|
|
7299
7294
|
}
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7295
|
+
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
7296
|
+
filter2[name] = args[0].normalizedIntValue;
|
|
7297
|
+
return filter2;
|
|
7298
|
+
}, {});
|
|
7299
|
+
Object.keys(defaultFilters).forEach((name) => {
|
|
7300
|
+
filters[name] = filters[name] ?? defaultFilters[name];
|
|
7301
|
+
});
|
|
7302
|
+
for (const name in filters) {
|
|
7303
|
+
const value = filters[name];
|
|
7304
|
+
switch (name) {
|
|
7305
|
+
case "hue-rotate":
|
|
7306
|
+
m.hueRotate(value * PI_2);
|
|
7306
7307
|
break;
|
|
7307
|
-
case "
|
|
7308
|
-
|
|
7308
|
+
case "saturate":
|
|
7309
|
+
m.saturate(value);
|
|
7310
|
+
break;
|
|
7311
|
+
case "brightness":
|
|
7312
|
+
m.brightness(value);
|
|
7313
|
+
break;
|
|
7314
|
+
case "contrast":
|
|
7315
|
+
m.contrast(value);
|
|
7316
|
+
break;
|
|
7317
|
+
case "invert":
|
|
7318
|
+
m.invert(value);
|
|
7319
|
+
break;
|
|
7320
|
+
case "sepia":
|
|
7321
|
+
m.sepia(value);
|
|
7309
7322
|
break;
|
|
7310
7323
|
case "opacity":
|
|
7311
|
-
|
|
7324
|
+
m.opacity(value);
|
|
7312
7325
|
break;
|
|
7313
|
-
case "
|
|
7314
|
-
|
|
7315
|
-
this._updateGlobalVisible();
|
|
7326
|
+
case "grayscale":
|
|
7327
|
+
m.grayscale(value);
|
|
7316
7328
|
break;
|
|
7317
7329
|
}
|
|
7318
7330
|
}
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
}
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
this._originalBatchables = this._redraw();
|
|
7391
|
-
relayouting = true;
|
|
7392
|
-
}
|
|
7393
|
-
if (relayouting) {
|
|
7394
|
-
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
7395
|
-
repainting = true;
|
|
7396
|
-
}
|
|
7397
|
-
if (repainting) {
|
|
7398
|
-
batchables = this._repaint(this._layoutedBatchables);
|
|
7399
|
-
}
|
|
7400
|
-
if (redrawing) {
|
|
7401
|
-
if (this._resetContext) {
|
|
7402
|
-
this.context.reset();
|
|
7403
|
-
}
|
|
7331
|
+
return m;
|
|
7332
|
+
}
|
|
7333
|
+
|
|
7334
|
+
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
7335
|
+
transform = !transform || transform === "none" ? "" : transform;
|
|
7336
|
+
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
7337
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7338
|
+
switch (name) {
|
|
7339
|
+
case "translate":
|
|
7340
|
+
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
7341
|
+
break;
|
|
7342
|
+
case "translateX":
|
|
7343
|
+
output.translateX(values[0] * width);
|
|
7344
|
+
break;
|
|
7345
|
+
case "translateY":
|
|
7346
|
+
output.translateY(values[0] * height);
|
|
7347
|
+
break;
|
|
7348
|
+
case "translateZ":
|
|
7349
|
+
output.translateZ(values[0]);
|
|
7350
|
+
break;
|
|
7351
|
+
case "translate3d":
|
|
7352
|
+
output.translate3d(
|
|
7353
|
+
values[0] * width,
|
|
7354
|
+
(values[1] ?? values[0]) * height,
|
|
7355
|
+
values[2] ?? values[1] ?? values[0]
|
|
7356
|
+
);
|
|
7357
|
+
break;
|
|
7358
|
+
case "scale":
|
|
7359
|
+
output.scale(values[0], values[1] ?? values[0]);
|
|
7360
|
+
break;
|
|
7361
|
+
case "scaleX":
|
|
7362
|
+
output.scaleX(values[0]);
|
|
7363
|
+
break;
|
|
7364
|
+
case "scaleY":
|
|
7365
|
+
output.scaleY(values[0]);
|
|
7366
|
+
break;
|
|
7367
|
+
case "scale3d":
|
|
7368
|
+
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
7369
|
+
break;
|
|
7370
|
+
case "rotate":
|
|
7371
|
+
output.rotate(values[0] * PI_2);
|
|
7372
|
+
break;
|
|
7373
|
+
case "rotateX":
|
|
7374
|
+
output.rotateX(values[0] * PI_2);
|
|
7375
|
+
break;
|
|
7376
|
+
case "rotateY":
|
|
7377
|
+
output.rotateY(values[0] * PI_2);
|
|
7378
|
+
break;
|
|
7379
|
+
case "rotateZ":
|
|
7380
|
+
output.rotateZ(values[0] * PI_2);
|
|
7381
|
+
break;
|
|
7382
|
+
case "rotate3d":
|
|
7383
|
+
output.rotate3d(
|
|
7384
|
+
values[0] * PI_2,
|
|
7385
|
+
(values[1] ?? values[0]) * PI_2,
|
|
7386
|
+
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
7387
|
+
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
7388
|
+
);
|
|
7389
|
+
break;
|
|
7390
|
+
case "skew":
|
|
7391
|
+
output.skew(values[0], values[0] ?? values[1]);
|
|
7392
|
+
break;
|
|
7393
|
+
case "skewX":
|
|
7394
|
+
output.skewX(values[0]);
|
|
7395
|
+
break;
|
|
7396
|
+
case "skewY":
|
|
7397
|
+
output.skewY(values[0]);
|
|
7398
|
+
break;
|
|
7399
|
+
case "matrix":
|
|
7400
|
+
output.set(values);
|
|
7401
|
+
break;
|
|
7404
7402
|
}
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7403
|
+
});
|
|
7404
|
+
return output;
|
|
7405
|
+
}
|
|
7406
|
+
|
|
7407
|
+
function parseCSSTransformOrigin(transformOrigin) {
|
|
7408
|
+
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
7409
|
+
return [originX, originY].map((val) => {
|
|
7410
|
+
val = val.trim();
|
|
7411
|
+
switch (val) {
|
|
7412
|
+
case "left":
|
|
7413
|
+
case "top":
|
|
7414
|
+
return 0;
|
|
7415
|
+
case "center":
|
|
7416
|
+
return 0.5;
|
|
7417
|
+
case "right":
|
|
7418
|
+
case "bottom":
|
|
7419
|
+
return 1;
|
|
7420
|
+
default:
|
|
7421
|
+
return Number(val);
|
|
7410
7422
|
}
|
|
7423
|
+
});
|
|
7424
|
+
}
|
|
7425
|
+
|
|
7426
|
+
var __defProp$A = Object.defineProperty;
|
|
7427
|
+
var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
|
|
7428
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7429
|
+
var __decorateClass$H = (decorators, target, key, kind) => {
|
|
7430
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
|
|
7431
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7432
|
+
if (decorator = decorators[i])
|
|
7433
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7434
|
+
if (kind && result) __defProp$A(target, key, result);
|
|
7435
|
+
return result;
|
|
7436
|
+
};
|
|
7437
|
+
var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
|
|
7438
|
+
let ColorAdjustEffect = class extends Effect {
|
|
7439
|
+
constructor(properties, children = []) {
|
|
7440
|
+
super();
|
|
7441
|
+
this.setProperties(properties).append(children);
|
|
7411
7442
|
}
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7443
|
+
apply(renderer, source) {
|
|
7444
|
+
source.redraw(renderer, () => {
|
|
7445
|
+
QuadUvGeometry.draw(renderer, ColorAdjustEffect.material, {
|
|
7446
|
+
sampler: 0,
|
|
7447
|
+
saturation: this.saturation,
|
|
7448
|
+
contrast: this.contrast,
|
|
7449
|
+
brightness: this.brightness,
|
|
7450
|
+
red: this.red,
|
|
7451
|
+
green: this.green,
|
|
7452
|
+
blue: this.blue,
|
|
7453
|
+
alpha: this.alpha,
|
|
7454
|
+
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
7419
7455
|
});
|
|
7420
7456
|
});
|
|
7421
|
-
super._render(renderer);
|
|
7422
7457
|
}
|
|
7423
7458
|
};
|
|
7424
|
-
|
|
7459
|
+
__publicField$i(ColorAdjustEffect, "material", new Material({
|
|
7460
|
+
vert: `precision mediump float;
|
|
7461
|
+
attribute vec2 position;
|
|
7462
|
+
attribute vec2 uv;
|
|
7463
|
+
varying vec2 vUv;
|
|
7464
|
+
void main() {
|
|
7465
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7466
|
+
vUv = uv;
|
|
7467
|
+
}`,
|
|
7468
|
+
frag: `varying vec2 vUv;
|
|
7469
|
+
uniform sampler2D sampler;
|
|
7470
|
+
uniform float gamma;
|
|
7471
|
+
uniform float contrast;
|
|
7472
|
+
uniform float saturation;
|
|
7473
|
+
uniform float brightness;
|
|
7474
|
+
uniform float red;
|
|
7475
|
+
uniform float green;
|
|
7476
|
+
uniform float blue;
|
|
7477
|
+
uniform float alpha;
|
|
7478
|
+
|
|
7479
|
+
void main(void) {
|
|
7480
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7481
|
+
if (c.a > 0.0) {
|
|
7482
|
+
c.rgb /= c.a;
|
|
7483
|
+
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
7484
|
+
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
7485
|
+
rgb.r *= red;
|
|
7486
|
+
rgb.g *= green;
|
|
7487
|
+
rgb.b *= blue;
|
|
7488
|
+
c.rgb = rgb * brightness;
|
|
7489
|
+
c.rgb *= c.a;
|
|
7490
|
+
}
|
|
7491
|
+
gl_FragColor = c * alpha;
|
|
7492
|
+
}`
|
|
7493
|
+
}));
|
|
7494
|
+
__decorateClass$H([
|
|
7425
7495
|
property()
|
|
7426
|
-
],
|
|
7427
|
-
__decorateClass$
|
|
7496
|
+
], ColorAdjustEffect.prototype, "saturation", 2);
|
|
7497
|
+
__decorateClass$H([
|
|
7428
7498
|
property()
|
|
7429
|
-
],
|
|
7430
|
-
__decorateClass$
|
|
7431
|
-
property(
|
|
7432
|
-
],
|
|
7433
|
-
__decorateClass$
|
|
7434
|
-
property(
|
|
7435
|
-
],
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
],
|
|
7499
|
+
], ColorAdjustEffect.prototype, "contrast", 2);
|
|
7500
|
+
__decorateClass$H([
|
|
7501
|
+
property()
|
|
7502
|
+
], ColorAdjustEffect.prototype, "brightness", 2);
|
|
7503
|
+
__decorateClass$H([
|
|
7504
|
+
property()
|
|
7505
|
+
], ColorAdjustEffect.prototype, "red", 2);
|
|
7506
|
+
__decorateClass$H([
|
|
7507
|
+
property()
|
|
7508
|
+
], ColorAdjustEffect.prototype, "green", 2);
|
|
7509
|
+
__decorateClass$H([
|
|
7510
|
+
property()
|
|
7511
|
+
], ColorAdjustEffect.prototype, "blue", 2);
|
|
7512
|
+
__decorateClass$H([
|
|
7513
|
+
property()
|
|
7514
|
+
], ColorAdjustEffect.prototype, "alpha", 2);
|
|
7515
|
+
__decorateClass$H([
|
|
7516
|
+
property()
|
|
7517
|
+
], ColorAdjustEffect.prototype, "gamma", 2);
|
|
7518
|
+
ColorAdjustEffect = __decorateClass$H([
|
|
7519
|
+
customNode("ColorAdjustEffect")
|
|
7520
|
+
], ColorAdjustEffect);
|
|
7439
7521
|
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7522
|
+
var __defProp$z = Object.defineProperty;
|
|
7523
|
+
var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
|
|
7524
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7525
|
+
var __decorateClass$G = (decorators, target, key, kind) => {
|
|
7526
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
|
|
7527
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7528
|
+
if (decorator = decorators[i])
|
|
7529
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7530
|
+
if (kind && result) __defProp$z(target, key, result);
|
|
7531
|
+
return result;
|
|
7532
|
+
};
|
|
7533
|
+
var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
|
|
7534
|
+
let ColorFilterEffect = class extends Effect {
|
|
7535
|
+
_colorMatrix = new ColorMatrix();
|
|
7536
|
+
constructor(properties, children = []) {
|
|
7537
|
+
super();
|
|
7538
|
+
this.setProperties(properties).append(children);
|
|
7455
7539
|
}
|
|
7456
|
-
|
|
7457
|
-
this.
|
|
7458
|
-
|
|
7459
|
-
|
|
7540
|
+
apply(renderer, source) {
|
|
7541
|
+
if (!this.filter)
|
|
7542
|
+
return;
|
|
7543
|
+
const funs = parseCssFunctions(this.filter);
|
|
7544
|
+
const matrix = this._colorMatrix.identity();
|
|
7545
|
+
funs.forEach(({ name, args }) => {
|
|
7546
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7547
|
+
switch (name) {
|
|
7548
|
+
case "hue-rotate":
|
|
7549
|
+
case "hueRotate":
|
|
7550
|
+
matrix.hueRotate(values[0] * PI_2);
|
|
7551
|
+
break;
|
|
7552
|
+
case "saturate":
|
|
7553
|
+
matrix.saturate(values[0]);
|
|
7554
|
+
break;
|
|
7555
|
+
case "brightness":
|
|
7556
|
+
matrix.brightness(values[0]);
|
|
7557
|
+
break;
|
|
7558
|
+
case "contrast":
|
|
7559
|
+
matrix.contrast(values[0]);
|
|
7560
|
+
break;
|
|
7561
|
+
case "invert":
|
|
7562
|
+
matrix.invert(values[0]);
|
|
7563
|
+
break;
|
|
7564
|
+
case "sepia":
|
|
7565
|
+
matrix.sepia(values[0]);
|
|
7566
|
+
break;
|
|
7567
|
+
case "opacity":
|
|
7568
|
+
matrix.opacity(values[0]);
|
|
7569
|
+
break;
|
|
7570
|
+
case "grayscale":
|
|
7571
|
+
matrix.grayscale(values[0]);
|
|
7572
|
+
break;
|
|
7573
|
+
}
|
|
7574
|
+
});
|
|
7575
|
+
source.redraw(renderer, () => {
|
|
7576
|
+
QuadUvGeometry.draw(renderer, ColorFilterEffect.material, {
|
|
7577
|
+
sampler: 0,
|
|
7578
|
+
m: matrix.toArray()
|
|
7460
7579
|
});
|
|
7461
7580
|
});
|
|
7462
|
-
this.calls = [];
|
|
7463
7581
|
}
|
|
7464
|
-
}
|
|
7582
|
+
};
|
|
7583
|
+
__publicField$h(ColorFilterEffect, "material", new Material({
|
|
7584
|
+
vert: `precision mediump float;
|
|
7585
|
+
attribute vec2 position;
|
|
7586
|
+
attribute vec2 uv;
|
|
7587
|
+
varying vec2 vUv;
|
|
7588
|
+
void main() {
|
|
7589
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7590
|
+
vUv = uv;
|
|
7591
|
+
}`,
|
|
7592
|
+
frag: `precision highp float;
|
|
7593
|
+
varying vec2 vUv;
|
|
7594
|
+
uniform sampler2D sampler;
|
|
7595
|
+
uniform float m[20];
|
|
7465
7596
|
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7597
|
+
void main(void) {
|
|
7598
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7599
|
+
if (c.a > 0.0) {
|
|
7600
|
+
c.rgb /= c.a;
|
|
7601
|
+
}
|
|
7602
|
+
gl_FragColor = vec4(
|
|
7603
|
+
m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,
|
|
7604
|
+
m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,
|
|
7605
|
+
m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,
|
|
7606
|
+
m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0
|
|
7607
|
+
);
|
|
7608
|
+
}`
|
|
7609
|
+
}));
|
|
7610
|
+
__decorateClass$G([
|
|
7611
|
+
property()
|
|
7612
|
+
], ColorFilterEffect.prototype, "filter", 2);
|
|
7613
|
+
ColorFilterEffect = __decorateClass$G([
|
|
7614
|
+
customNode("ColorFilterEffect")
|
|
7615
|
+
], ColorFilterEffect);
|
|
7616
|
+
|
|
7617
|
+
var __defProp$y = Object.defineProperty;
|
|
7618
|
+
var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
|
|
7619
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7620
|
+
var __decorateClass$F = (decorators, target, key, kind) => {
|
|
7621
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
|
|
7470
7622
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7471
7623
|
if (decorator = decorators[i])
|
|
7472
7624
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7473
|
-
if (kind && result) __defProp$
|
|
7625
|
+
if (kind && result) __defProp$y(target, key, result);
|
|
7474
7626
|
return result;
|
|
7475
7627
|
};
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
endTime,
|
|
7482
|
-
loop
|
|
7483
|
-
});
|
|
7484
|
-
}
|
|
7485
|
-
constructor(properties) {
|
|
7628
|
+
var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
|
|
7629
|
+
const MAX_COLORS$1 = 50;
|
|
7630
|
+
let ColorOverlayEffect = class extends Effect {
|
|
7631
|
+
_color = new Color();
|
|
7632
|
+
constructor(properties, children = []) {
|
|
7486
7633
|
super();
|
|
7487
|
-
this.setProperties(properties);
|
|
7634
|
+
this.setProperties(properties).append(children);
|
|
7488
7635
|
}
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7636
|
+
apply(renderer, source) {
|
|
7637
|
+
source.redraw(renderer, () => {
|
|
7638
|
+
const colors = this.colors.map((val) => {
|
|
7639
|
+
this._color.value = val;
|
|
7640
|
+
const rgba = this._color.toArray();
|
|
7641
|
+
rgba[3] = this.alpha;
|
|
7642
|
+
return rgba;
|
|
7643
|
+
});
|
|
7644
|
+
while (colors.length < MAX_COLORS$1) {
|
|
7645
|
+
colors.push([0, 0, 0, 0]);
|
|
7646
|
+
}
|
|
7647
|
+
QuadUvGeometry.draw(renderer, ColorOverlayEffect.material, {
|
|
7648
|
+
sampler: 0,
|
|
7649
|
+
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
7650
|
+
});
|
|
7651
|
+
});
|
|
7499
7652
|
}
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
|
|
7653
|
+
};
|
|
7654
|
+
__publicField$g(ColorOverlayEffect, "material", new Material({
|
|
7655
|
+
vert: `precision mediump float;
|
|
7656
|
+
attribute vec2 position;
|
|
7657
|
+
attribute vec2 uv;
|
|
7658
|
+
varying vec2 vUv;
|
|
7659
|
+
void main() {
|
|
7660
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7661
|
+
vUv = uv;
|
|
7662
|
+
}`,
|
|
7663
|
+
frag: `precision mediump float;
|
|
7664
|
+
uniform sampler2D sampler;
|
|
7665
|
+
uniform vec4 colors[${MAX_COLORS$1}];
|
|
7666
|
+
varying vec2 vUv;
|
|
7667
|
+
|
|
7668
|
+
float calcWidth() {
|
|
7669
|
+
return distance(vec2(0, 0), vec2(1, 0));
|
|
7670
|
+
}
|
|
7671
|
+
|
|
7672
|
+
int calcCount() {
|
|
7673
|
+
int count = 0;
|
|
7674
|
+
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
7675
|
+
if (colors[i] != vec4(0,0,0,0)){
|
|
7676
|
+
count++;
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
return count;
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
vec4 calcColor(float x) {
|
|
7683
|
+
float perUnit = calcWidth() / float(calcCount());
|
|
7684
|
+
int index = int(x / perUnit);
|
|
7685
|
+
|
|
7686
|
+
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
7687
|
+
if(i==index){
|
|
7688
|
+
return colors[i];
|
|
7507
7689
|
}
|
|
7508
|
-
current = clamp(start, current, end);
|
|
7509
|
-
this.currentTime = current;
|
|
7510
|
-
this.emit("updateCurrentTime", current, delta);
|
|
7511
|
-
return this;
|
|
7512
|
-
}
|
|
7513
|
-
_process(delta) {
|
|
7514
|
-
super._process(delta);
|
|
7515
|
-
this.addTime(delta);
|
|
7516
7690
|
}
|
|
7517
|
-
};
|
|
7518
|
-
__decorateClass$H([
|
|
7519
|
-
property({ fallback: 0 })
|
|
7520
|
-
], Timeline.prototype, "startTime", 2);
|
|
7521
|
-
__decorateClass$H([
|
|
7522
|
-
property({ fallback: 0 })
|
|
7523
|
-
], Timeline.prototype, "currentTime", 2);
|
|
7524
|
-
__decorateClass$H([
|
|
7525
|
-
property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
7526
|
-
], Timeline.prototype, "endTime", 2);
|
|
7527
|
-
__decorateClass$H([
|
|
7528
|
-
property({ fallback: false })
|
|
7529
|
-
], Timeline.prototype, "loop", 2);
|
|
7530
|
-
Timeline = __decorateClass$H([
|
|
7531
|
-
customNode("Timeline")
|
|
7532
|
-
], Timeline);
|
|
7533
7691
|
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7692
|
+
return vec4(0, 0, 0, 0);
|
|
7693
|
+
}
|
|
7694
|
+
|
|
7695
|
+
void main(void) {
|
|
7696
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7697
|
+
vec4 mask = calcColor(vUv.x);
|
|
7698
|
+
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
7699
|
+
}`
|
|
7700
|
+
}));
|
|
7701
|
+
__decorateClass$F([
|
|
7702
|
+
property()
|
|
7703
|
+
], ColorOverlayEffect.prototype, "colors", 2);
|
|
7704
|
+
__decorateClass$F([
|
|
7705
|
+
property()
|
|
7706
|
+
], ColorOverlayEffect.prototype, "alpha", 2);
|
|
7707
|
+
ColorOverlayEffect = __decorateClass$F([
|
|
7708
|
+
customNode("ColorOverlayEffect")
|
|
7709
|
+
], ColorOverlayEffect);
|
|
7710
|
+
|
|
7711
|
+
var __defProp$x = Object.defineProperty;
|
|
7712
|
+
var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
|
|
7713
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7714
|
+
var __decorateClass$E = (decorators, target, key, kind) => {
|
|
7715
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
|
|
7537
7716
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7538
7717
|
if (decorator = decorators[i])
|
|
7539
|
-
result = (decorator(target, key, result) ) || result;
|
|
7540
|
-
if (result) __defProp$
|
|
7718
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7719
|
+
if (kind && result) __defProp$x(target, key, result);
|
|
7541
7720
|
return result;
|
|
7542
7721
|
};
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
timeline;
|
|
7548
|
-
nodes = /* @__PURE__ */ new Map();
|
|
7549
|
-
_backgroundColor = new Color();
|
|
7550
|
-
_currentViewport;
|
|
7551
|
-
getCurrentViewport() {
|
|
7552
|
-
return this._currentViewport;
|
|
7553
|
-
}
|
|
7554
|
-
setCurrentViewport(viewport) {
|
|
7555
|
-
this._currentViewport = viewport;
|
|
7556
|
-
}
|
|
7557
|
-
constructor(timeline = new Timeline()) {
|
|
7722
|
+
var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
|
|
7723
|
+
let ColorRemoveEffect = class extends Effect {
|
|
7724
|
+
_color = new Color();
|
|
7725
|
+
constructor(properties, children = []) {
|
|
7558
7726
|
super();
|
|
7559
|
-
this.
|
|
7560
|
-
}
|
|
7561
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7562
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7563
|
-
switch (key) {
|
|
7564
|
-
case "backgroundColor":
|
|
7565
|
-
this._backgroundColor.value = value;
|
|
7566
|
-
break;
|
|
7567
|
-
}
|
|
7568
|
-
}
|
|
7569
|
-
log(...args) {
|
|
7570
|
-
if (this.debug) {
|
|
7571
|
-
console.log(`[modern-canvas][${performance.now().toFixed(4)}ms]`, ...args);
|
|
7572
|
-
}
|
|
7573
|
-
}
|
|
7574
|
-
_process(delta = 0) {
|
|
7575
|
-
this.timeline.emit("process", delta);
|
|
7576
|
-
this.emit("processing");
|
|
7577
|
-
this.root.emit("process", delta);
|
|
7578
|
-
this.emit("processed");
|
|
7579
|
-
}
|
|
7580
|
-
_render(renderer) {
|
|
7581
|
-
this.emit("rendering");
|
|
7582
|
-
renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
|
|
7583
|
-
this.renderStack.render(renderer);
|
|
7584
|
-
this._renderScreen(renderer);
|
|
7585
|
-
this.emit("rendered");
|
|
7727
|
+
this.setProperties(properties).append(children);
|
|
7586
7728
|
}
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
width: this.root.width * renderer.pixelRatio,
|
|
7594
|
-
height: this.root.height * renderer.pixelRatio
|
|
7729
|
+
apply(renderer, source) {
|
|
7730
|
+
const maxColors = 50;
|
|
7731
|
+
const originalColors = new Float32Array(maxColors * 3);
|
|
7732
|
+
const colors = this.colors.map((val) => {
|
|
7733
|
+
this._color.value = val;
|
|
7734
|
+
return this._color.toArray().slice(0, 3);
|
|
7595
7735
|
});
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
}
|
|
7599
|
-
renderer.clear();
|
|
7600
|
-
if (this.backgroundColor) {
|
|
7601
|
-
renderer.gl.clearColor(0, 0, 0, 0);
|
|
7736
|
+
while (colors.length < maxColors) {
|
|
7737
|
+
colors.push([-1, 0, 0]);
|
|
7602
7738
|
}
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7739
|
+
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
7740
|
+
originalColors[i * 3] = originalColor[0];
|
|
7741
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7742
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7743
|
+
});
|
|
7744
|
+
source.redraw(renderer, () => {
|
|
7745
|
+
QuadUvGeometry.draw(renderer, ColorRemoveEffect.material, {
|
|
7746
|
+
sampler: 0,
|
|
7747
|
+
epsilon: this.epsilon,
|
|
7748
|
+
originalColors
|
|
7749
|
+
});
|
|
7750
|
+
});
|
|
7612
7751
|
}
|
|
7613
|
-
}
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7752
|
+
};
|
|
7753
|
+
__publicField$f(ColorRemoveEffect, "material", new Material({
|
|
7754
|
+
vert: `precision mediump float;
|
|
7755
|
+
attribute vec2 position;
|
|
7756
|
+
attribute vec2 uv;
|
|
7757
|
+
varying vec2 vUv;
|
|
7758
|
+
void main() {
|
|
7759
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7760
|
+
vUv = uv;
|
|
7761
|
+
}`,
|
|
7762
|
+
frag: `varying vec2 vUv;
|
|
7763
|
+
uniform sampler2D sampler;
|
|
7764
|
+
uniform float epsilon;
|
|
7765
|
+
const int MAX_COLORS = 50;
|
|
7766
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7767
|
+
|
|
7768
|
+
void main(void) {
|
|
7769
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7770
|
+
|
|
7771
|
+
for (int i = 0; i < MAX_COLORS; i++) {
|
|
7772
|
+
vec3 origColor = originalColors[i];
|
|
7773
|
+
if (origColor.r < 0.0) {
|
|
7774
|
+
break;
|
|
7775
|
+
}
|
|
7776
|
+
vec3 colorDiff = origColor - color.rgb;
|
|
7777
|
+
if (length(colorDiff) < epsilon) {
|
|
7778
|
+
gl_FragColor = vec4(0, 0, 0, 0);
|
|
7779
|
+
return;
|
|
7780
|
+
}
|
|
7781
|
+
}
|
|
7782
|
+
|
|
7783
|
+
gl_FragColor = color;
|
|
7784
|
+
}`
|
|
7785
|
+
}));
|
|
7786
|
+
__decorateClass$E([
|
|
7618
7787
|
property()
|
|
7619
|
-
],
|
|
7620
|
-
__decorateClass$
|
|
7621
|
-
property(
|
|
7622
|
-
],
|
|
7788
|
+
], ColorRemoveEffect.prototype, "colors", 2);
|
|
7789
|
+
__decorateClass$E([
|
|
7790
|
+
property()
|
|
7791
|
+
], ColorRemoveEffect.prototype, "epsilon", 2);
|
|
7792
|
+
ColorRemoveEffect = __decorateClass$E([
|
|
7793
|
+
customNode("ColorRemoveEffect")
|
|
7794
|
+
], ColorRemoveEffect);
|
|
7623
7795
|
|
|
7624
|
-
var
|
|
7625
|
-
var
|
|
7626
|
-
|
|
7796
|
+
var __defProp$w = Object.defineProperty;
|
|
7797
|
+
var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
|
|
7798
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7799
|
+
var __decorateClass$D = (decorators, target, key, kind) => {
|
|
7800
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
|
|
7627
7801
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7628
7802
|
if (decorator = decorators[i])
|
|
7629
|
-
result = (decorator(result)) || result;
|
|
7803
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7804
|
+
if (kind && result) __defProp$w(target, key, result);
|
|
7630
7805
|
return result;
|
|
7631
7806
|
};
|
|
7632
|
-
|
|
7807
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
|
|
7808
|
+
const MAX_COLORS = 50;
|
|
7809
|
+
let ColorReplaceEffect = class extends Effect {
|
|
7810
|
+
_color = new Color();
|
|
7633
7811
|
constructor(properties, children = []) {
|
|
7634
7812
|
super();
|
|
7635
7813
|
this.setProperties(properties).append(children);
|
|
7636
7814
|
}
|
|
7815
|
+
apply(renderer, source) {
|
|
7816
|
+
const colors = this.colors.map((val) => {
|
|
7817
|
+
this._color.value = val[0];
|
|
7818
|
+
const color0 = this._color.toArray().slice(0, 3);
|
|
7819
|
+
this._color.value = val[1];
|
|
7820
|
+
const color1 = this._color.toArray().slice(0, 3);
|
|
7821
|
+
return [
|
|
7822
|
+
color0,
|
|
7823
|
+
color1
|
|
7824
|
+
];
|
|
7825
|
+
});
|
|
7826
|
+
const epsilon = this.epsilon;
|
|
7827
|
+
const originalColors = new Float32Array(MAX_COLORS * 3);
|
|
7828
|
+
const targetColors = new Float32Array(MAX_COLORS * 3);
|
|
7829
|
+
while (colors.length < MAX_COLORS) {
|
|
7830
|
+
colors.push([
|
|
7831
|
+
[-1, 0, 0],
|
|
7832
|
+
[0, 0, 0, 1]
|
|
7833
|
+
]);
|
|
7834
|
+
}
|
|
7835
|
+
colors.slice(0, MAX_COLORS).forEach(([originalColor, targetColor], i) => {
|
|
7836
|
+
originalColors[i * 3] = originalColor[0];
|
|
7837
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7838
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7839
|
+
targetColors[i * 3] = targetColor[0];
|
|
7840
|
+
targetColors[i * 3 + 1] = targetColor[1];
|
|
7841
|
+
targetColors[i * 3 + 2] = targetColor[2];
|
|
7842
|
+
});
|
|
7843
|
+
source.redraw(renderer, () => {
|
|
7844
|
+
QuadUvGeometry.draw(renderer, ColorReplaceEffect.material, {
|
|
7845
|
+
sampler: 0,
|
|
7846
|
+
epsilon,
|
|
7847
|
+
originalColors,
|
|
7848
|
+
targetColors
|
|
7849
|
+
});
|
|
7850
|
+
});
|
|
7851
|
+
}
|
|
7637
7852
|
};
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7853
|
+
__publicField$e(ColorReplaceEffect, "material", new Material({
|
|
7854
|
+
vert: `precision mediump float;
|
|
7855
|
+
attribute vec2 position;
|
|
7856
|
+
attribute vec2 uv;
|
|
7857
|
+
varying vec2 vUv;
|
|
7858
|
+
void main() {
|
|
7859
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7860
|
+
vUv = uv;
|
|
7861
|
+
}`,
|
|
7862
|
+
frag: `varying vec2 vUv;
|
|
7863
|
+
uniform sampler2D sampler;
|
|
7864
|
+
uniform float epsilon;
|
|
7865
|
+
const int MAX_COLORS = ${MAX_COLORS};
|
|
7866
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7867
|
+
uniform vec3 targetColors[MAX_COLORS];
|
|
7645
7868
|
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7869
|
+
void main(void) {
|
|
7870
|
+
gl_FragColor = texture2D(sampler, vUv);
|
|
7871
|
+
|
|
7872
|
+
float alpha = gl_FragColor.a;
|
|
7873
|
+
if (alpha < 0.0001) {
|
|
7874
|
+
return;
|
|
7875
|
+
}
|
|
7876
|
+
|
|
7877
|
+
vec3 color = gl_FragColor.rgb / alpha;
|
|
7878
|
+
|
|
7879
|
+
for(int i = 0; i < MAX_COLORS; i++) {
|
|
7880
|
+
vec3 origColor = originalColors[i];
|
|
7881
|
+
if (origColor.r < 0.0) {
|
|
7882
|
+
break;
|
|
7883
|
+
}
|
|
7884
|
+
vec3 colorDiff = origColor - color;
|
|
7885
|
+
if (length(colorDiff) < epsilon) {
|
|
7886
|
+
vec3 targetColor = targetColors[i];
|
|
7887
|
+
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7888
|
+
return;
|
|
7889
|
+
}
|
|
7890
|
+
}
|
|
7891
|
+
}`
|
|
7892
|
+
}));
|
|
7893
|
+
__decorateClass$D([
|
|
7894
|
+
property()
|
|
7895
|
+
], ColorReplaceEffect.prototype, "colors", 2);
|
|
7896
|
+
__decorateClass$D([
|
|
7897
|
+
property()
|
|
7898
|
+
], ColorReplaceEffect.prototype, "epsilon", 2);
|
|
7899
|
+
ColorReplaceEffect = __decorateClass$D([
|
|
7900
|
+
customNode("ColorReplaceEffect")
|
|
7901
|
+
], ColorReplaceEffect);
|
|
7902
|
+
|
|
7903
|
+
var __defProp$v = Object.defineProperty;
|
|
7904
|
+
var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
|
|
7905
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7906
|
+
var __decorateClass$C = (decorators, target, key, kind) => {
|
|
7907
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
|
|
7651
7908
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7652
7909
|
if (decorator = decorators[i])
|
|
7653
7910
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7654
|
-
if (kind && result) __defProp$
|
|
7911
|
+
if (kind && result) __defProp$v(target, key, result);
|
|
7655
7912
|
return result;
|
|
7656
7913
|
};
|
|
7657
7914
|
var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -7757,25 +8014,25 @@ void main(void) {
|
|
|
7757
8014
|
}`,
|
|
7758
8015
|
frag: frag$2
|
|
7759
8016
|
}));
|
|
7760
|
-
__decorateClass$
|
|
8017
|
+
__decorateClass$C([
|
|
7761
8018
|
property({ default: 4 })
|
|
7762
8019
|
], GaussianBlurEffect.prototype, "strength", 2);
|
|
7763
|
-
__decorateClass$
|
|
8020
|
+
__decorateClass$C([
|
|
7764
8021
|
property({ default: 3 })
|
|
7765
8022
|
], GaussianBlurEffect.prototype, "quality", 2);
|
|
7766
|
-
GaussianBlurEffect = __decorateClass$
|
|
8023
|
+
GaussianBlurEffect = __decorateClass$C([
|
|
7767
8024
|
customNode("GaussianBlurEffect")
|
|
7768
8025
|
], GaussianBlurEffect);
|
|
7769
8026
|
|
|
7770
|
-
var __defProp$
|
|
7771
|
-
var __getOwnPropDesc$
|
|
7772
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$
|
|
7773
|
-
var __decorateClass$
|
|
7774
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8027
|
+
var __defProp$u = Object.defineProperty;
|
|
8028
|
+
var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
|
|
8029
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8030
|
+
var __decorateClass$B = (decorators, target, key, kind) => {
|
|
8031
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
|
|
7775
8032
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7776
8033
|
if (decorator = decorators[i])
|
|
7777
8034
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7778
|
-
if (kind && result) __defProp$
|
|
8035
|
+
if (kind && result) __defProp$u(target, key, result);
|
|
7779
8036
|
return result;
|
|
7780
8037
|
};
|
|
7781
8038
|
var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
|
|
@@ -7839,34 +8096,34 @@ void main(void) {
|
|
|
7839
8096
|
gl_FragColor = sample;
|
|
7840
8097
|
}`
|
|
7841
8098
|
}));
|
|
7842
|
-
__decorateClass$
|
|
8099
|
+
__decorateClass$B([
|
|
7843
8100
|
property()
|
|
7844
8101
|
], DropShadowEffect.prototype, "color", 2);
|
|
7845
|
-
__decorateClass$
|
|
8102
|
+
__decorateClass$B([
|
|
7846
8103
|
property()
|
|
7847
8104
|
], DropShadowEffect.prototype, "blur", 2);
|
|
7848
|
-
__decorateClass$
|
|
8105
|
+
__decorateClass$B([
|
|
7849
8106
|
property()
|
|
7850
8107
|
], DropShadowEffect.prototype, "offsetX", 2);
|
|
7851
|
-
__decorateClass$
|
|
8108
|
+
__decorateClass$B([
|
|
7852
8109
|
property()
|
|
7853
8110
|
], DropShadowEffect.prototype, "offsetY", 2);
|
|
7854
|
-
__decorateClass$
|
|
8111
|
+
__decorateClass$B([
|
|
7855
8112
|
property()
|
|
7856
8113
|
], DropShadowEffect.prototype, "shadowOnly", 2);
|
|
7857
|
-
DropShadowEffect = __decorateClass$
|
|
8114
|
+
DropShadowEffect = __decorateClass$B([
|
|
7858
8115
|
customNode("DropShadowEffect")
|
|
7859
8116
|
], DropShadowEffect);
|
|
7860
8117
|
|
|
7861
|
-
var __defProp$
|
|
7862
|
-
var __getOwnPropDesc$
|
|
7863
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
7864
|
-
var __decorateClass$
|
|
7865
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8118
|
+
var __defProp$t = Object.defineProperty;
|
|
8119
|
+
var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
|
|
8120
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8121
|
+
var __decorateClass$A = (decorators, target, key, kind) => {
|
|
8122
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
|
|
7866
8123
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7867
8124
|
if (decorator = decorators[i])
|
|
7868
8125
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7869
|
-
if (kind && result) __defProp$
|
|
8126
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
7870
8127
|
return result;
|
|
7871
8128
|
};
|
|
7872
8129
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
|
|
@@ -7911,22 +8168,22 @@ void main(void) {
|
|
|
7911
8168
|
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
7912
8169
|
}`
|
|
7913
8170
|
}));
|
|
7914
|
-
__decorateClass$
|
|
8171
|
+
__decorateClass$A([
|
|
7915
8172
|
property()
|
|
7916
8173
|
], EmbossEffect.prototype, "strength", 2);
|
|
7917
|
-
EmbossEffect = __decorateClass$
|
|
8174
|
+
EmbossEffect = __decorateClass$A([
|
|
7918
8175
|
customNode("EmbossEffect")
|
|
7919
8176
|
], EmbossEffect);
|
|
7920
8177
|
|
|
7921
|
-
var __defProp$
|
|
7922
|
-
var __getOwnPropDesc$
|
|
7923
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$
|
|
7924
|
-
var __decorateClass$
|
|
7925
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8178
|
+
var __defProp$s = Object.defineProperty;
|
|
8179
|
+
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
8180
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8181
|
+
var __decorateClass$z = (decorators, target, key, kind) => {
|
|
8182
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
|
|
7926
8183
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7927
8184
|
if (decorator = decorators[i])
|
|
7928
8185
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7929
|
-
if (kind && result) __defProp$
|
|
8186
|
+
if (kind && result) __defProp$s(target, key, result);
|
|
7930
8187
|
return result;
|
|
7931
8188
|
};
|
|
7932
8189
|
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
|
|
@@ -8100,46 +8357,46 @@ void main(void) {
|
|
|
8100
8357
|
gl_FragColor.a = texture2D(sampler, coord).a;
|
|
8101
8358
|
}`
|
|
8102
8359
|
}));
|
|
8103
|
-
__decorateClass$
|
|
8360
|
+
__decorateClass$z([
|
|
8104
8361
|
property()
|
|
8105
8362
|
], GlitchEffect.prototype, "slices", 2);
|
|
8106
|
-
__decorateClass$
|
|
8363
|
+
__decorateClass$z([
|
|
8107
8364
|
property()
|
|
8108
8365
|
], GlitchEffect.prototype, "sampleSize", 2);
|
|
8109
|
-
__decorateClass$
|
|
8366
|
+
__decorateClass$z([
|
|
8110
8367
|
property()
|
|
8111
8368
|
], GlitchEffect.prototype, "offset", 2);
|
|
8112
|
-
__decorateClass$
|
|
8369
|
+
__decorateClass$z([
|
|
8113
8370
|
property()
|
|
8114
8371
|
], GlitchEffect.prototype, "direction", 2);
|
|
8115
|
-
__decorateClass$
|
|
8372
|
+
__decorateClass$z([
|
|
8116
8373
|
property()
|
|
8117
8374
|
], GlitchEffect.prototype, "fillMode", 2);
|
|
8118
|
-
__decorateClass$
|
|
8375
|
+
__decorateClass$z([
|
|
8119
8376
|
property()
|
|
8120
8377
|
], GlitchEffect.prototype, "seed", 2);
|
|
8121
|
-
__decorateClass$
|
|
8378
|
+
__decorateClass$z([
|
|
8122
8379
|
property()
|
|
8123
8380
|
], GlitchEffect.prototype, "red", 2);
|
|
8124
|
-
__decorateClass$
|
|
8381
|
+
__decorateClass$z([
|
|
8125
8382
|
property()
|
|
8126
8383
|
], GlitchEffect.prototype, "green", 2);
|
|
8127
|
-
__decorateClass$
|
|
8384
|
+
__decorateClass$z([
|
|
8128
8385
|
property()
|
|
8129
8386
|
], GlitchEffect.prototype, "blue", 2);
|
|
8130
|
-
GlitchEffect = __decorateClass$
|
|
8387
|
+
GlitchEffect = __decorateClass$z([
|
|
8131
8388
|
customNode("GlitchEffect")
|
|
8132
8389
|
], GlitchEffect);
|
|
8133
8390
|
|
|
8134
|
-
var __defProp$
|
|
8135
|
-
var __getOwnPropDesc$
|
|
8136
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$
|
|
8137
|
-
var __decorateClass$
|
|
8138
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8391
|
+
var __defProp$r = Object.defineProperty;
|
|
8392
|
+
var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
|
|
8393
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8394
|
+
var __decorateClass$y = (decorators, target, key, kind) => {
|
|
8395
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
|
|
8139
8396
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8140
8397
|
if (decorator = decorators[i])
|
|
8141
8398
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8142
|
-
if (kind && result) __defProp$
|
|
8399
|
+
if (kind && result) __defProp$r(target, key, result);
|
|
8143
8400
|
return result;
|
|
8144
8401
|
};
|
|
8145
8402
|
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
@@ -8317,39 +8574,39 @@ void main(void) {
|
|
|
8317
8574
|
gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
|
|
8318
8575
|
}`
|
|
8319
8576
|
}));
|
|
8320
|
-
__decorateClass$
|
|
8577
|
+
__decorateClass$y([
|
|
8321
8578
|
property()
|
|
8322
8579
|
], GodrayEffect.prototype, "time", 2);
|
|
8323
|
-
__decorateClass$
|
|
8580
|
+
__decorateClass$y([
|
|
8324
8581
|
property()
|
|
8325
8582
|
], GodrayEffect.prototype, "angle", 2);
|
|
8326
|
-
__decorateClass$
|
|
8583
|
+
__decorateClass$y([
|
|
8327
8584
|
property()
|
|
8328
8585
|
], GodrayEffect.prototype, "gain", 2);
|
|
8329
|
-
__decorateClass$
|
|
8586
|
+
__decorateClass$y([
|
|
8330
8587
|
property()
|
|
8331
8588
|
], GodrayEffect.prototype, "lacunarity", 2);
|
|
8332
|
-
__decorateClass$
|
|
8589
|
+
__decorateClass$y([
|
|
8333
8590
|
property()
|
|
8334
8591
|
], GodrayEffect.prototype, "parallel", 2);
|
|
8335
|
-
__decorateClass$
|
|
8592
|
+
__decorateClass$y([
|
|
8336
8593
|
property()
|
|
8337
8594
|
], GodrayEffect.prototype, "center", 2);
|
|
8338
|
-
__decorateClass$
|
|
8595
|
+
__decorateClass$y([
|
|
8339
8596
|
property()
|
|
8340
8597
|
], GodrayEffect.prototype, "alpha", 2);
|
|
8341
|
-
GodrayEffect = __decorateClass$
|
|
8598
|
+
GodrayEffect = __decorateClass$y([
|
|
8342
8599
|
customNode("GodrayEffect")
|
|
8343
8600
|
], GodrayEffect);
|
|
8344
8601
|
|
|
8345
|
-
var __defProp$
|
|
8346
|
-
var __getOwnPropDesc$
|
|
8347
|
-
var __decorateClass$
|
|
8348
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8602
|
+
var __defProp$q = Object.defineProperty;
|
|
8603
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
8604
|
+
var __decorateClass$x = (decorators, target, key, kind) => {
|
|
8605
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
8349
8606
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8350
8607
|
if (decorator = decorators[i])
|
|
8351
8608
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8352
|
-
if (kind && result) __defProp$
|
|
8609
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
8353
8610
|
return result;
|
|
8354
8611
|
};
|
|
8355
8612
|
const frag$1 = `varying vec2 vUv;
|
|
@@ -8439,28 +8696,28 @@ void main() {
|
|
|
8439
8696
|
});
|
|
8440
8697
|
}
|
|
8441
8698
|
};
|
|
8442
|
-
__decorateClass$
|
|
8699
|
+
__decorateClass$x([
|
|
8443
8700
|
property()
|
|
8444
8701
|
], KawaseBlurEffect.prototype, "strength", 2);
|
|
8445
|
-
__decorateClass$
|
|
8702
|
+
__decorateClass$x([
|
|
8446
8703
|
property()
|
|
8447
8704
|
], KawaseBlurEffect.prototype, "quality", 2);
|
|
8448
|
-
__decorateClass$
|
|
8705
|
+
__decorateClass$x([
|
|
8449
8706
|
property()
|
|
8450
8707
|
], KawaseBlurEffect.prototype, "pixelSize", 2);
|
|
8451
|
-
KawaseBlurEffect = __decorateClass$
|
|
8708
|
+
KawaseBlurEffect = __decorateClass$x([
|
|
8452
8709
|
customNode("KawaseBlurEffect")
|
|
8453
8710
|
], KawaseBlurEffect);
|
|
8454
8711
|
|
|
8455
|
-
var __defProp$
|
|
8456
|
-
var __getOwnPropDesc$
|
|
8457
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$
|
|
8458
|
-
var __decorateClass$
|
|
8459
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8712
|
+
var __defProp$p = Object.defineProperty;
|
|
8713
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
8714
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8715
|
+
var __decorateClass$w = (decorators, target, key, kind) => {
|
|
8716
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
8460
8717
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8461
8718
|
if (decorator = decorators[i])
|
|
8462
8719
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8463
|
-
if (kind && result) __defProp$
|
|
8720
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
8464
8721
|
return result;
|
|
8465
8722
|
};
|
|
8466
8723
|
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
|
@@ -8548,25 +8805,25 @@ void main(void) {
|
|
|
8548
8805
|
}
|
|
8549
8806
|
}`
|
|
8550
8807
|
}));
|
|
8551
|
-
__decorateClass$
|
|
8808
|
+
__decorateClass$w([
|
|
8552
8809
|
property({ protected: true })
|
|
8553
8810
|
], MaskEffect.prototype, "texture", 2);
|
|
8554
|
-
__decorateClass$
|
|
8811
|
+
__decorateClass$w([
|
|
8555
8812
|
property({ default: "" })
|
|
8556
8813
|
], MaskEffect.prototype, "src", 2);
|
|
8557
|
-
MaskEffect = __decorateClass$
|
|
8814
|
+
MaskEffect = __decorateClass$w([
|
|
8558
8815
|
customNode("MaskEffect")
|
|
8559
8816
|
], MaskEffect);
|
|
8560
|
-
|
|
8561
|
-
var __defProp$
|
|
8562
|
-
var __getOwnPropDesc$
|
|
8563
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$
|
|
8564
|
-
var __decorateClass$
|
|
8565
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8817
|
+
|
|
8818
|
+
var __defProp$o = Object.defineProperty;
|
|
8819
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
8820
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8821
|
+
var __decorateClass$v = (decorators, target, key, kind) => {
|
|
8822
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
8566
8823
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8567
8824
|
if (decorator = decorators[i])
|
|
8568
8825
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8569
|
-
if (kind && result) __defProp$
|
|
8826
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
8570
8827
|
return result;
|
|
8571
8828
|
};
|
|
8572
8829
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -8653,40 +8910,40 @@ void main() {
|
|
|
8653
8910
|
};
|
|
8654
8911
|
__publicField$7(OutlineEffect, "MIN_SAMPLES", 1);
|
|
8655
8912
|
__publicField$7(OutlineEffect, "MAX_SAMPLES", 100);
|
|
8656
|
-
__decorateClass$
|
|
8913
|
+
__decorateClass$v([
|
|
8657
8914
|
property()
|
|
8658
8915
|
], OutlineEffect.prototype, "color", 2);
|
|
8659
|
-
__decorateClass$
|
|
8916
|
+
__decorateClass$v([
|
|
8660
8917
|
property()
|
|
8661
8918
|
], OutlineEffect.prototype, "width", 2);
|
|
8662
|
-
__decorateClass$
|
|
8919
|
+
__decorateClass$v([
|
|
8663
8920
|
property()
|
|
8664
8921
|
], OutlineEffect.prototype, "style", 2);
|
|
8665
|
-
__decorateClass$
|
|
8922
|
+
__decorateClass$v([
|
|
8666
8923
|
property()
|
|
8667
8924
|
], OutlineEffect.prototype, "image", 2);
|
|
8668
|
-
__decorateClass$
|
|
8925
|
+
__decorateClass$v([
|
|
8669
8926
|
property()
|
|
8670
8927
|
], OutlineEffect.prototype, "opacity", 2);
|
|
8671
|
-
__decorateClass$
|
|
8928
|
+
__decorateClass$v([
|
|
8672
8929
|
property()
|
|
8673
8930
|
], OutlineEffect.prototype, "quality", 2);
|
|
8674
|
-
__decorateClass$
|
|
8931
|
+
__decorateClass$v([
|
|
8675
8932
|
property()
|
|
8676
8933
|
], OutlineEffect.prototype, "knockout", 2);
|
|
8677
|
-
OutlineEffect = __decorateClass$
|
|
8934
|
+
OutlineEffect = __decorateClass$v([
|
|
8678
8935
|
customNode("OutlineEffect")
|
|
8679
8936
|
], OutlineEffect);
|
|
8680
8937
|
|
|
8681
|
-
var __defProp$
|
|
8682
|
-
var __getOwnPropDesc$
|
|
8683
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$
|
|
8684
|
-
var __decorateClass$
|
|
8685
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8938
|
+
var __defProp$n = Object.defineProperty;
|
|
8939
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
8940
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8941
|
+
var __decorateClass$u = (decorators, target, key, kind) => {
|
|
8942
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
8686
8943
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8687
8944
|
if (decorator = decorators[i])
|
|
8688
8945
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8689
|
-
if (kind && result) __defProp$
|
|
8946
|
+
if (kind && result) __defProp$n(target, key, result);
|
|
8690
8947
|
return result;
|
|
8691
8948
|
};
|
|
8692
8949
|
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
@@ -8742,22 +8999,22 @@ void main(void) {
|
|
|
8742
8999
|
gl_FragColor = texture2D(sampler, coord);
|
|
8743
9000
|
}`
|
|
8744
9001
|
}));
|
|
8745
|
-
__decorateClass$
|
|
9002
|
+
__decorateClass$u([
|
|
8746
9003
|
property()
|
|
8747
9004
|
], PixelateEffect.prototype, "strength", 2);
|
|
8748
|
-
PixelateEffect = __decorateClass$
|
|
9005
|
+
PixelateEffect = __decorateClass$u([
|
|
8749
9006
|
customNode("PixelateEffect")
|
|
8750
9007
|
], PixelateEffect);
|
|
8751
9008
|
|
|
8752
|
-
var __defProp$
|
|
8753
|
-
var __getOwnPropDesc$
|
|
8754
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$
|
|
8755
|
-
var __decorateClass$
|
|
8756
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
9009
|
+
var __defProp$m = Object.defineProperty;
|
|
9010
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
9011
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9012
|
+
var __decorateClass$t = (decorators, target, key, kind) => {
|
|
9013
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
8757
9014
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8758
9015
|
if (decorator = decorators[i])
|
|
8759
9016
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8760
|
-
if (kind && result) __defProp$
|
|
9017
|
+
if (kind && result) __defProp$m(target, key, result);
|
|
8761
9018
|
return result;
|
|
8762
9019
|
};
|
|
8763
9020
|
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
|
|
@@ -8870,29 +9127,29 @@ void main() {
|
|
|
8870
9127
|
gl_FragColor = color;
|
|
8871
9128
|
}`
|
|
8872
9129
|
}));
|
|
8873
|
-
__decorateClass$
|
|
9130
|
+
__decorateClass$t([
|
|
8874
9131
|
property()
|
|
8875
9132
|
], ZoomBlurEffect.prototype, "center", 2);
|
|
8876
|
-
__decorateClass$
|
|
9133
|
+
__decorateClass$t([
|
|
8877
9134
|
property()
|
|
8878
9135
|
], ZoomBlurEffect.prototype, "innerRadius", 2);
|
|
8879
|
-
__decorateClass$
|
|
9136
|
+
__decorateClass$t([
|
|
8880
9137
|
property()
|
|
8881
9138
|
], ZoomBlurEffect.prototype, "radius", 2);
|
|
8882
|
-
__decorateClass$
|
|
9139
|
+
__decorateClass$t([
|
|
8883
9140
|
property()
|
|
8884
9141
|
], ZoomBlurEffect.prototype, "strength", 2);
|
|
8885
|
-
ZoomBlurEffect = __decorateClass$
|
|
9142
|
+
ZoomBlurEffect = __decorateClass$t([
|
|
8886
9143
|
customNode("ZoomBlurEffect")
|
|
8887
9144
|
], ZoomBlurEffect);
|
|
8888
9145
|
|
|
8889
|
-
var __defProp$
|
|
8890
|
-
var __decorateClass$
|
|
9146
|
+
var __defProp$l = Object.defineProperty;
|
|
9147
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
8891
9148
|
var result = void 0 ;
|
|
8892
9149
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8893
9150
|
if (decorator = decorators[i])
|
|
8894
9151
|
result = (decorator(target, key, result) ) || result;
|
|
8895
|
-
if (result) __defProp$
|
|
9152
|
+
if (result) __defProp$l(target, key, result);
|
|
8896
9153
|
return result;
|
|
8897
9154
|
};
|
|
8898
9155
|
class BaseElement2DFill extends CoreObject {
|
|
@@ -9000,47 +9257,47 @@ class BaseElement2DFill extends CoreObject {
|
|
|
9000
9257
|
});
|
|
9001
9258
|
}
|
|
9002
9259
|
}
|
|
9003
|
-
__decorateClass$
|
|
9260
|
+
__decorateClass$s([
|
|
9004
9261
|
property({ fallback: true })
|
|
9005
9262
|
], BaseElement2DFill.prototype, "enabled");
|
|
9006
|
-
__decorateClass$
|
|
9263
|
+
__decorateClass$s([
|
|
9007
9264
|
property()
|
|
9008
9265
|
], BaseElement2DFill.prototype, "color");
|
|
9009
|
-
__decorateClass$
|
|
9266
|
+
__decorateClass$s([
|
|
9010
9267
|
property()
|
|
9011
9268
|
], BaseElement2DFill.prototype, "image");
|
|
9012
|
-
__decorateClass$
|
|
9269
|
+
__decorateClass$s([
|
|
9013
9270
|
property()
|
|
9014
9271
|
], BaseElement2DFill.prototype, "linearGradient");
|
|
9015
|
-
__decorateClass$
|
|
9272
|
+
__decorateClass$s([
|
|
9016
9273
|
property()
|
|
9017
9274
|
], BaseElement2DFill.prototype, "radialGradient");
|
|
9018
|
-
__decorateClass$
|
|
9275
|
+
__decorateClass$s([
|
|
9019
9276
|
property()
|
|
9020
9277
|
], BaseElement2DFill.prototype, "cropRect");
|
|
9021
|
-
__decorateClass$
|
|
9278
|
+
__decorateClass$s([
|
|
9022
9279
|
property()
|
|
9023
9280
|
], BaseElement2DFill.prototype, "stretchRect");
|
|
9024
|
-
__decorateClass$
|
|
9281
|
+
__decorateClass$s([
|
|
9025
9282
|
property()
|
|
9026
9283
|
], BaseElement2DFill.prototype, "dpi");
|
|
9027
|
-
__decorateClass$
|
|
9284
|
+
__decorateClass$s([
|
|
9028
9285
|
property()
|
|
9029
9286
|
], BaseElement2DFill.prototype, "rotateWithShape");
|
|
9030
|
-
__decorateClass$
|
|
9287
|
+
__decorateClass$s([
|
|
9031
9288
|
property()
|
|
9032
9289
|
], BaseElement2DFill.prototype, "tile");
|
|
9033
|
-
__decorateClass$
|
|
9290
|
+
__decorateClass$s([
|
|
9034
9291
|
property()
|
|
9035
9292
|
], BaseElement2DFill.prototype, "opacity");
|
|
9036
9293
|
|
|
9037
|
-
var __defProp$
|
|
9038
|
-
var __decorateClass$
|
|
9294
|
+
var __defProp$k = Object.defineProperty;
|
|
9295
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
9039
9296
|
var result = void 0 ;
|
|
9040
9297
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9041
9298
|
if (decorator = decorators[i])
|
|
9042
9299
|
result = (decorator(target, key, result) ) || result;
|
|
9043
|
-
if (result) __defProp$
|
|
9300
|
+
if (result) __defProp$k(target, key, result);
|
|
9044
9301
|
return result;
|
|
9045
9302
|
};
|
|
9046
9303
|
class BaseElement2DBackground extends BaseElement2DFill {
|
|
@@ -9050,17 +9307,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
|
|
|
9050
9307
|
);
|
|
9051
9308
|
}
|
|
9052
9309
|
}
|
|
9053
|
-
__decorateClass$
|
|
9310
|
+
__decorateClass$r([
|
|
9054
9311
|
property()
|
|
9055
9312
|
], BaseElement2DBackground.prototype, "fillWithShape");
|
|
9056
9313
|
|
|
9057
|
-
var __defProp$
|
|
9058
|
-
var __decorateClass$
|
|
9314
|
+
var __defProp$j = Object.defineProperty;
|
|
9315
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
9059
9316
|
var result = void 0 ;
|
|
9060
9317
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9061
9318
|
if (decorator = decorators[i])
|
|
9062
9319
|
result = (decorator(target, key, result) ) || result;
|
|
9063
|
-
if (result) __defProp$
|
|
9320
|
+
if (result) __defProp$j(target, key, result);
|
|
9064
9321
|
return result;
|
|
9065
9322
|
};
|
|
9066
9323
|
class BaseElement2DForeground extends BaseElement2DFill {
|
|
@@ -9070,17 +9327,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
|
|
|
9070
9327
|
);
|
|
9071
9328
|
}
|
|
9072
9329
|
}
|
|
9073
|
-
__decorateClass$
|
|
9330
|
+
__decorateClass$q([
|
|
9074
9331
|
property()
|
|
9075
9332
|
], BaseElement2DForeground.prototype, "fillWithShape");
|
|
9076
9333
|
|
|
9077
|
-
var __defProp$
|
|
9078
|
-
var __decorateClass$
|
|
9334
|
+
var __defProp$i = Object.defineProperty;
|
|
9335
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
9079
9336
|
var result = void 0 ;
|
|
9080
9337
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9081
9338
|
if (decorator = decorators[i])
|
|
9082
9339
|
result = (decorator(target, key, result) ) || result;
|
|
9083
|
-
if (result) __defProp$
|
|
9340
|
+
if (result) __defProp$i(target, key, result);
|
|
9084
9341
|
return result;
|
|
9085
9342
|
};
|
|
9086
9343
|
class BaseElement2DOutline extends BaseElement2DFill {
|
|
@@ -9113,23 +9370,23 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9113
9370
|
ctx.stroke({ disableWrapMode });
|
|
9114
9371
|
}
|
|
9115
9372
|
}
|
|
9116
|
-
__decorateClass$
|
|
9373
|
+
__decorateClass$p([
|
|
9117
9374
|
property({ fallback: "#00000000" })
|
|
9118
9375
|
], BaseElement2DOutline.prototype, "color");
|
|
9119
|
-
__decorateClass$
|
|
9376
|
+
__decorateClass$p([
|
|
9120
9377
|
property({ fallback: 0 })
|
|
9121
9378
|
], BaseElement2DOutline.prototype, "width");
|
|
9122
|
-
__decorateClass$
|
|
9379
|
+
__decorateClass$p([
|
|
9123
9380
|
property({ fallback: "solid" })
|
|
9124
9381
|
], BaseElement2DOutline.prototype, "style");
|
|
9125
9382
|
|
|
9126
|
-
var __defProp$
|
|
9127
|
-
var __decorateClass$
|
|
9383
|
+
var __defProp$h = Object.defineProperty;
|
|
9384
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
9128
9385
|
var result = void 0 ;
|
|
9129
9386
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9130
9387
|
if (decorator = decorators[i])
|
|
9131
9388
|
result = (decorator(target, key, result) ) || result;
|
|
9132
|
-
if (result) __defProp$
|
|
9389
|
+
if (result) __defProp$h(target, key, result);
|
|
9133
9390
|
return result;
|
|
9134
9391
|
};
|
|
9135
9392
|
class BaseElement2DShadow extends CoreObject {
|
|
@@ -9169,29 +9426,29 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9169
9426
|
}
|
|
9170
9427
|
}
|
|
9171
9428
|
}
|
|
9172
|
-
__decorateClass$
|
|
9429
|
+
__decorateClass$o([
|
|
9173
9430
|
property({ fallback: true })
|
|
9174
9431
|
], BaseElement2DShadow.prototype, "enabled");
|
|
9175
|
-
__decorateClass$
|
|
9432
|
+
__decorateClass$o([
|
|
9176
9433
|
property({ fallback: "#000000FF" })
|
|
9177
9434
|
], BaseElement2DShadow.prototype, "color");
|
|
9178
|
-
__decorateClass$
|
|
9435
|
+
__decorateClass$o([
|
|
9179
9436
|
property({ fallback: 0 })
|
|
9180
9437
|
], BaseElement2DShadow.prototype, "blur");
|
|
9181
|
-
__decorateClass$
|
|
9438
|
+
__decorateClass$o([
|
|
9182
9439
|
property({ fallback: 0 })
|
|
9183
9440
|
], BaseElement2DShadow.prototype, "offsetY");
|
|
9184
|
-
__decorateClass$
|
|
9441
|
+
__decorateClass$o([
|
|
9185
9442
|
property({ fallback: 0 })
|
|
9186
9443
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9187
9444
|
|
|
9188
|
-
var __defProp$
|
|
9189
|
-
var __decorateClass$
|
|
9445
|
+
var __defProp$g = Object.defineProperty;
|
|
9446
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9190
9447
|
var result = void 0 ;
|
|
9191
9448
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9192
9449
|
if (decorator = decorators[i])
|
|
9193
9450
|
result = (decorator(target, key, result) ) || result;
|
|
9194
|
-
if (result) __defProp$
|
|
9451
|
+
if (result) __defProp$g(target, key, result);
|
|
9195
9452
|
return result;
|
|
9196
9453
|
};
|
|
9197
9454
|
class BaseElement2DShape extends CoreObject {
|
|
@@ -9266,19 +9523,19 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9266
9523
|
}
|
|
9267
9524
|
}
|
|
9268
9525
|
}
|
|
9269
|
-
__decorateClass$
|
|
9526
|
+
__decorateClass$n([
|
|
9270
9527
|
property({ fallback: true })
|
|
9271
9528
|
], BaseElement2DShape.prototype, "enabled");
|
|
9272
|
-
__decorateClass$
|
|
9529
|
+
__decorateClass$n([
|
|
9273
9530
|
property()
|
|
9274
9531
|
], BaseElement2DShape.prototype, "preset");
|
|
9275
|
-
__decorateClass$
|
|
9532
|
+
__decorateClass$n([
|
|
9276
9533
|
property()
|
|
9277
9534
|
], BaseElement2DShape.prototype, "svg");
|
|
9278
|
-
__decorateClass$
|
|
9535
|
+
__decorateClass$n([
|
|
9279
9536
|
property()
|
|
9280
9537
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9281
|
-
__decorateClass$
|
|
9538
|
+
__decorateClass$n([
|
|
9282
9539
|
property()
|
|
9283
9540
|
], BaseElement2DShape.prototype, "paths");
|
|
9284
9541
|
|
|
@@ -9294,13 +9551,13 @@ for (const key in defaultStyles$1) {
|
|
|
9294
9551
|
defineProperty(BaseElement2DStyle, key, { fallback });
|
|
9295
9552
|
}
|
|
9296
9553
|
|
|
9297
|
-
var __defProp$
|
|
9298
|
-
var __decorateClass$
|
|
9554
|
+
var __defProp$f = Object.defineProperty;
|
|
9555
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
9299
9556
|
var result = void 0 ;
|
|
9300
9557
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9301
9558
|
if (decorator = decorators[i])
|
|
9302
9559
|
result = (decorator(target, key, result) ) || result;
|
|
9303
|
-
if (result) __defProp$
|
|
9560
|
+
if (result) __defProp$f(target, key, result);
|
|
9304
9561
|
return result;
|
|
9305
9562
|
};
|
|
9306
9563
|
class BaseElement2DText extends CoreObject {
|
|
@@ -9341,187 +9598,67 @@ class BaseElement2DText extends CoreObject {
|
|
|
9341
9598
|
break;
|
|
9342
9599
|
}
|
|
9343
9600
|
}
|
|
9344
|
-
_updateText() {
|
|
9345
|
-
this.base.style = {
|
|
9346
|
-
justifyContent: "center",
|
|
9347
|
-
alignItems: "center",
|
|
9348
|
-
textAlign: "center",
|
|
9349
|
-
...this.parent.style.toJSON()
|
|
9350
|
-
};
|
|
9351
|
-
this.base.requestUpdate();
|
|
9352
|
-
}
|
|
9353
|
-
measure() {
|
|
9354
|
-
this._updateText();
|
|
9355
|
-
return this.base.measure();
|
|
9356
|
-
}
|
|
9357
|
-
updateMeasure() {
|
|
9358
|
-
this.measureResult = this.measure();
|
|
9359
|
-
return this;
|
|
9360
|
-
}
|
|
9361
|
-
canDraw() {
|
|
9362
|
-
return Boolean(
|
|
9363
|
-
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9364
|
-
);
|
|
9365
|
-
}
|
|
9366
|
-
draw() {
|
|
9367
|
-
const ctx = this.parent.context;
|
|
9368
|
-
this.base.update();
|
|
9369
|
-
this.base.pathSets.forEach((pathSet) => {
|
|
9370
|
-
pathSet.paths.forEach((path) => {
|
|
9371
|
-
ctx.addPath(path);
|
|
9372
|
-
ctx.style = { ...path.style };
|
|
9373
|
-
ctx.fillStyle = void 0;
|
|
9374
|
-
ctx.strokeStyle = void 0;
|
|
9375
|
-
ctx.fill();
|
|
9376
|
-
});
|
|
9377
|
-
});
|
|
9378
|
-
}
|
|
9379
|
-
}
|
|
9380
|
-
__decorateClass$o([
|
|
9381
|
-
property({ fallback: true })
|
|
9382
|
-
], BaseElement2DText.prototype, "enabled");
|
|
9383
|
-
__decorateClass$o([
|
|
9384
|
-
property({ alias: "base.content", fallback: () => [] })
|
|
9385
|
-
], BaseElement2DText.prototype, "content");
|
|
9386
|
-
__decorateClass$o([
|
|
9387
|
-
property({ alias: "base.effects" })
|
|
9388
|
-
], BaseElement2DText.prototype, "effects");
|
|
9389
|
-
__decorateClass$o([
|
|
9390
|
-
property({ alias: "base.fill" })
|
|
9391
|
-
], BaseElement2DText.prototype, "fill");
|
|
9392
|
-
__decorateClass$o([
|
|
9393
|
-
property({ alias: "base.outline" })
|
|
9394
|
-
], BaseElement2DText.prototype, "outline");
|
|
9395
|
-
__decorateClass$o([
|
|
9396
|
-
property({ protected: true, alias: "base.measureDom" })
|
|
9397
|
-
], BaseElement2DText.prototype, "measureDom");
|
|
9398
|
-
__decorateClass$o([
|
|
9399
|
-
property({ protected: true, alias: "base.fonts" })
|
|
9400
|
-
], BaseElement2DText.prototype, "fonts");
|
|
9401
|
-
|
|
9402
|
-
var __defProp$g = Object.defineProperty;
|
|
9403
|
-
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
9404
|
-
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9405
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
9406
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9407
|
-
if (decorator = decorators[i])
|
|
9408
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9409
|
-
if (kind && result) __defProp$g(target, key, result);
|
|
9410
|
-
return result;
|
|
9411
|
-
};
|
|
9412
|
-
let Node2D = class extends CanvasItem {
|
|
9413
|
-
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9414
|
-
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
9415
|
-
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9416
|
-
transform = new Transform2D();
|
|
9417
|
-
globalPosition = new Vector2();
|
|
9418
|
-
globalScale = new Vector2();
|
|
9419
|
-
globalSkew = new Vector2();
|
|
9420
|
-
globalTransform = new Transform2D();
|
|
9421
|
-
_parentTransformDirtyId;
|
|
9422
|
-
constructor(properties, nodes = []) {
|
|
9423
|
-
super();
|
|
9424
|
-
this.setProperties(properties).append(nodes);
|
|
9425
|
-
}
|
|
9426
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9427
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9428
|
-
switch (key) {
|
|
9429
|
-
case "rotation":
|
|
9430
|
-
this.requestRelayout();
|
|
9431
|
-
break;
|
|
9432
|
-
}
|
|
9433
|
-
}
|
|
9434
|
-
getTransformOrigin() {
|
|
9435
|
-
return new Vector2(0, 0);
|
|
9436
|
-
}
|
|
9437
|
-
getTransform(cb) {
|
|
9438
|
-
const origin = this.getTransformOrigin();
|
|
9439
|
-
const transform = new Transform2D();
|
|
9440
|
-
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
9441
|
-
cb?.(transform);
|
|
9442
|
-
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
9443
|
-
return transform;
|
|
9444
|
-
}
|
|
9445
|
-
updateTransform() {
|
|
9446
|
-
this.transform.copy(this.getTransform());
|
|
9447
|
-
}
|
|
9448
|
-
updateGlobalTransform() {
|
|
9449
|
-
this.updateTransform();
|
|
9450
|
-
const parent = this.getParent();
|
|
9451
|
-
if (parent?.globalTransform) {
|
|
9452
|
-
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
9453
|
-
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
9454
|
-
this.globalRotation = parent.globalRotation + this.rotation;
|
|
9455
|
-
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
9456
|
-
} else {
|
|
9457
|
-
this.globalScale.copy(this.scale);
|
|
9458
|
-
this.globalRotation = this.rotation;
|
|
9459
|
-
this.globalTransform.copy(this.transform);
|
|
9460
|
-
}
|
|
9461
|
-
const [
|
|
9462
|
-
a,
|
|
9463
|
-
c,
|
|
9464
|
-
tx,
|
|
9465
|
-
b,
|
|
9466
|
-
d,
|
|
9467
|
-
ty
|
|
9468
|
-
] = this.globalTransform.toArray();
|
|
9469
|
-
this.globalPosition.set(tx, ty);
|
|
9470
|
-
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
9471
|
-
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
9472
|
-
this.requestRelayout();
|
|
9473
|
-
}
|
|
9474
|
-
_transformVertices(vertices, vertTransform) {
|
|
9475
|
-
let a, c, tx, b, d, ty;
|
|
9476
|
-
if (vertTransform) {
|
|
9477
|
-
const globalTransform = this.globalTransform.clone();
|
|
9478
|
-
globalTransform.multiply(
|
|
9479
|
-
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
9480
|
-
);
|
|
9481
|
-
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
9482
|
-
} else {
|
|
9483
|
-
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
9484
|
-
}
|
|
9485
|
-
const newVertices = vertices.slice();
|
|
9486
|
-
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
9487
|
-
const x = vertices[i];
|
|
9488
|
-
const y = vertices[i + 1];
|
|
9489
|
-
newVertices[i] = a * x + c * y + tx;
|
|
9490
|
-
newVertices[i + 1] = b * x + d * y + ty;
|
|
9491
|
-
}
|
|
9492
|
-
return newVertices;
|
|
9601
|
+
_updateText() {
|
|
9602
|
+
this.base.style = {
|
|
9603
|
+
justifyContent: "center",
|
|
9604
|
+
alignItems: "center",
|
|
9605
|
+
textAlign: "center",
|
|
9606
|
+
...this.parent.style.toJSON()
|
|
9607
|
+
};
|
|
9608
|
+
this.base.requestUpdate();
|
|
9493
9609
|
}
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
this.
|
|
9497
|
-
return batchables.map((batchable) => {
|
|
9498
|
-
return {
|
|
9499
|
-
...batchable,
|
|
9500
|
-
vertices: this._transformVertices(batchable.vertices, batchable.vertTransform)
|
|
9501
|
-
};
|
|
9502
|
-
});
|
|
9610
|
+
measure() {
|
|
9611
|
+
this._updateText();
|
|
9612
|
+
return this.base.measure();
|
|
9503
9613
|
}
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
if (parent?.globalTransform && this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
|
|
9508
|
-
this.requestRelayout();
|
|
9509
|
-
}
|
|
9614
|
+
updateMeasure() {
|
|
9615
|
+
this.measureResult = this.measure();
|
|
9616
|
+
return this;
|
|
9510
9617
|
}
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9618
|
+
canDraw() {
|
|
9619
|
+
return Boolean(
|
|
9620
|
+
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9621
|
+
);
|
|
9622
|
+
}
|
|
9623
|
+
draw() {
|
|
9624
|
+
const ctx = this.parent.context;
|
|
9625
|
+
this.base.update();
|
|
9626
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9627
|
+
pathSet.paths.forEach((path) => {
|
|
9628
|
+
ctx.addPath(path);
|
|
9629
|
+
ctx.style = { ...path.style };
|
|
9630
|
+
ctx.fillStyle = void 0;
|
|
9631
|
+
ctx.strokeStyle = void 0;
|
|
9632
|
+
ctx.fill();
|
|
9633
|
+
});
|
|
9634
|
+
});
|
|
9635
|
+
}
|
|
9636
|
+
}
|
|
9637
|
+
__decorateClass$m([
|
|
9638
|
+
property({ fallback: true })
|
|
9639
|
+
], BaseElement2DText.prototype, "enabled");
|
|
9640
|
+
__decorateClass$m([
|
|
9641
|
+
property({ alias: "base.content", fallback: () => [] })
|
|
9642
|
+
], BaseElement2DText.prototype, "content");
|
|
9643
|
+
__decorateClass$m([
|
|
9644
|
+
property({ alias: "base.effects" })
|
|
9645
|
+
], BaseElement2DText.prototype, "effects");
|
|
9646
|
+
__decorateClass$m([
|
|
9647
|
+
property({ alias: "base.fill" })
|
|
9648
|
+
], BaseElement2DText.prototype, "fill");
|
|
9649
|
+
__decorateClass$m([
|
|
9650
|
+
property({ alias: "base.outline" })
|
|
9651
|
+
], BaseElement2DText.prototype, "outline");
|
|
9652
|
+
__decorateClass$m([
|
|
9653
|
+
property({ protected: true, alias: "base.measureDom" })
|
|
9654
|
+
], BaseElement2DText.prototype, "measureDom");
|
|
9655
|
+
__decorateClass$m([
|
|
9656
|
+
property({ protected: true, alias: "base.fonts" })
|
|
9657
|
+
], BaseElement2DText.prototype, "fonts");
|
|
9521
9658
|
|
|
9522
|
-
var __getOwnPropDesc$
|
|
9523
|
-
var __decorateClass$
|
|
9524
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
9659
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
9660
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
9661
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
9525
9662
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9526
9663
|
if (decorator = decorators[i])
|
|
9527
9664
|
result = (decorator(result)) || result;
|
|
@@ -9745,15 +9882,46 @@ let BaseElement2D = class extends Node2D {
|
|
|
9745
9882
|
maxY - minY
|
|
9746
9883
|
);
|
|
9747
9884
|
}
|
|
9885
|
+
// protected _rectsOverlap(r1: any, r2: any): boolean {
|
|
9886
|
+
// return (
|
|
9887
|
+
// r1.x < r2.x + r2.width
|
|
9888
|
+
// && r1.x + r1.width > r2.x
|
|
9889
|
+
// && r1.y < r2.y + r2.height
|
|
9890
|
+
// && r1.y + r1.height > r2.y
|
|
9891
|
+
// )
|
|
9892
|
+
// }
|
|
9893
|
+
// TODO
|
|
9894
|
+
// override isVisibleInTree(): boolean {
|
|
9895
|
+
// if (this._tree) {
|
|
9896
|
+
// const root = this._tree.root
|
|
9897
|
+
// const camera = root.canvasTransform.inverse()
|
|
9898
|
+
// const { x, y, width, height } = root
|
|
9899
|
+
// const p1 = camera.applyToPoint(x, y)
|
|
9900
|
+
// const p2 = camera.applyToPoint(x + width, y)
|
|
9901
|
+
// const p3 = camera.applyToPoint(x + width, y + height)
|
|
9902
|
+
// const p4 = camera.applyToPoint(x, y + height)
|
|
9903
|
+
// const pts = [p1, p2, p3, p4]
|
|
9904
|
+
// const xs = pts.map(p => p[0])
|
|
9905
|
+
// const ys = pts.map(p => p[1])
|
|
9906
|
+
// const minX = Math.min(...xs)
|
|
9907
|
+
// const maxX = Math.max(...xs)
|
|
9908
|
+
// const minY = Math.min(...ys)
|
|
9909
|
+
// const maxY = Math.max(...ys)
|
|
9910
|
+
// const rect2 = {
|
|
9911
|
+
// x: minX,
|
|
9912
|
+
// y: minY,
|
|
9913
|
+
// width: maxX - minX,
|
|
9914
|
+
// height: maxY - minY,
|
|
9915
|
+
// }
|
|
9916
|
+
// if (!this._rectsOverlap(rect2, this.getRect())) {
|
|
9917
|
+
// return false
|
|
9918
|
+
// }
|
|
9919
|
+
// }
|
|
9920
|
+
// return super.isVisibleInTree()
|
|
9921
|
+
// }
|
|
9748
9922
|
_updateOverflow() {
|
|
9749
9923
|
if (this.style.overflow === "hidden") {
|
|
9750
|
-
|
|
9751
|
-
this.mask = {
|
|
9752
|
-
x: rect.x,
|
|
9753
|
-
y: rect.y,
|
|
9754
|
-
width: rect.width,
|
|
9755
|
-
height: rect.height
|
|
9756
|
-
};
|
|
9924
|
+
this.mask = this.getRect().toJSON();
|
|
9757
9925
|
} else {
|
|
9758
9926
|
this.mask = void 0;
|
|
9759
9927
|
}
|
|
@@ -9824,10 +9992,14 @@ let BaseElement2D = class extends Node2D {
|
|
|
9824
9992
|
case "pointermove":
|
|
9825
9993
|
case "pointerup": {
|
|
9826
9994
|
if (this.canPointerEvents()) {
|
|
9827
|
-
|
|
9995
|
+
let { screenX, screenY } = event;
|
|
9828
9996
|
if (screenX && screenY) {
|
|
9829
|
-
const
|
|
9830
|
-
if (
|
|
9997
|
+
const viewport = this.getViewport();
|
|
9998
|
+
if (viewport) {
|
|
9999
|
+
[screenX, screenY] = viewport.canvasTransform.inverse().applyToPoint(screenX, screenY);
|
|
10000
|
+
}
|
|
10001
|
+
[screenX, screenY] = this.globalTransform.inverse().applyToPoint(screenX, screenY);
|
|
10002
|
+
if (this._pointerInput({ x: screenX, y: screenY }, key)) {
|
|
9831
10003
|
if (!event.target) {
|
|
9832
10004
|
event.target = this;
|
|
9833
10005
|
}
|
|
@@ -9856,7 +10028,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
9856
10028
|
});
|
|
9857
10029
|
}
|
|
9858
10030
|
};
|
|
9859
|
-
BaseElement2D = __decorateClass$
|
|
10031
|
+
BaseElement2D = __decorateClass$l([
|
|
9860
10032
|
customNode("BaseElement2D")
|
|
9861
10033
|
], BaseElement2D);
|
|
9862
10034
|
|
|
@@ -9876,9 +10048,16 @@ for (const key in defaultStyles) {
|
|
|
9876
10048
|
defineProperty(Element2DStyle, key, { fallback: defaultStyles[key] });
|
|
9877
10049
|
}
|
|
9878
10050
|
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
10051
|
+
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
10052
|
+
constructor(properties) {
|
|
10053
|
+
super();
|
|
10054
|
+
this.setProperties(properties);
|
|
10055
|
+
}
|
|
10056
|
+
}
|
|
10057
|
+
|
|
10058
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
10059
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
10060
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
9882
10061
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9883
10062
|
if (decorator = decorators[i])
|
|
9884
10063
|
result = (decorator(result)) || result;
|
|
@@ -9929,17 +10108,10 @@ let Element2D = class extends BaseElement2D {
|
|
|
9929
10108
|
}
|
|
9930
10109
|
}
|
|
9931
10110
|
};
|
|
9932
|
-
Element2D = __decorateClass$
|
|
10111
|
+
Element2D = __decorateClass$k([
|
|
9933
10112
|
customNode("Element2D")
|
|
9934
10113
|
], Element2D);
|
|
9935
10114
|
|
|
9936
|
-
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
9937
|
-
constructor(properties) {
|
|
9938
|
-
super();
|
|
9939
|
-
this.setProperties(properties);
|
|
9940
|
-
}
|
|
9941
|
-
}
|
|
9942
|
-
|
|
9943
10115
|
const alignMap = {
|
|
9944
10116
|
"auto": Align.Auto,
|
|
9945
10117
|
"flex-start": Align.FlexStart,
|
|
@@ -10181,9 +10353,9 @@ class FlexLayout {
|
|
|
10181
10353
|
}
|
|
10182
10354
|
}
|
|
10183
10355
|
|
|
10184
|
-
var __getOwnPropDesc$
|
|
10185
|
-
var __decorateClass$
|
|
10186
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10356
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
10357
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
10358
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
10187
10359
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10188
10360
|
if (decorator = decorators[i])
|
|
10189
10361
|
result = (decorator(result)) || result;
|
|
@@ -10260,18 +10432,18 @@ let FlexElement2D = class extends BaseElement2D {
|
|
|
10260
10432
|
}
|
|
10261
10433
|
}
|
|
10262
10434
|
};
|
|
10263
|
-
FlexElement2D = __decorateClass$
|
|
10435
|
+
FlexElement2D = __decorateClass$j([
|
|
10264
10436
|
customNode("FlexElement2D")
|
|
10265
10437
|
], FlexElement2D);
|
|
10266
10438
|
|
|
10267
|
-
var __defProp$
|
|
10268
|
-
var __getOwnPropDesc$
|
|
10269
|
-
var __decorateClass$
|
|
10270
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10439
|
+
var __defProp$e = Object.defineProperty;
|
|
10440
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
10441
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
10442
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
10271
10443
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10272
10444
|
if (decorator = decorators[i])
|
|
10273
10445
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10274
|
-
if (kind && result) __defProp$
|
|
10446
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
10275
10447
|
return result;
|
|
10276
10448
|
};
|
|
10277
10449
|
let Image2D = class extends Element2D {
|
|
@@ -10407,19 +10579,19 @@ let Image2D = class extends Element2D {
|
|
|
10407
10579
|
});
|
|
10408
10580
|
}
|
|
10409
10581
|
};
|
|
10410
|
-
__decorateClass$
|
|
10582
|
+
__decorateClass$i([
|
|
10411
10583
|
property({ protected: true })
|
|
10412
10584
|
], Image2D.prototype, "texture", 2);
|
|
10413
|
-
__decorateClass$
|
|
10585
|
+
__decorateClass$i([
|
|
10414
10586
|
property({ fallback: "" })
|
|
10415
10587
|
], Image2D.prototype, "src", 2);
|
|
10416
|
-
__decorateClass$
|
|
10588
|
+
__decorateClass$i([
|
|
10417
10589
|
property()
|
|
10418
10590
|
], Image2D.prototype, "srcRect", 2);
|
|
10419
|
-
__decorateClass$
|
|
10591
|
+
__decorateClass$i([
|
|
10420
10592
|
property({ fallback: false })
|
|
10421
10593
|
], Image2D.prototype, "gif", 2);
|
|
10422
|
-
Image2D = __decorateClass$
|
|
10594
|
+
Image2D = __decorateClass$i([
|
|
10423
10595
|
customNode("Image2D")
|
|
10424
10596
|
], Image2D);
|
|
10425
10597
|
|
|
@@ -10443,14 +10615,14 @@ class TextureRect2D extends Element2D {
|
|
|
10443
10615
|
}
|
|
10444
10616
|
}
|
|
10445
10617
|
|
|
10446
|
-
var __defProp$
|
|
10447
|
-
var __getOwnPropDesc$
|
|
10448
|
-
var __decorateClass$
|
|
10449
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10618
|
+
var __defProp$d = Object.defineProperty;
|
|
10619
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10620
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10621
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10450
10622
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10451
10623
|
if (decorator = decorators[i])
|
|
10452
10624
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10453
|
-
if (kind && result) __defProp$
|
|
10625
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
10454
10626
|
return result;
|
|
10455
10627
|
};
|
|
10456
10628
|
let Lottie2D = class extends TextureRect2D {
|
|
@@ -10493,189 +10665,13 @@ let Lottie2D = class extends TextureRect2D {
|
|
|
10493
10665
|
super._process(delta);
|
|
10494
10666
|
}
|
|
10495
10667
|
};
|
|
10496
|
-
__decorateClass$
|
|
10668
|
+
__decorateClass$h([
|
|
10497
10669
|
property({ fallback: "" })
|
|
10498
10670
|
], Lottie2D.prototype, "src", 2);
|
|
10499
|
-
Lottie2D = __decorateClass$
|
|
10671
|
+
Lottie2D = __decorateClass$h([
|
|
10500
10672
|
customNode("Lottie2D")
|
|
10501
10673
|
], Lottie2D);
|
|
10502
10674
|
|
|
10503
|
-
var __defProp$d = Object.defineProperty;
|
|
10504
|
-
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10505
|
-
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10506
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10507
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10508
|
-
if (decorator = decorators[i])
|
|
10509
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10510
|
-
if (kind && result) __defProp$d(target, key, result);
|
|
10511
|
-
return result;
|
|
10512
|
-
};
|
|
10513
|
-
const textStyles = new Set(Object.keys(textDefaultStyle));
|
|
10514
|
-
let Text2D = class extends TextureRect2D {
|
|
10515
|
-
texture = new CanvasTexture();
|
|
10516
|
-
base = new Text();
|
|
10517
|
-
measureResult;
|
|
10518
|
-
_subTextsCount = 0;
|
|
10519
|
-
constructor(properties, children = []) {
|
|
10520
|
-
super();
|
|
10521
|
-
this.setProperties(properties);
|
|
10522
|
-
this.append(children);
|
|
10523
|
-
if (properties?.plugins) {
|
|
10524
|
-
properties.plugins.forEach((plugin) => {
|
|
10525
|
-
this.base.use(plugin);
|
|
10526
|
-
});
|
|
10527
|
-
}
|
|
10528
|
-
}
|
|
10529
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
10530
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
10531
|
-
switch (key) {
|
|
10532
|
-
case "content":
|
|
10533
|
-
case "effects":
|
|
10534
|
-
case "measureDOM":
|
|
10535
|
-
case "fonts":
|
|
10536
|
-
case "split":
|
|
10537
|
-
this._updateSplit();
|
|
10538
|
-
this.requestRedraw();
|
|
10539
|
-
break;
|
|
10540
|
-
}
|
|
10541
|
-
if (this._subTextsCount && key === "effects") {
|
|
10542
|
-
this._getSubTexts().forEach((child) => {
|
|
10543
|
-
child.setProperties({ [key]: value });
|
|
10544
|
-
});
|
|
10545
|
-
}
|
|
10546
|
-
}
|
|
10547
|
-
_updateBase() {
|
|
10548
|
-
this.base.style = this.style.toJSON();
|
|
10549
|
-
this.emit("updateBase", this.base);
|
|
10550
|
-
this.base.requestUpdate();
|
|
10551
|
-
}
|
|
10552
|
-
_updateStyleProperty(key, value, oldValue) {
|
|
10553
|
-
switch (key) {
|
|
10554
|
-
case "left":
|
|
10555
|
-
case "top":
|
|
10556
|
-
case "width":
|
|
10557
|
-
case "height":
|
|
10558
|
-
this.requestRedraw();
|
|
10559
|
-
break;
|
|
10560
|
-
default:
|
|
10561
|
-
super._updateStyleProperty(key, value, oldValue);
|
|
10562
|
-
break;
|
|
10563
|
-
}
|
|
10564
|
-
switch (key) {
|
|
10565
|
-
case "width":
|
|
10566
|
-
if (this.split) {
|
|
10567
|
-
this._updateSubTexts();
|
|
10568
|
-
}
|
|
10569
|
-
break;
|
|
10570
|
-
}
|
|
10571
|
-
if (typeof key === "string" && textStyles.has(key)) {
|
|
10572
|
-
if (this._subTextsCount && key !== "width" && key !== "height") {
|
|
10573
|
-
this._getSubTexts().forEach((child) => {
|
|
10574
|
-
child.style.setProperties({ [key]: value });
|
|
10575
|
-
});
|
|
10576
|
-
}
|
|
10577
|
-
this.requestRedraw();
|
|
10578
|
-
}
|
|
10579
|
-
}
|
|
10580
|
-
_getSubTexts() {
|
|
10581
|
-
return this.children.front.filter((node) => node instanceof Text2D);
|
|
10582
|
-
}
|
|
10583
|
-
_updateSubTexts() {
|
|
10584
|
-
const subTexts = this._getSubTexts();
|
|
10585
|
-
let i = 0;
|
|
10586
|
-
if (this.split) {
|
|
10587
|
-
this.updateMeasure().measureResult?.paragraphs.forEach((p) => {
|
|
10588
|
-
p.fragments.forEach((f) => {
|
|
10589
|
-
f.characters.forEach((c) => {
|
|
10590
|
-
const child = subTexts[i];
|
|
10591
|
-
if (child) {
|
|
10592
|
-
child.style.left = c.inlineBox.left;
|
|
10593
|
-
child.style.top = c.inlineBox.top;
|
|
10594
|
-
}
|
|
10595
|
-
i++;
|
|
10596
|
-
});
|
|
10597
|
-
});
|
|
10598
|
-
});
|
|
10599
|
-
}
|
|
10600
|
-
}
|
|
10601
|
-
measure() {
|
|
10602
|
-
this._updateBase();
|
|
10603
|
-
return this.base.measure();
|
|
10604
|
-
}
|
|
10605
|
-
updateMeasure() {
|
|
10606
|
-
this.measureResult = this.measure();
|
|
10607
|
-
const { boundingBox } = this.measureResult;
|
|
10608
|
-
const { left, top } = this.style;
|
|
10609
|
-
this.position.x = left + Math.min(0, boundingBox.left);
|
|
10610
|
-
this.position.y = top + Math.min(0, boundingBox.top);
|
|
10611
|
-
this.size.width = boundingBox.width;
|
|
10612
|
-
this.size.height = boundingBox.height;
|
|
10613
|
-
return this;
|
|
10614
|
-
}
|
|
10615
|
-
_updateSplit() {
|
|
10616
|
-
if (this._subTextsCount) {
|
|
10617
|
-
this.children.front.forEach((child) => this.removeChild(child));
|
|
10618
|
-
this._subTextsCount = 0;
|
|
10619
|
-
}
|
|
10620
|
-
if (this.split) {
|
|
10621
|
-
this.measure().paragraphs.forEach((p) => {
|
|
10622
|
-
p.fragments.forEach((f) => {
|
|
10623
|
-
f.characters.forEach((c) => {
|
|
10624
|
-
this.append(
|
|
10625
|
-
new Text2D({
|
|
10626
|
-
internalMode: "front",
|
|
10627
|
-
style: {
|
|
10628
|
-
...c.computedStyle,
|
|
10629
|
-
left: c.inlineBox.x,
|
|
10630
|
-
top: c.inlineBox.y,
|
|
10631
|
-
width: 0,
|
|
10632
|
-
height: 0
|
|
10633
|
-
},
|
|
10634
|
-
content: c.content,
|
|
10635
|
-
effects: this.effects,
|
|
10636
|
-
fonts: this.fonts
|
|
10637
|
-
})
|
|
10638
|
-
);
|
|
10639
|
-
this._subTextsCount++;
|
|
10640
|
-
});
|
|
10641
|
-
});
|
|
10642
|
-
});
|
|
10643
|
-
}
|
|
10644
|
-
}
|
|
10645
|
-
_redraw() {
|
|
10646
|
-
this.updateMeasure();
|
|
10647
|
-
return super._redraw();
|
|
10648
|
-
}
|
|
10649
|
-
_drawContent() {
|
|
10650
|
-
if (!this.split) {
|
|
10651
|
-
this.base.render({
|
|
10652
|
-
pixelRatio: this.texture.pixelRatio,
|
|
10653
|
-
view: this.texture.source
|
|
10654
|
-
});
|
|
10655
|
-
this.texture.requestUpload();
|
|
10656
|
-
super._drawContent();
|
|
10657
|
-
}
|
|
10658
|
-
}
|
|
10659
|
-
};
|
|
10660
|
-
__decorateClass$h([
|
|
10661
|
-
property({ fallback: false })
|
|
10662
|
-
], Text2D.prototype, "split", 2);
|
|
10663
|
-
__decorateClass$h([
|
|
10664
|
-
property({ alias: "base.content" })
|
|
10665
|
-
], Text2D.prototype, "content", 2);
|
|
10666
|
-
__decorateClass$h([
|
|
10667
|
-
property({ alias: "base.effects" })
|
|
10668
|
-
], Text2D.prototype, "effects", 2);
|
|
10669
|
-
__decorateClass$h([
|
|
10670
|
-
property({ protected: true, alias: "base.measureDOM" })
|
|
10671
|
-
], Text2D.prototype, "measureDOM", 2);
|
|
10672
|
-
__decorateClass$h([
|
|
10673
|
-
property({ protected: true, alias: "base.fonts" })
|
|
10674
|
-
], Text2D.prototype, "fonts", 2);
|
|
10675
|
-
Text2D = __decorateClass$h([
|
|
10676
|
-
customNode("Text2D")
|
|
10677
|
-
], Text2D);
|
|
10678
|
-
|
|
10679
10675
|
var __defProp$c = Object.defineProperty;
|
|
10680
10676
|
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
10681
10677
|
var result = void 0 ;
|
|
@@ -10960,7 +10956,7 @@ let Animation = class extends TimelineNode {
|
|
|
10960
10956
|
const offset = 1 / targets.length;
|
|
10961
10957
|
const progress = this.currentTimeProgress;
|
|
10962
10958
|
targets.forEach((target, i) => {
|
|
10963
|
-
const tiem = offset === 1 ? progress : clamp(
|
|
10959
|
+
const tiem = offset === 1 ? progress : clamp(Math.max(0, progress - offset * i) / offset, 0, 1);
|
|
10964
10960
|
const startProps = this._cachedProps.get(target);
|
|
10965
10961
|
if (!startProps)
|
|
10966
10962
|
return;
|
|
@@ -11126,13 +11122,13 @@ let Animation = class extends TimelineNode {
|
|
|
11126
11122
|
}
|
|
11127
11123
|
};
|
|
11128
11124
|
__decorateClass$e([
|
|
11129
|
-
property()
|
|
11125
|
+
property({ fallback: "parent" })
|
|
11130
11126
|
], Animation.prototype, "effectMode", 2);
|
|
11131
11127
|
__decorateClass$e([
|
|
11132
|
-
property()
|
|
11128
|
+
property({ fallback: false })
|
|
11133
11129
|
], Animation.prototype, "loop", 2);
|
|
11134
11130
|
__decorateClass$e([
|
|
11135
|
-
property()
|
|
11131
|
+
property({ default: () => [] })
|
|
11136
11132
|
], Animation.prototype, "keyframes", 2);
|
|
11137
11133
|
__decorateClass$e([
|
|
11138
11134
|
property()
|
|
@@ -12792,7 +12788,7 @@ let Scaler = class extends Node {
|
|
|
12792
12788
|
case "scale":
|
|
12793
12789
|
case "min":
|
|
12794
12790
|
case "max": {
|
|
12795
|
-
this.scale = clamp(this.
|
|
12791
|
+
this.scale = clamp(this.scale, this.minScale, this.maxScale);
|
|
12796
12792
|
this._updateTarget();
|
|
12797
12793
|
break;
|
|
12798
12794
|
}
|
|
@@ -14002,4 +13998,4 @@ async function render(options) {
|
|
|
14002
13998
|
});
|
|
14003
13999
|
}
|
|
14004
14000
|
|
|
14005
|
-
export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, 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, 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,
|
|
14001
|
+
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, 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$1 as frag, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, render, timingFunctions, uid };
|