modern-canvas 0.6.12 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/index.cjs +1676 -1693
- package/dist/index.d.cts +84 -106
- package/dist/index.d.mts +84 -106
- package/dist/index.d.ts +84 -106
- package/dist/index.js +50 -44
- package/dist/index.mjs +1679 -1696
- package/package.json +3 -3
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();
|
|
@@ -955,6 +955,8 @@ class CoreObject extends EventEmitter {
|
|
|
955
955
|
if (value && typeof value === "object") {
|
|
956
956
|
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
957
957
|
json[key] = value.toJSON();
|
|
958
|
+
} else if (Array.isArray(value)) {
|
|
959
|
+
json[key] = [...value];
|
|
958
960
|
} else {
|
|
959
961
|
json[key] = { ...value };
|
|
960
962
|
}
|
|
@@ -1897,6 +1899,14 @@ class Rect2 {
|
|
|
1897
1899
|
toArray() {
|
|
1898
1900
|
return [this.x, this.y, this.width, this.height];
|
|
1899
1901
|
}
|
|
1902
|
+
toJSON() {
|
|
1903
|
+
return {
|
|
1904
|
+
x: this.x,
|
|
1905
|
+
y: this.y,
|
|
1906
|
+
width: this.width,
|
|
1907
|
+
height: this.height
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1900
1910
|
}
|
|
1901
1911
|
|
|
1902
1912
|
class Transform2D extends Matrix3 {
|
|
@@ -2072,7 +2082,7 @@ class Vector3 extends Vector {
|
|
|
2072
2082
|
}
|
|
2073
2083
|
|
|
2074
2084
|
var __defProp$Q = Object.defineProperty;
|
|
2075
|
-
var __decorateClass$
|
|
2085
|
+
var __decorateClass$Z = (decorators, target, key, kind) => {
|
|
2076
2086
|
var result = void 0 ;
|
|
2077
2087
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
2078
2088
|
if (decorator = decorators[i])
|
|
@@ -2120,10 +2130,10 @@ class MainLoop extends CoreObject {
|
|
|
2120
2130
|
this.stop();
|
|
2121
2131
|
}
|
|
2122
2132
|
}
|
|
2123
|
-
__decorateClass$
|
|
2124
|
-
property({ fallback:
|
|
2133
|
+
__decorateClass$Z([
|
|
2134
|
+
property({ fallback: 60 })
|
|
2125
2135
|
], MainLoop.prototype, "fps");
|
|
2126
|
-
__decorateClass$
|
|
2136
|
+
__decorateClass$Z([
|
|
2127
2137
|
property({ fallback: 1 })
|
|
2128
2138
|
], MainLoop.prototype, "speed");
|
|
2129
2139
|
|
|
@@ -2439,7 +2449,7 @@ attribute vec4 aColorMatrixOffset;
|
|
|
2439
2449
|
attribute vec4 aDisableWrapMode;
|
|
2440
2450
|
|
|
2441
2451
|
uniform mat3 projectionMatrix;
|
|
2442
|
-
uniform mat3
|
|
2452
|
+
uniform mat3 worldTransformMatrix;
|
|
2443
2453
|
uniform vec4 modulate;
|
|
2444
2454
|
|
|
2445
2455
|
varying float vTextureId;
|
|
@@ -2451,8 +2461,14 @@ varying vec4 vColorMatrixOffset;
|
|
|
2451
2461
|
varying vec4 vDisableWrapMode;
|
|
2452
2462
|
|
|
2453
2463
|
void main(void) {
|
|
2464
|
+
mat3 modelMatrix = mat3(
|
|
2465
|
+
1.0, 0.0, 0.0,
|
|
2466
|
+
0.0, 1.0, 0.0,
|
|
2467
|
+
0.0, 0.0, 1.0
|
|
2468
|
+
);
|
|
2454
2469
|
vTextureId = aTextureId;
|
|
2455
|
-
|
|
2470
|
+
mat3 modelViewProjectionMatrix = projectionMatrix * worldTransformMatrix * modelMatrix;
|
|
2471
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(aPosition, 1.0)).xy, 0.0, 1.0);
|
|
2456
2472
|
vUv = aUv;
|
|
2457
2473
|
vModulate = aModulate * modulate;
|
|
2458
2474
|
vBackgroundColor = aBackgroundColor;
|
|
@@ -2543,7 +2559,6 @@ void main(void) {
|
|
|
2543
2559
|
renderer2.program.updateUniforms(program, {
|
|
2544
2560
|
samplers,
|
|
2545
2561
|
modulate: [1, 1, 1, 1],
|
|
2546
|
-
translationMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
2547
2562
|
...renderer2.program.uniforms
|
|
2548
2563
|
});
|
|
2549
2564
|
renderer2.vertexArray.bind(vao ?? vertexArray);
|
|
@@ -3198,7 +3213,8 @@ class WebGLProgramModule extends WebGLModule {
|
|
|
3198
3213
|
}
|
|
3199
3214
|
boundProgram = null;
|
|
3200
3215
|
uniforms = {
|
|
3201
|
-
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3216
|
+
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3217
|
+
worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3202
3218
|
};
|
|
3203
3219
|
create(options) {
|
|
3204
3220
|
const program = this.gl.createProgram();
|
|
@@ -3400,7 +3416,10 @@ ${gl.getShaderInfoLog(shader)}`);
|
|
|
3400
3416
|
reset() {
|
|
3401
3417
|
super.reset();
|
|
3402
3418
|
this.boundProgram = null;
|
|
3403
|
-
this.uniforms = {
|
|
3419
|
+
this.uniforms = {
|
|
3420
|
+
projectionMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1],
|
|
3421
|
+
worldTransformMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3422
|
+
};
|
|
3404
3423
|
}
|
|
3405
3424
|
free() {
|
|
3406
3425
|
super.free();
|
|
@@ -3440,6 +3459,33 @@ function getVarTypeSize(type) {
|
|
|
3440
3459
|
}
|
|
3441
3460
|
}
|
|
3442
3461
|
|
|
3462
|
+
function applyMatrixToPoint(m, x, y) {
|
|
3463
|
+
const [a, d, g, b, e, h, c, f, i] = m;
|
|
3464
|
+
const xp = a * x + b * y + c;
|
|
3465
|
+
const yp = d * x + e * y + f;
|
|
3466
|
+
const wp = g * x + h * y + i;
|
|
3467
|
+
return { x: xp / wp, y: yp / wp };
|
|
3468
|
+
}
|
|
3469
|
+
function transformRectToAABB(m, rect) {
|
|
3470
|
+
const { x, y, width, height } = rect;
|
|
3471
|
+
const p1 = applyMatrixToPoint(m, x, y);
|
|
3472
|
+
const p2 = applyMatrixToPoint(m, x + width, y);
|
|
3473
|
+
const p3 = applyMatrixToPoint(m, x + width, y + height);
|
|
3474
|
+
const p4 = applyMatrixToPoint(m, x, y + height);
|
|
3475
|
+
const pts = [p1, p2, p3, p4];
|
|
3476
|
+
const xs = pts.map((p) => p.x);
|
|
3477
|
+
const ys = pts.map((p) => p.y);
|
|
3478
|
+
const minX = Math.min(...xs);
|
|
3479
|
+
const maxX = Math.max(...xs);
|
|
3480
|
+
const minY = Math.min(...ys);
|
|
3481
|
+
const maxY = Math.max(...ys);
|
|
3482
|
+
return {
|
|
3483
|
+
x: minX,
|
|
3484
|
+
y: minY,
|
|
3485
|
+
width: maxX - minX,
|
|
3486
|
+
height: maxY - minY
|
|
3487
|
+
};
|
|
3488
|
+
}
|
|
3443
3489
|
class WebGLScissorModule extends WebGLModule {
|
|
3444
3490
|
install(renderer) {
|
|
3445
3491
|
super.install(renderer);
|
|
@@ -3465,19 +3511,21 @@ class WebGLScissorModule extends WebGLModule {
|
|
|
3465
3511
|
}
|
|
3466
3512
|
use() {
|
|
3467
3513
|
const renderer = this._renderer;
|
|
3468
|
-
const { pixelRatio, mask, viewport, screen, gl } = renderer;
|
|
3469
|
-
const
|
|
3470
|
-
|
|
3514
|
+
const { pixelRatio, mask, viewport, screen, gl, program } = renderer;
|
|
3515
|
+
const { worldTransformMatrix } = program.uniforms;
|
|
3516
|
+
const rect = transformRectToAABB(worldTransformMatrix, mask.last.mask);
|
|
3517
|
+
const { x, y, width, height } = rect;
|
|
3518
|
+
let scissorY;
|
|
3471
3519
|
if (viewport.boundViewport) {
|
|
3472
|
-
|
|
3520
|
+
scissorY = viewport.boundViewport.height - (height + y) * pixelRatio;
|
|
3473
3521
|
} else {
|
|
3474
|
-
|
|
3522
|
+
scissorY = (screen.height - (height + y)) * pixelRatio;
|
|
3475
3523
|
}
|
|
3476
3524
|
gl.scissor(
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3525
|
+
x * pixelRatio,
|
|
3526
|
+
scissorY,
|
|
3527
|
+
width * pixelRatio,
|
|
3528
|
+
height * pixelRatio
|
|
3481
3529
|
);
|
|
3482
3530
|
}
|
|
3483
3531
|
}
|
|
@@ -4154,15 +4202,13 @@ class WebGLRenderer extends Renderer {
|
|
|
4154
4202
|
this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
|
|
4155
4203
|
this.extensions.loseContext?.loseContext();
|
|
4156
4204
|
}
|
|
4157
|
-
toPixels() {
|
|
4158
|
-
const width = this.gl.drawingBufferWidth;
|
|
4159
|
-
const height = this.gl.drawingBufferHeight;
|
|
4205
|
+
toPixels(x = 0, y = 0, width = this.gl.drawingBufferWidth, height = this.gl.drawingBufferHeight) {
|
|
4160
4206
|
const length = width * height * 4;
|
|
4161
4207
|
const row = width * 4;
|
|
4162
4208
|
const end = (height - 1) * row;
|
|
4163
4209
|
const flipedPixels = new Uint8Array(length);
|
|
4164
4210
|
const pixels = new Uint8ClampedArray(length);
|
|
4165
|
-
this.gl.readPixels(
|
|
4211
|
+
this.gl.readPixels(x, y, width, height, this.gl.RGBA, this.gl.UNSIGNED_BYTE, flipedPixels);
|
|
4166
4212
|
for (let i = 0; i < length; i += row) {
|
|
4167
4213
|
pixels.set(flipedPixels.subarray(i, i + row), end - i);
|
|
4168
4214
|
}
|
|
@@ -4194,152 +4240,6 @@ class FontLoader extends Loader {
|
|
|
4194
4240
|
}
|
|
4195
4241
|
}
|
|
4196
4242
|
|
|
4197
|
-
const defaultFilters = {
|
|
4198
|
-
"brightness": 1,
|
|
4199
|
-
"contrast": 1,
|
|
4200
|
-
"grayscale": 0,
|
|
4201
|
-
"hue-rotate": 0,
|
|
4202
|
-
"invert": 0,
|
|
4203
|
-
"opacity": 1,
|
|
4204
|
-
"saturate": 1,
|
|
4205
|
-
"sepia": 0
|
|
4206
|
-
};
|
|
4207
|
-
function parseCSSFilter(filter) {
|
|
4208
|
-
const m = new ColorMatrix();
|
|
4209
|
-
if (filter === "none") {
|
|
4210
|
-
return m;
|
|
4211
|
-
}
|
|
4212
|
-
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
4213
|
-
filter2[name] = args[0].normalizedIntValue;
|
|
4214
|
-
return filter2;
|
|
4215
|
-
}, {});
|
|
4216
|
-
Object.keys(defaultFilters).forEach((name) => {
|
|
4217
|
-
filters[name] = filters[name] ?? defaultFilters[name];
|
|
4218
|
-
});
|
|
4219
|
-
for (const name in filters) {
|
|
4220
|
-
const value = filters[name];
|
|
4221
|
-
switch (name) {
|
|
4222
|
-
case "hue-rotate":
|
|
4223
|
-
m.hueRotate(value * PI_2);
|
|
4224
|
-
break;
|
|
4225
|
-
case "saturate":
|
|
4226
|
-
m.saturate(value);
|
|
4227
|
-
break;
|
|
4228
|
-
case "brightness":
|
|
4229
|
-
m.brightness(value);
|
|
4230
|
-
break;
|
|
4231
|
-
case "contrast":
|
|
4232
|
-
m.contrast(value);
|
|
4233
|
-
break;
|
|
4234
|
-
case "invert":
|
|
4235
|
-
m.invert(value);
|
|
4236
|
-
break;
|
|
4237
|
-
case "sepia":
|
|
4238
|
-
m.sepia(value);
|
|
4239
|
-
break;
|
|
4240
|
-
case "opacity":
|
|
4241
|
-
m.opacity(value);
|
|
4242
|
-
break;
|
|
4243
|
-
case "grayscale":
|
|
4244
|
-
m.grayscale(value);
|
|
4245
|
-
break;
|
|
4246
|
-
}
|
|
4247
|
-
}
|
|
4248
|
-
return m;
|
|
4249
|
-
}
|
|
4250
|
-
|
|
4251
|
-
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4252
|
-
transform = !transform || transform === "none" ? "" : transform;
|
|
4253
|
-
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
4254
|
-
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4255
|
-
switch (name) {
|
|
4256
|
-
case "translate":
|
|
4257
|
-
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
4258
|
-
break;
|
|
4259
|
-
case "translateX":
|
|
4260
|
-
output.translateX(values[0] * width);
|
|
4261
|
-
break;
|
|
4262
|
-
case "translateY":
|
|
4263
|
-
output.translateY(values[0] * height);
|
|
4264
|
-
break;
|
|
4265
|
-
case "translateZ":
|
|
4266
|
-
output.translateZ(values[0]);
|
|
4267
|
-
break;
|
|
4268
|
-
case "translate3d":
|
|
4269
|
-
output.translate3d(
|
|
4270
|
-
values[0] * width,
|
|
4271
|
-
(values[1] ?? values[0]) * height,
|
|
4272
|
-
values[2] ?? values[1] ?? values[0]
|
|
4273
|
-
);
|
|
4274
|
-
break;
|
|
4275
|
-
case "scale":
|
|
4276
|
-
output.scale(values[0], values[1] ?? values[0]);
|
|
4277
|
-
break;
|
|
4278
|
-
case "scaleX":
|
|
4279
|
-
output.scaleX(values[0]);
|
|
4280
|
-
break;
|
|
4281
|
-
case "scaleY":
|
|
4282
|
-
output.scaleY(values[0]);
|
|
4283
|
-
break;
|
|
4284
|
-
case "scale3d":
|
|
4285
|
-
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
4286
|
-
break;
|
|
4287
|
-
case "rotate":
|
|
4288
|
-
output.rotate(values[0] * PI_2);
|
|
4289
|
-
break;
|
|
4290
|
-
case "rotateX":
|
|
4291
|
-
output.rotateX(values[0] * PI_2);
|
|
4292
|
-
break;
|
|
4293
|
-
case "rotateY":
|
|
4294
|
-
output.rotateY(values[0] * PI_2);
|
|
4295
|
-
break;
|
|
4296
|
-
case "rotateZ":
|
|
4297
|
-
output.rotateZ(values[0] * PI_2);
|
|
4298
|
-
break;
|
|
4299
|
-
case "rotate3d":
|
|
4300
|
-
output.rotate3d(
|
|
4301
|
-
values[0] * PI_2,
|
|
4302
|
-
(values[1] ?? values[0]) * PI_2,
|
|
4303
|
-
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
4304
|
-
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
4305
|
-
);
|
|
4306
|
-
break;
|
|
4307
|
-
case "skew":
|
|
4308
|
-
output.skew(values[0], values[0] ?? values[1]);
|
|
4309
|
-
break;
|
|
4310
|
-
case "skewX":
|
|
4311
|
-
output.skewX(values[0]);
|
|
4312
|
-
break;
|
|
4313
|
-
case "skewY":
|
|
4314
|
-
output.skewY(values[0]);
|
|
4315
|
-
break;
|
|
4316
|
-
case "matrix":
|
|
4317
|
-
output.set(values);
|
|
4318
|
-
break;
|
|
4319
|
-
}
|
|
4320
|
-
});
|
|
4321
|
-
return output;
|
|
4322
|
-
}
|
|
4323
|
-
|
|
4324
|
-
function parseCSSTransformOrigin(transformOrigin) {
|
|
4325
|
-
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
4326
|
-
return [originX, originY].map((val) => {
|
|
4327
|
-
val = val.trim();
|
|
4328
|
-
switch (val) {
|
|
4329
|
-
case "left":
|
|
4330
|
-
case "top":
|
|
4331
|
-
return 0;
|
|
4332
|
-
case "center":
|
|
4333
|
-
return 0.5;
|
|
4334
|
-
case "right":
|
|
4335
|
-
case "bottom":
|
|
4336
|
-
return 1;
|
|
4337
|
-
default:
|
|
4338
|
-
return Number(val);
|
|
4339
|
-
}
|
|
4340
|
-
});
|
|
4341
|
-
}
|
|
4342
|
-
|
|
4343
4243
|
class Geometry extends Resource {
|
|
4344
4244
|
vertexAttributes;
|
|
4345
4245
|
indexBuffer;
|
|
@@ -4426,7 +4326,7 @@ class Geometry extends Resource {
|
|
|
4426
4326
|
}
|
|
4427
4327
|
|
|
4428
4328
|
var __defProp$P = Object.defineProperty;
|
|
4429
|
-
var __decorateClass$
|
|
4329
|
+
var __decorateClass$Y = (decorators, target, key, kind) => {
|
|
4430
4330
|
var result = void 0 ;
|
|
4431
4331
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4432
4332
|
if (decorator = decorators[i])
|
|
@@ -4475,15 +4375,15 @@ class IndexBuffer extends Resource {
|
|
|
4475
4375
|
return result;
|
|
4476
4376
|
}
|
|
4477
4377
|
}
|
|
4478
|
-
__decorateClass$
|
|
4378
|
+
__decorateClass$Y([
|
|
4479
4379
|
property({ protected: true, default: null })
|
|
4480
4380
|
], IndexBuffer.prototype, "data");
|
|
4481
|
-
__decorateClass$
|
|
4381
|
+
__decorateClass$Y([
|
|
4482
4382
|
property({ protected: true, fallback: false })
|
|
4483
4383
|
], IndexBuffer.prototype, "dynamic");
|
|
4484
4384
|
|
|
4485
4385
|
var __defProp$O = Object.defineProperty;
|
|
4486
|
-
var __decorateClass$
|
|
4386
|
+
var __decorateClass$X = (decorators, target, key, kind) => {
|
|
4487
4387
|
var result = void 0 ;
|
|
4488
4388
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4489
4389
|
if (decorator = decorators[i])
|
|
@@ -4532,15 +4432,15 @@ class VertexBuffer extends Resource {
|
|
|
4532
4432
|
return result;
|
|
4533
4433
|
}
|
|
4534
4434
|
}
|
|
4535
|
-
__decorateClass$
|
|
4435
|
+
__decorateClass$X([
|
|
4536
4436
|
property({ protected: true, default: null })
|
|
4537
4437
|
], VertexBuffer.prototype, "data");
|
|
4538
|
-
__decorateClass$
|
|
4438
|
+
__decorateClass$X([
|
|
4539
4439
|
property({ protected: true, fallback: false })
|
|
4540
4440
|
], VertexBuffer.prototype, "dynamic");
|
|
4541
4441
|
|
|
4542
4442
|
var __defProp$N = Object.defineProperty;
|
|
4543
|
-
var __decorateClass$
|
|
4443
|
+
var __decorateClass$W = (decorators, target, key, kind) => {
|
|
4544
4444
|
var result = void 0 ;
|
|
4545
4445
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4546
4446
|
if (decorator = decorators[i])
|
|
@@ -4579,25 +4479,25 @@ class VertexAttribute extends Resource {
|
|
|
4579
4479
|
return result;
|
|
4580
4480
|
}
|
|
4581
4481
|
}
|
|
4582
|
-
__decorateClass$
|
|
4482
|
+
__decorateClass$W([
|
|
4583
4483
|
property({ protected: true })
|
|
4584
4484
|
], VertexAttribute.prototype, "buffer");
|
|
4585
|
-
__decorateClass$
|
|
4485
|
+
__decorateClass$W([
|
|
4586
4486
|
property({ fallback: 0 })
|
|
4587
4487
|
], VertexAttribute.prototype, "size");
|
|
4588
|
-
__decorateClass$
|
|
4488
|
+
__decorateClass$W([
|
|
4589
4489
|
property({ fallback: false })
|
|
4590
4490
|
], VertexAttribute.prototype, "normalized");
|
|
4591
|
-
__decorateClass$
|
|
4491
|
+
__decorateClass$W([
|
|
4592
4492
|
property({ fallback: "float" })
|
|
4593
4493
|
], VertexAttribute.prototype, "type");
|
|
4594
|
-
__decorateClass$
|
|
4494
|
+
__decorateClass$W([
|
|
4595
4495
|
property()
|
|
4596
4496
|
], VertexAttribute.prototype, "stride");
|
|
4597
|
-
__decorateClass$
|
|
4497
|
+
__decorateClass$W([
|
|
4598
4498
|
property()
|
|
4599
4499
|
], VertexAttribute.prototype, "offset");
|
|
4600
|
-
__decorateClass$
|
|
4500
|
+
__decorateClass$W([
|
|
4601
4501
|
property()
|
|
4602
4502
|
], VertexAttribute.prototype, "divisor");
|
|
4603
4503
|
|
|
@@ -4842,7 +4742,7 @@ class UvGeometry extends Geometry {
|
|
|
4842
4742
|
}
|
|
4843
4743
|
|
|
4844
4744
|
var __defProp$M = Object.defineProperty;
|
|
4845
|
-
var __decorateClass$
|
|
4745
|
+
var __decorateClass$V = (decorators, target, key, kind) => {
|
|
4846
4746
|
var result = void 0 ;
|
|
4847
4747
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4848
4748
|
if (decorator = decorators[i])
|
|
@@ -4973,22 +4873,22 @@ class Texture2D extends Resource {
|
|
|
4973
4873
|
}
|
|
4974
4874
|
}
|
|
4975
4875
|
}
|
|
4976
|
-
__decorateClass$
|
|
4876
|
+
__decorateClass$V([
|
|
4977
4877
|
property({ protected: true })
|
|
4978
4878
|
], Texture2D.prototype, "source");
|
|
4979
|
-
__decorateClass$
|
|
4879
|
+
__decorateClass$V([
|
|
4980
4880
|
property({ fallback: 0 })
|
|
4981
4881
|
], Texture2D.prototype, "width");
|
|
4982
|
-
__decorateClass$
|
|
4882
|
+
__decorateClass$V([
|
|
4983
4883
|
property({ fallback: 0 })
|
|
4984
4884
|
], Texture2D.prototype, "height");
|
|
4985
|
-
__decorateClass$
|
|
4885
|
+
__decorateClass$V([
|
|
4986
4886
|
property({ fallback: "linear" })
|
|
4987
4887
|
], Texture2D.prototype, "filterMode");
|
|
4988
|
-
__decorateClass$
|
|
4888
|
+
__decorateClass$V([
|
|
4989
4889
|
property({ fallback: "clamp_to_edge" })
|
|
4990
4890
|
], Texture2D.prototype, "wrapMode");
|
|
4991
|
-
__decorateClass$
|
|
4891
|
+
__decorateClass$V([
|
|
4992
4892
|
property({ fallback: 1 })
|
|
4993
4893
|
], Texture2D.prototype, "pixelRatio");
|
|
4994
4894
|
|
|
@@ -5019,7 +4919,7 @@ class AnimatedTexture extends Resource {
|
|
|
5019
4919
|
}
|
|
5020
4920
|
|
|
5021
4921
|
var __defProp$L = Object.defineProperty;
|
|
5022
|
-
var __decorateClass$
|
|
4922
|
+
var __decorateClass$U = (decorators, target, key, kind) => {
|
|
5023
4923
|
var result = void 0 ;
|
|
5024
4924
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5025
4925
|
if (decorator = decorators[i])
|
|
@@ -5043,7 +4943,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5043
4943
|
super._updateProperty(key, value, oldValue, declaration);
|
|
5044
4944
|
}
|
|
5045
4945
|
}
|
|
5046
|
-
__decorateClass$
|
|
4946
|
+
__decorateClass$U([
|
|
5047
4947
|
property({ fallback: 2 })
|
|
5048
4948
|
], CanvasTexture.prototype, "pixelRatio");
|
|
5049
4949
|
|
|
@@ -5264,7 +5164,7 @@ class PixelsTexture extends Texture2D {
|
|
|
5264
5164
|
}
|
|
5265
5165
|
|
|
5266
5166
|
var __defProp$K = Object.defineProperty;
|
|
5267
|
-
var __decorateClass$
|
|
5167
|
+
var __decorateClass$T = (decorators, target, key, kind) => {
|
|
5268
5168
|
var result = void 0 ;
|
|
5269
5169
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5270
5170
|
if (decorator = decorators[i])
|
|
@@ -5513,10 +5413,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5513
5413
|
}
|
|
5514
5414
|
}
|
|
5515
5415
|
};
|
|
5516
|
-
__decorateClass$
|
|
5416
|
+
__decorateClass$T([
|
|
5517
5417
|
property({ protected: true, fallback: true })
|
|
5518
5418
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5519
|
-
__decorateClass$
|
|
5419
|
+
__decorateClass$T([
|
|
5520
5420
|
property({ protected: true, fallback: 0 })
|
|
5521
5421
|
], _VideoTexture.prototype, "fps");
|
|
5522
5422
|
let VideoTexture = _VideoTexture;
|
|
@@ -5525,33 +5425,204 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5525
5425
|
//
|
|
5526
5426
|
}
|
|
5527
5427
|
|
|
5528
|
-
class
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5428
|
+
class CanvasContext extends Path2D {
|
|
5429
|
+
fillStyle;
|
|
5430
|
+
strokeStyle;
|
|
5431
|
+
lineCap;
|
|
5432
|
+
lineJoin;
|
|
5433
|
+
lineWidth;
|
|
5434
|
+
miterLimit;
|
|
5435
|
+
// custom
|
|
5436
|
+
uvTransform;
|
|
5437
|
+
vertTransform;
|
|
5438
|
+
_defaultStyle = Texture2D.EMPTY;
|
|
5439
|
+
_draws = [];
|
|
5440
|
+
_toTexture(source) {
|
|
5441
|
+
if (source instanceof Texture2D) {
|
|
5442
|
+
return source;
|
|
5443
|
+
} else {
|
|
5444
|
+
return ColorTexture.get(source);
|
|
5445
|
+
}
|
|
5541
5446
|
}
|
|
5542
|
-
|
|
5543
|
-
this.
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5447
|
+
stroke(options) {
|
|
5448
|
+
if (!this.curves.length) {
|
|
5449
|
+
return;
|
|
5450
|
+
}
|
|
5451
|
+
let strokeStyle = this.strokeStyle;
|
|
5452
|
+
if (!strokeStyle && this.style.stroke) {
|
|
5453
|
+
switch (typeof this.style.stroke) {
|
|
5454
|
+
case "string":
|
|
5455
|
+
strokeStyle = this.style.stroke;
|
|
5456
|
+
break;
|
|
5457
|
+
case "object":
|
|
5458
|
+
if (isColorFillObject(this.style.stroke)) {
|
|
5459
|
+
strokeStyle = this.style.stroke.color;
|
|
5460
|
+
}
|
|
5461
|
+
break;
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5464
|
+
this._draws.push({
|
|
5465
|
+
...options,
|
|
5466
|
+
type: "stroke",
|
|
5467
|
+
path: new Path2D(this),
|
|
5468
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
5469
|
+
uvTransform: this.uvTransform,
|
|
5470
|
+
vertTransform: this.vertTransform,
|
|
5471
|
+
style: {
|
|
5472
|
+
alignment: 0.5,
|
|
5473
|
+
cap: this.lineCap ?? "butt",
|
|
5474
|
+
join: this.lineJoin ?? "miter",
|
|
5475
|
+
width: this.lineWidth ?? 1,
|
|
5476
|
+
miterLimit: this.miterLimit ?? 10
|
|
5477
|
+
}
|
|
5478
|
+
});
|
|
5479
|
+
super.reset();
|
|
5480
|
+
}
|
|
5481
|
+
fillRect(x, y, width, height) {
|
|
5482
|
+
this.rect(x, y, width, height).fill();
|
|
5483
|
+
}
|
|
5484
|
+
strokeRect(x, y, width, height) {
|
|
5485
|
+
this.rect(x, y, width, height).stroke();
|
|
5486
|
+
}
|
|
5487
|
+
fill(options) {
|
|
5488
|
+
if (!this.curves.length) {
|
|
5489
|
+
return;
|
|
5490
|
+
}
|
|
5491
|
+
let fillStyle = this.fillStyle;
|
|
5492
|
+
if (!fillStyle && this.style.fill) {
|
|
5493
|
+
switch (typeof this.style.fill) {
|
|
5494
|
+
case "string":
|
|
5495
|
+
fillStyle = this.style.fill;
|
|
5496
|
+
break;
|
|
5497
|
+
case "object":
|
|
5498
|
+
if (isColorFillObject(this.style.fill)) {
|
|
5499
|
+
fillStyle = this.style.fill.color;
|
|
5500
|
+
}
|
|
5501
|
+
break;
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
this._draws.push({
|
|
5505
|
+
...options,
|
|
5506
|
+
type: "fill",
|
|
5507
|
+
path: new Path2D(this),
|
|
5508
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
5509
|
+
uvTransform: this.uvTransform,
|
|
5510
|
+
vertTransform: this.vertTransform
|
|
5511
|
+
});
|
|
5512
|
+
super.reset();
|
|
5513
|
+
}
|
|
5514
|
+
copy(source) {
|
|
5515
|
+
super.copy(source);
|
|
5516
|
+
this.strokeStyle = source.strokeStyle;
|
|
5517
|
+
this.fillStyle = source.fillStyle;
|
|
5518
|
+
this.uvTransform = source.uvTransform;
|
|
5519
|
+
this.vertTransform = source.vertTransform;
|
|
5520
|
+
this.lineCap = source.lineCap;
|
|
5521
|
+
this.lineJoin = source.lineJoin;
|
|
5522
|
+
this.lineWidth = source.lineWidth;
|
|
5523
|
+
this.miterLimit = source.miterLimit;
|
|
5524
|
+
this._draws = source._draws.slice();
|
|
5525
|
+
return this;
|
|
5526
|
+
}
|
|
5527
|
+
reset() {
|
|
5528
|
+
super.reset();
|
|
5529
|
+
this.strokeStyle = void 0;
|
|
5530
|
+
this.fillStyle = void 0;
|
|
5531
|
+
this.uvTransform = void 0;
|
|
5532
|
+
this.vertTransform = void 0;
|
|
5533
|
+
this.lineCap = void 0;
|
|
5534
|
+
this.lineJoin = void 0;
|
|
5535
|
+
this.lineWidth = void 0;
|
|
5536
|
+
this.miterLimit = void 0;
|
|
5537
|
+
this._draws.length = 0;
|
|
5538
|
+
return this;
|
|
5539
|
+
}
|
|
5540
|
+
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
5541
|
+
if (texture) {
|
|
5542
|
+
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
5543
|
+
const w = texture.width;
|
|
5544
|
+
const h = texture.height;
|
|
5545
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5546
|
+
const x = vertices[i];
|
|
5547
|
+
const y = vertices[i + 1];
|
|
5548
|
+
let uvX;
|
|
5549
|
+
let uvY;
|
|
5550
|
+
if (_uvTransform) {
|
|
5551
|
+
[uvX, uvY] = _uvTransform(x, y);
|
|
5552
|
+
} else {
|
|
5553
|
+
[uvX, uvY] = [x / w, y / h];
|
|
5554
|
+
}
|
|
5555
|
+
uvs.push(uvX, uvY);
|
|
5556
|
+
}
|
|
5557
|
+
} else {
|
|
5558
|
+
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
5559
|
+
uvs.push(0, 0);
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
}
|
|
5563
|
+
toBatchables() {
|
|
5564
|
+
const batchables = [];
|
|
5565
|
+
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
5566
|
+
const current = this._draws[i];
|
|
5567
|
+
const vertices = [];
|
|
5568
|
+
const indices = [];
|
|
5569
|
+
const uvs = [];
|
|
5570
|
+
if (current.type === "fill") {
|
|
5571
|
+
current.path.fillTriangulate({
|
|
5572
|
+
vertices,
|
|
5573
|
+
indices
|
|
5574
|
+
});
|
|
5575
|
+
} else {
|
|
5576
|
+
current.path.strokeTriangulate({
|
|
5577
|
+
vertices,
|
|
5578
|
+
indices,
|
|
5579
|
+
lineStyle: current.style,
|
|
5580
|
+
flipAlignment: false,
|
|
5581
|
+
closed: true
|
|
5582
|
+
});
|
|
5583
|
+
}
|
|
5584
|
+
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
5585
|
+
batchables.push({
|
|
5586
|
+
vertices,
|
|
5587
|
+
indices,
|
|
5588
|
+
uvs,
|
|
5589
|
+
texture: current.texture,
|
|
5590
|
+
type: current.type,
|
|
5591
|
+
disableWrapMode: current.disableWrapMode,
|
|
5592
|
+
vertTransform: current.vertTransform
|
|
5593
|
+
});
|
|
5594
|
+
}
|
|
5595
|
+
return batchables;
|
|
5596
|
+
}
|
|
5597
|
+
}
|
|
5598
|
+
|
|
5599
|
+
class Children extends Array {
|
|
5600
|
+
front = [];
|
|
5601
|
+
back = [];
|
|
5602
|
+
get internal() {
|
|
5603
|
+
return [
|
|
5604
|
+
...this.front,
|
|
5605
|
+
...this,
|
|
5606
|
+
...this.back
|
|
5607
|
+
];
|
|
5608
|
+
}
|
|
5609
|
+
constructor(...items) {
|
|
5610
|
+
super();
|
|
5611
|
+
this.set(items);
|
|
5612
|
+
}
|
|
5613
|
+
set(items) {
|
|
5614
|
+
this.front.length = 0;
|
|
5615
|
+
this.length = 0;
|
|
5616
|
+
this.back.length = 0;
|
|
5617
|
+
items.forEach((item) => {
|
|
5618
|
+
switch (item.internalMode) {
|
|
5619
|
+
case "front":
|
|
5620
|
+
this.front.push(item);
|
|
5621
|
+
break;
|
|
5622
|
+
case "default":
|
|
5623
|
+
this.push(item);
|
|
5624
|
+
break;
|
|
5625
|
+
case "back":
|
|
5555
5626
|
this.back.push(item);
|
|
5556
5627
|
break;
|
|
5557
5628
|
}
|
|
@@ -5576,9 +5647,9 @@ class Children extends Array {
|
|
|
5576
5647
|
}
|
|
5577
5648
|
|
|
5578
5649
|
var __defProp$J = Object.defineProperty;
|
|
5579
|
-
var __getOwnPropDesc$
|
|
5580
|
-
var __decorateClass$
|
|
5581
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5650
|
+
var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
|
|
5651
|
+
var __decorateClass$S = (decorators, target, key, kind) => {
|
|
5652
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$J(target, key) : target;
|
|
5582
5653
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
5583
5654
|
if (decorator = decorators[i])
|
|
5584
5655
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -5643,7 +5714,7 @@ let Node = class extends CoreObject {
|
|
|
5643
5714
|
return this._tree;
|
|
5644
5715
|
}
|
|
5645
5716
|
getViewport() {
|
|
5646
|
-
return this.
|
|
5717
|
+
return this.parent?.getViewport() ?? this.getWindow();
|
|
5647
5718
|
}
|
|
5648
5719
|
getWindow() {
|
|
5649
5720
|
return this._tree?.root;
|
|
@@ -6066,38 +6137,38 @@ let Node = class extends CoreObject {
|
|
|
6066
6137
|
return node;
|
|
6067
6138
|
}
|
|
6068
6139
|
};
|
|
6069
|
-
__decorateClass$
|
|
6140
|
+
__decorateClass$S([
|
|
6070
6141
|
property({ fallback: idGenerator() })
|
|
6071
6142
|
], Node.prototype, "id", 2);
|
|
6072
|
-
__decorateClass$
|
|
6143
|
+
__decorateClass$S([
|
|
6073
6144
|
property({ fallback: idGenerator() })
|
|
6074
6145
|
], Node.prototype, "name", 2);
|
|
6075
|
-
__decorateClass$
|
|
6146
|
+
__decorateClass$S([
|
|
6076
6147
|
property({ fallback: "inherit" })
|
|
6077
6148
|
], Node.prototype, "processMode", 2);
|
|
6078
|
-
__decorateClass$
|
|
6149
|
+
__decorateClass$S([
|
|
6079
6150
|
property({ fallback: "default" })
|
|
6080
6151
|
], Node.prototype, "processSortMode", 2);
|
|
6081
|
-
__decorateClass$
|
|
6152
|
+
__decorateClass$S([
|
|
6082
6153
|
property({ fallback: "inherit" })
|
|
6083
6154
|
], Node.prototype, "renderMode", 2);
|
|
6084
|
-
__decorateClass$
|
|
6155
|
+
__decorateClass$S([
|
|
6085
6156
|
property({ fallback: "default" })
|
|
6086
6157
|
], Node.prototype, "internalMode", 2);
|
|
6087
|
-
__decorateClass$
|
|
6158
|
+
__decorateClass$S([
|
|
6088
6159
|
property({ default: () => ({}) })
|
|
6089
6160
|
], Node.prototype, "meta", 2);
|
|
6090
|
-
__decorateClass$
|
|
6161
|
+
__decorateClass$S([
|
|
6091
6162
|
property({ protected: true })
|
|
6092
6163
|
], Node.prototype, "mask", 2);
|
|
6093
|
-
Node = __decorateClass$
|
|
6164
|
+
Node = __decorateClass$S([
|
|
6094
6165
|
customNode("Node")
|
|
6095
6166
|
], Node);
|
|
6096
6167
|
|
|
6097
6168
|
var __defProp$I = Object.defineProperty;
|
|
6098
|
-
var __getOwnPropDesc$
|
|
6099
|
-
var __decorateClass$
|
|
6100
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6169
|
+
var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
|
|
6170
|
+
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
6171
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
|
|
6101
6172
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6102
6173
|
if (decorator = decorators[i])
|
|
6103
6174
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
@@ -6161,52 +6232,231 @@ let TimelineNode = class extends Node {
|
|
|
6161
6232
|
this._updateCurrentTime();
|
|
6162
6233
|
}
|
|
6163
6234
|
};
|
|
6164
|
-
__decorateClass$
|
|
6235
|
+
__decorateClass$R([
|
|
6165
6236
|
property({ fallback: 0 })
|
|
6166
6237
|
], TimelineNode.prototype, "delay", 2);
|
|
6167
|
-
__decorateClass$
|
|
6238
|
+
__decorateClass$R([
|
|
6168
6239
|
property({ fallback: 0 })
|
|
6169
6240
|
], TimelineNode.prototype, "duration", 2);
|
|
6170
|
-
__decorateClass$
|
|
6241
|
+
__decorateClass$R([
|
|
6171
6242
|
property({ fallback: false })
|
|
6172
6243
|
], TimelineNode.prototype, "paused", 2);
|
|
6173
|
-
__decorateClass$
|
|
6244
|
+
__decorateClass$R([
|
|
6174
6245
|
property({ protected: true, fallback: false })
|
|
6175
6246
|
], TimelineNode.prototype, "insideTimeRange", 2);
|
|
6176
|
-
TimelineNode = __decorateClass$
|
|
6247
|
+
TimelineNode = __decorateClass$R([
|
|
6177
6248
|
customNode("TimelineNode")
|
|
6178
6249
|
], TimelineNode);
|
|
6179
6250
|
|
|
6180
6251
|
var __defProp$H = Object.defineProperty;
|
|
6181
|
-
var __getOwnPropDesc$
|
|
6182
|
-
var __decorateClass$
|
|
6183
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6252
|
+
var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
|
|
6253
|
+
var __decorateClass$Q = (decorators, target, key, kind) => {
|
|
6254
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
|
|
6184
6255
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6185
6256
|
if (decorator = decorators[i])
|
|
6186
6257
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6187
6258
|
if (kind && result) __defProp$H(target, key, result);
|
|
6188
6259
|
return result;
|
|
6189
6260
|
};
|
|
6190
|
-
let
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
this.
|
|
6261
|
+
let CanvasItem = class extends TimelineNode {
|
|
6262
|
+
_parentGlobalVisible;
|
|
6263
|
+
_globalVisible;
|
|
6264
|
+
get globalVisible() {
|
|
6265
|
+
return this._globalVisible ?? true;
|
|
6195
6266
|
}
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6201
|
-
];
|
|
6202
|
-
get valid() {
|
|
6203
|
-
return Boolean(this.width && this.height);
|
|
6267
|
+
_parentGlobalOpacity;
|
|
6268
|
+
_globalOpacity;
|
|
6269
|
+
get globalOpacity() {
|
|
6270
|
+
return this._globalOpacity ?? 1;
|
|
6204
6271
|
}
|
|
6205
|
-
|
|
6206
|
-
|
|
6272
|
+
_modulate = new Color(4294967295);
|
|
6273
|
+
// Batch render
|
|
6274
|
+
context = new CanvasContext();
|
|
6275
|
+
_resetContext = true;
|
|
6276
|
+
_redrawing = true;
|
|
6277
|
+
_relayouting = false;
|
|
6278
|
+
_repainting = false;
|
|
6279
|
+
_originalBatchables = [];
|
|
6280
|
+
_layoutedBatchables = [];
|
|
6281
|
+
_batchables = [];
|
|
6282
|
+
constructor(properties, nodes = []) {
|
|
6283
|
+
super();
|
|
6284
|
+
this.setProperties(properties).append(nodes);
|
|
6207
6285
|
}
|
|
6208
|
-
|
|
6209
|
-
|
|
6286
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
6287
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
6288
|
+
switch (key) {
|
|
6289
|
+
case "modulate":
|
|
6290
|
+
this._modulate.value = value;
|
|
6291
|
+
this.requestRepaint();
|
|
6292
|
+
break;
|
|
6293
|
+
case "blendMode":
|
|
6294
|
+
this.requestRepaint();
|
|
6295
|
+
break;
|
|
6296
|
+
case "opacity":
|
|
6297
|
+
this._updateGlobalOpacity();
|
|
6298
|
+
break;
|
|
6299
|
+
case "visible":
|
|
6300
|
+
case "insideTimeRange":
|
|
6301
|
+
this._updateGlobalVisible();
|
|
6302
|
+
break;
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
show() {
|
|
6306
|
+
this.visible = true;
|
|
6307
|
+
}
|
|
6308
|
+
hide() {
|
|
6309
|
+
this.visible = false;
|
|
6310
|
+
}
|
|
6311
|
+
isVisibleInTree() {
|
|
6312
|
+
return this.globalOpacity > 0 && this.globalVisible;
|
|
6313
|
+
}
|
|
6314
|
+
canRender() {
|
|
6315
|
+
return super.canRender() && this.isVisibleInTree();
|
|
6316
|
+
}
|
|
6317
|
+
requestRedraw() {
|
|
6318
|
+
this._redrawing = true;
|
|
6319
|
+
}
|
|
6320
|
+
requestRelayout() {
|
|
6321
|
+
this._relayouting = true;
|
|
6322
|
+
}
|
|
6323
|
+
requestRepaint() {
|
|
6324
|
+
this._repainting = true;
|
|
6325
|
+
}
|
|
6326
|
+
_updateGlobalVisible() {
|
|
6327
|
+
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
6328
|
+
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
6329
|
+
}
|
|
6330
|
+
_updateGlobalOpacity() {
|
|
6331
|
+
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
6332
|
+
const globalOpacity = clamp(0, this.opacity, 1) * (this._parentGlobalOpacity ?? 1);
|
|
6333
|
+
if (this._globalOpacity !== globalOpacity) {
|
|
6334
|
+
this._globalOpacity = globalOpacity;
|
|
6335
|
+
this.requestRepaint();
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6338
|
+
_draw() {
|
|
6339
|
+
this.emit("draw");
|
|
6340
|
+
}
|
|
6341
|
+
_redraw() {
|
|
6342
|
+
this.log(this.name, "drawing");
|
|
6343
|
+
this._draw();
|
|
6344
|
+
return this.context.toBatchables();
|
|
6345
|
+
}
|
|
6346
|
+
_relayout(batchables) {
|
|
6347
|
+
this.log(this.name, "layouting");
|
|
6348
|
+
return batchables;
|
|
6349
|
+
}
|
|
6350
|
+
_repaint(batchables) {
|
|
6351
|
+
this.log(this.name, "painting");
|
|
6352
|
+
return batchables.map((batchable) => {
|
|
6353
|
+
return {
|
|
6354
|
+
...batchable,
|
|
6355
|
+
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
6356
|
+
blendMode: this.blendMode
|
|
6357
|
+
};
|
|
6358
|
+
});
|
|
6359
|
+
}
|
|
6360
|
+
_process(delta) {
|
|
6361
|
+
super._process(delta);
|
|
6362
|
+
const parent = this.getParent();
|
|
6363
|
+
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
6364
|
+
this._updateGlobalVisible();
|
|
6365
|
+
}
|
|
6366
|
+
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
6367
|
+
this._updateGlobalOpacity();
|
|
6368
|
+
}
|
|
6369
|
+
}
|
|
6370
|
+
_updateBatchables() {
|
|
6371
|
+
const redrawing = this._redrawing;
|
|
6372
|
+
let relayouting = this._relayouting;
|
|
6373
|
+
let repainting = this._repainting;
|
|
6374
|
+
let batchables;
|
|
6375
|
+
if (redrawing) {
|
|
6376
|
+
this._originalBatchables = this._redraw();
|
|
6377
|
+
relayouting = true;
|
|
6378
|
+
}
|
|
6379
|
+
if (relayouting) {
|
|
6380
|
+
this._layoutedBatchables = this._relayout(this._originalBatchables);
|
|
6381
|
+
repainting = true;
|
|
6382
|
+
}
|
|
6383
|
+
if (repainting) {
|
|
6384
|
+
batchables = this._repaint(this._layoutedBatchables);
|
|
6385
|
+
}
|
|
6386
|
+
if (redrawing) {
|
|
6387
|
+
if (this._resetContext) {
|
|
6388
|
+
this.context.reset();
|
|
6389
|
+
}
|
|
6390
|
+
}
|
|
6391
|
+
if (batchables) {
|
|
6392
|
+
this._batchables = batchables;
|
|
6393
|
+
this._redrawing = false;
|
|
6394
|
+
this._relayouting = false;
|
|
6395
|
+
this._repainting = false;
|
|
6396
|
+
}
|
|
6397
|
+
}
|
|
6398
|
+
_render(renderer) {
|
|
6399
|
+
this._updateBatchables();
|
|
6400
|
+
this._batchables.forEach((batchable) => {
|
|
6401
|
+
batchable.texture?.upload(renderer);
|
|
6402
|
+
renderer.batch2D.render({
|
|
6403
|
+
...batchable,
|
|
6404
|
+
texture: batchable.texture?._glTexture(renderer)
|
|
6405
|
+
});
|
|
6406
|
+
});
|
|
6407
|
+
super._render(renderer);
|
|
6408
|
+
}
|
|
6409
|
+
};
|
|
6410
|
+
__decorateClass$Q([
|
|
6411
|
+
property()
|
|
6412
|
+
], CanvasItem.prototype, "modulate", 2);
|
|
6413
|
+
__decorateClass$Q([
|
|
6414
|
+
property()
|
|
6415
|
+
], CanvasItem.prototype, "blendMode", 2);
|
|
6416
|
+
__decorateClass$Q([
|
|
6417
|
+
property({ protected: true, fallback: true })
|
|
6418
|
+
], CanvasItem.prototype, "visible", 2);
|
|
6419
|
+
__decorateClass$Q([
|
|
6420
|
+
property({ protected: true, fallback: 1 })
|
|
6421
|
+
], CanvasItem.prototype, "opacity", 2);
|
|
6422
|
+
CanvasItem = __decorateClass$Q([
|
|
6423
|
+
customNode("CanvasItem")
|
|
6424
|
+
], CanvasItem);
|
|
6425
|
+
|
|
6426
|
+
var __defProp$G = Object.defineProperty;
|
|
6427
|
+
var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
|
|
6428
|
+
var __decorateClass$P = (decorators, target, key, kind) => {
|
|
6429
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
|
|
6430
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6431
|
+
if (decorator = decorators[i])
|
|
6432
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6433
|
+
if (kind && result) __defProp$G(target, key, result);
|
|
6434
|
+
return result;
|
|
6435
|
+
};
|
|
6436
|
+
let Viewport = class extends Node {
|
|
6437
|
+
constructor(flipY = false) {
|
|
6438
|
+
super();
|
|
6439
|
+
this.flipY = flipY;
|
|
6440
|
+
this.projection.flipY(flipY);
|
|
6441
|
+
}
|
|
6442
|
+
projection = new Projection2D();
|
|
6443
|
+
canvasTransform = new Transform2D();
|
|
6444
|
+
_framebufferIndex = 0;
|
|
6445
|
+
_framebuffers = [
|
|
6446
|
+
{ texture: new ViewportTexture(), needsUpload: false },
|
|
6447
|
+
{ texture: new ViewportTexture(), needsUpload: false }
|
|
6448
|
+
];
|
|
6449
|
+
get valid() {
|
|
6450
|
+
return Boolean(this.width && this.height);
|
|
6451
|
+
}
|
|
6452
|
+
get framebuffer() {
|
|
6453
|
+
return this._framebuffers[this._framebufferIndex];
|
|
6454
|
+
}
|
|
6455
|
+
get texture() {
|
|
6456
|
+
return this.framebuffer.texture;
|
|
6457
|
+
}
|
|
6458
|
+
getViewport() {
|
|
6459
|
+
return this;
|
|
6210
6460
|
}
|
|
6211
6461
|
/** @internal */
|
|
6212
6462
|
_glFramebufferOptions(renderer) {
|
|
@@ -6239,13 +6489,13 @@ let Viewport = class extends Node {
|
|
|
6239
6489
|
case "x":
|
|
6240
6490
|
case "y":
|
|
6241
6491
|
this.requestUpload();
|
|
6242
|
-
this.
|
|
6492
|
+
this.projection.translate(this.x, this.y);
|
|
6243
6493
|
this.emit("updateRect");
|
|
6244
6494
|
break;
|
|
6245
6495
|
case "width":
|
|
6246
6496
|
case "height":
|
|
6247
6497
|
this.requestUpload();
|
|
6248
|
-
this.
|
|
6498
|
+
this.projection.resize(this.width, this.height);
|
|
6249
6499
|
this.emit("updateRect");
|
|
6250
6500
|
break;
|
|
6251
6501
|
}
|
|
@@ -6304,6 +6554,8 @@ let Viewport = class extends Node {
|
|
|
6304
6554
|
}
|
|
6305
6555
|
render(renderer, next) {
|
|
6306
6556
|
const oldViewport = this._tree?.getCurrentViewport();
|
|
6557
|
+
renderer.program.uniforms.projectionMatrix = this.projection.toArray(true);
|
|
6558
|
+
renderer.program.uniforms.worldTransformMatrix = this.canvasTransform.toArray(true);
|
|
6307
6559
|
this.activate(renderer);
|
|
6308
6560
|
renderer.clear();
|
|
6309
6561
|
super.render(renderer, next);
|
|
@@ -6318,9 +6570,6 @@ let Viewport = class extends Node {
|
|
|
6318
6570
|
getRect() {
|
|
6319
6571
|
return new Rect2(this.x, this.y, this.width, this.height);
|
|
6320
6572
|
}
|
|
6321
|
-
toProjectionArray(transpose = false) {
|
|
6322
|
-
return this._projection.toArray(transpose);
|
|
6323
|
-
}
|
|
6324
6573
|
};
|
|
6325
6574
|
__decorateClass$P([
|
|
6326
6575
|
property({ fallback: 0 })
|
|
@@ -6338,14 +6587,14 @@ Viewport = __decorateClass$P([
|
|
|
6338
6587
|
customNode("Viewport")
|
|
6339
6588
|
], Viewport);
|
|
6340
6589
|
|
|
6341
|
-
var __defProp$
|
|
6590
|
+
var __defProp$F = Object.defineProperty;
|
|
6342
6591
|
var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
|
|
6343
6592
|
var __decorateClass$O = (decorators, target, key, kind) => {
|
|
6344
6593
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
|
|
6345
6594
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6346
6595
|
if (decorator = decorators[i])
|
|
6347
6596
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6348
|
-
if (kind && result) __defProp$
|
|
6597
|
+
if (kind && result) __defProp$F(target, key, result);
|
|
6349
6598
|
return result;
|
|
6350
6599
|
};
|
|
6351
6600
|
let Effect = class extends TimelineNode {
|
|
@@ -6603,295 +6852,228 @@ Effect = __decorateClass$O([
|
|
|
6603
6852
|
customNode("Effect")
|
|
6604
6853
|
], Effect);
|
|
6605
6854
|
|
|
6606
|
-
|
|
6855
|
+
class RenderStack {
|
|
6856
|
+
currentCall;
|
|
6857
|
+
calls = [];
|
|
6858
|
+
createCall(renderable) {
|
|
6859
|
+
return {
|
|
6860
|
+
renderable,
|
|
6861
|
+
parentCall: this.currentCall,
|
|
6862
|
+
fn: renderable.render.bind(renderable),
|
|
6863
|
+
calls: []
|
|
6864
|
+
};
|
|
6865
|
+
}
|
|
6866
|
+
push(renderable) {
|
|
6867
|
+
const call = this.createCall(renderable);
|
|
6868
|
+
(this.currentCall?.calls ?? this.calls).push(call);
|
|
6869
|
+
return call;
|
|
6870
|
+
}
|
|
6871
|
+
render(renderer) {
|
|
6872
|
+
this.calls.forEach(function render(call) {
|
|
6873
|
+
call.fn(renderer, () => {
|
|
6874
|
+
call.calls.forEach(render);
|
|
6875
|
+
});
|
|
6876
|
+
});
|
|
6877
|
+
this.calls = [];
|
|
6878
|
+
}
|
|
6879
|
+
}
|
|
6880
|
+
|
|
6881
|
+
var __defProp$E = Object.defineProperty;
|
|
6607
6882
|
var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
|
|
6608
|
-
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6609
6883
|
var __decorateClass$N = (decorators, target, key, kind) => {
|
|
6610
6884
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
|
|
6611
6885
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6612
6886
|
if (decorator = decorators[i])
|
|
6613
6887
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6614
|
-
if (kind && result) __defProp$
|
|
6888
|
+
if (kind && result) __defProp$E(target, key, result);
|
|
6615
6889
|
return result;
|
|
6616
6890
|
};
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6891
|
+
let Timeline = class extends Node {
|
|
6892
|
+
static from(range, loop = false) {
|
|
6893
|
+
const [startTime, endTime] = range ? Array.isArray(range) ? range : [0, range] : [];
|
|
6894
|
+
return new Timeline({
|
|
6895
|
+
startTime,
|
|
6896
|
+
endTime,
|
|
6897
|
+
loop
|
|
6898
|
+
});
|
|
6899
|
+
}
|
|
6900
|
+
constructor(properties) {
|
|
6620
6901
|
super();
|
|
6621
|
-
this.setProperties(properties)
|
|
6902
|
+
this.setProperties(properties);
|
|
6622
6903
|
}
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
alpha: this.alpha,
|
|
6634
|
-
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
6635
|
-
});
|
|
6636
|
-
});
|
|
6904
|
+
_updateProperty(key, value, oldValue) {
|
|
6905
|
+
super._updateProperty(key, value, oldValue);
|
|
6906
|
+
switch (key) {
|
|
6907
|
+
case "startTime":
|
|
6908
|
+
this.startTime = Math.min(value, this.endTime);
|
|
6909
|
+
break;
|
|
6910
|
+
case "endTime":
|
|
6911
|
+
this.endTime = value || Number.MAX_SAFE_INTEGER;
|
|
6912
|
+
break;
|
|
6913
|
+
}
|
|
6637
6914
|
}
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
uniform float gamma;
|
|
6651
|
-
uniform float contrast;
|
|
6652
|
-
uniform float saturation;
|
|
6653
|
-
uniform float brightness;
|
|
6654
|
-
uniform float red;
|
|
6655
|
-
uniform float green;
|
|
6656
|
-
uniform float blue;
|
|
6657
|
-
uniform float alpha;
|
|
6658
|
-
|
|
6659
|
-
void main(void) {
|
|
6660
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6661
|
-
if (c.a > 0.0) {
|
|
6662
|
-
c.rgb /= c.a;
|
|
6663
|
-
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
6664
|
-
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
6665
|
-
rgb.r *= red;
|
|
6666
|
-
rgb.g *= green;
|
|
6667
|
-
rgb.b *= blue;
|
|
6668
|
-
c.rgb = rgb * brightness;
|
|
6669
|
-
c.rgb *= c.a;
|
|
6915
|
+
addTime(delta) {
|
|
6916
|
+
const start = this.startTime;
|
|
6917
|
+
const end = this.endTime;
|
|
6918
|
+
let current = this.currentTime;
|
|
6919
|
+
current = current + delta;
|
|
6920
|
+
if (this.loop && current > end) {
|
|
6921
|
+
current = start + current % end;
|
|
6922
|
+
}
|
|
6923
|
+
current = clamp(start, current, end);
|
|
6924
|
+
this.currentTime = current;
|
|
6925
|
+
this.emit("updateCurrentTime", current, delta);
|
|
6926
|
+
return this;
|
|
6670
6927
|
}
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
], ColorAdjustEffect.prototype, "saturation", 2);
|
|
6677
|
-
__decorateClass$N([
|
|
6678
|
-
property()
|
|
6679
|
-
], ColorAdjustEffect.prototype, "contrast", 2);
|
|
6680
|
-
__decorateClass$N([
|
|
6681
|
-
property()
|
|
6682
|
-
], ColorAdjustEffect.prototype, "brightness", 2);
|
|
6683
|
-
__decorateClass$N([
|
|
6684
|
-
property()
|
|
6685
|
-
], ColorAdjustEffect.prototype, "red", 2);
|
|
6928
|
+
_process(delta) {
|
|
6929
|
+
super._process(delta);
|
|
6930
|
+
this.addTime(delta);
|
|
6931
|
+
}
|
|
6932
|
+
};
|
|
6686
6933
|
__decorateClass$N([
|
|
6687
|
-
property()
|
|
6688
|
-
],
|
|
6934
|
+
property({ fallback: 0 })
|
|
6935
|
+
], Timeline.prototype, "startTime", 2);
|
|
6689
6936
|
__decorateClass$N([
|
|
6690
|
-
property()
|
|
6691
|
-
],
|
|
6937
|
+
property({ fallback: 0 })
|
|
6938
|
+
], Timeline.prototype, "currentTime", 2);
|
|
6692
6939
|
__decorateClass$N([
|
|
6693
|
-
property()
|
|
6694
|
-
],
|
|
6940
|
+
property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
6941
|
+
], Timeline.prototype, "endTime", 2);
|
|
6695
6942
|
__decorateClass$N([
|
|
6696
|
-
property()
|
|
6697
|
-
],
|
|
6698
|
-
|
|
6699
|
-
customNode("
|
|
6700
|
-
],
|
|
6943
|
+
property({ fallback: false })
|
|
6944
|
+
], Timeline.prototype, "loop", 2);
|
|
6945
|
+
Timeline = __decorateClass$N([
|
|
6946
|
+
customNode("Timeline")
|
|
6947
|
+
], Timeline);
|
|
6701
6948
|
|
|
6702
|
-
var __defProp$E = Object.defineProperty;
|
|
6703
6949
|
var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
|
|
6704
|
-
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6705
6950
|
var __decorateClass$M = (decorators, target, key, kind) => {
|
|
6706
6951
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
|
|
6707
6952
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6708
6953
|
if (decorator = decorators[i])
|
|
6709
|
-
result = (
|
|
6710
|
-
if (kind && result) __defProp$E(target, key, result);
|
|
6954
|
+
result = (decorator(result)) || result;
|
|
6711
6955
|
return result;
|
|
6712
6956
|
};
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6957
|
+
let Window = class extends Viewport {
|
|
6958
|
+
//
|
|
6959
|
+
};
|
|
6960
|
+
Window = __decorateClass$M([
|
|
6961
|
+
customNode("Window")
|
|
6962
|
+
], Window);
|
|
6963
|
+
|
|
6964
|
+
var __defProp$D = Object.defineProperty;
|
|
6965
|
+
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
6966
|
+
var result = void 0 ;
|
|
6967
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6968
|
+
if (decorator = decorators[i])
|
|
6969
|
+
result = (decorator(target, key, result) ) || result;
|
|
6970
|
+
if (result) __defProp$D(target, key, result);
|
|
6971
|
+
return result;
|
|
6972
|
+
};
|
|
6973
|
+
class SceneTree extends MainLoop {
|
|
6974
|
+
input = new Input();
|
|
6975
|
+
renderStack = new RenderStack();
|
|
6976
|
+
root = new Window(true).setTree(this);
|
|
6977
|
+
timeline;
|
|
6978
|
+
_backgroundColor = new Color();
|
|
6979
|
+
_currentViewport;
|
|
6980
|
+
getCurrentViewport() {
|
|
6981
|
+
return this._currentViewport;
|
|
6982
|
+
}
|
|
6983
|
+
setCurrentViewport(viewport) {
|
|
6984
|
+
this._currentViewport = viewport;
|
|
6985
|
+
}
|
|
6986
|
+
constructor(timeline = new Timeline()) {
|
|
6717
6987
|
super();
|
|
6718
|
-
this.
|
|
6988
|
+
this.timeline = timeline.setTree(this);
|
|
6719
6989
|
}
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
}
|
|
6754
|
-
});
|
|
6755
|
-
source.redraw(renderer, () => {
|
|
6756
|
-
QuadUvGeometry.draw(renderer, ColorFilterEffect.material, {
|
|
6757
|
-
sampler: 0,
|
|
6758
|
-
m: matrix.toArray()
|
|
6759
|
-
});
|
|
6990
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
6991
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
6992
|
+
switch (key) {
|
|
6993
|
+
case "backgroundColor":
|
|
6994
|
+
this._backgroundColor.value = value;
|
|
6995
|
+
break;
|
|
6996
|
+
}
|
|
6997
|
+
}
|
|
6998
|
+
log(...args) {
|
|
6999
|
+
if (this.debug) {
|
|
7000
|
+
console.log(`[modern-canvas][${performance.now().toFixed(4)}ms]`, ...args);
|
|
7001
|
+
}
|
|
7002
|
+
}
|
|
7003
|
+
_process(delta = 0) {
|
|
7004
|
+
this.timeline.emit("process", delta);
|
|
7005
|
+
this.emit("processing");
|
|
7006
|
+
this.root.emit("process", delta);
|
|
7007
|
+
this.emit("processed");
|
|
7008
|
+
}
|
|
7009
|
+
_render(renderer) {
|
|
7010
|
+
this.emit("rendering");
|
|
7011
|
+
this.renderStack.render(renderer);
|
|
7012
|
+
this._renderScreen(renderer);
|
|
7013
|
+
this.emit("rendered");
|
|
7014
|
+
}
|
|
7015
|
+
_renderScreen(renderer) {
|
|
7016
|
+
renderer.state.reset();
|
|
7017
|
+
renderer.framebuffer.bind(null);
|
|
7018
|
+
renderer.viewport.bind({
|
|
7019
|
+
x: 0,
|
|
7020
|
+
y: 0,
|
|
7021
|
+
width: this.root.width * renderer.pixelRatio,
|
|
7022
|
+
height: this.root.height * renderer.pixelRatio
|
|
6760
7023
|
});
|
|
7024
|
+
if (this.backgroundColor) {
|
|
7025
|
+
renderer.gl.clearColor(...this._backgroundColor.toArray());
|
|
7026
|
+
}
|
|
7027
|
+
renderer.clear();
|
|
7028
|
+
if (this.backgroundColor) {
|
|
7029
|
+
renderer.gl.clearColor(0, 0, 0, 0);
|
|
7030
|
+
}
|
|
7031
|
+
const texture = this.root.texture;
|
|
7032
|
+
texture.activate(renderer, 0);
|
|
7033
|
+
QuadUvGeometry.draw(renderer);
|
|
7034
|
+
renderer.texture.unbind(texture);
|
|
6761
7035
|
}
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
attribute vec2 uv;
|
|
6767
|
-
varying vec2 vUv;
|
|
6768
|
-
void main() {
|
|
6769
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
6770
|
-
vUv = uv;
|
|
6771
|
-
}`,
|
|
6772
|
-
frag: `precision highp float;
|
|
6773
|
-
varying vec2 vUv;
|
|
6774
|
-
uniform sampler2D sampler;
|
|
6775
|
-
uniform float m[20];
|
|
6776
|
-
|
|
6777
|
-
void main(void) {
|
|
6778
|
-
vec4 c = texture2D(sampler, vUv);
|
|
6779
|
-
if (c.a > 0.0) {
|
|
6780
|
-
c.rgb /= c.a;
|
|
7036
|
+
free() {
|
|
7037
|
+
super.free();
|
|
7038
|
+
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7039
|
+
this.input.removeEventListeners();
|
|
6781
7040
|
}
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
);
|
|
6788
|
-
}`
|
|
6789
|
-
}));
|
|
6790
|
-
__decorateClass$M([
|
|
7041
|
+
}
|
|
7042
|
+
__decorateClass$L([
|
|
7043
|
+
property({ fallback: false })
|
|
7044
|
+
], SceneTree.prototype, "processPaused");
|
|
7045
|
+
__decorateClass$L([
|
|
6791
7046
|
property()
|
|
6792
|
-
],
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
],
|
|
7047
|
+
], SceneTree.prototype, "backgroundColor");
|
|
7048
|
+
__decorateClass$L([
|
|
7049
|
+
property({ protected: true, fallback: false })
|
|
7050
|
+
], SceneTree.prototype, "debug");
|
|
6796
7051
|
|
|
6797
|
-
var __defProp$D = Object.defineProperty;
|
|
6798
7052
|
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
6799
|
-
var
|
|
6800
|
-
var __decorateClass$L = (decorators, target, key, kind) => {
|
|
7053
|
+
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
6801
7054
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
|
|
6802
7055
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6803
7056
|
if (decorator = decorators[i])
|
|
6804
|
-
result = (
|
|
6805
|
-
if (kind && result) __defProp$D(target, key, result);
|
|
7057
|
+
result = (decorator(result)) || result;
|
|
6806
7058
|
return result;
|
|
6807
7059
|
};
|
|
6808
|
-
|
|
6809
|
-
const MAX_COLORS$1 = 50;
|
|
6810
|
-
let ColorOverlayEffect = class extends Effect {
|
|
6811
|
-
_color = new Color();
|
|
7060
|
+
let Transition = class extends Effect {
|
|
6812
7061
|
constructor(properties, children = []) {
|
|
6813
7062
|
super();
|
|
6814
7063
|
this.setProperties(properties).append(children);
|
|
6815
7064
|
}
|
|
6816
|
-
apply(renderer, source) {
|
|
6817
|
-
source.redraw(renderer, () => {
|
|
6818
|
-
const colors = this.colors.map((val) => {
|
|
6819
|
-
this._color.value = val;
|
|
6820
|
-
const rgba = this._color.toArray();
|
|
6821
|
-
rgba[3] = this.alpha;
|
|
6822
|
-
return rgba;
|
|
6823
|
-
});
|
|
6824
|
-
while (colors.length < MAX_COLORS$1) {
|
|
6825
|
-
colors.push([0, 0, 0, 0]);
|
|
6826
|
-
}
|
|
6827
|
-
QuadUvGeometry.draw(renderer, ColorOverlayEffect.material, {
|
|
6828
|
-
sampler: 0,
|
|
6829
|
-
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
6830
|
-
});
|
|
6831
|
-
});
|
|
6832
|
-
}
|
|
6833
7065
|
};
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
vUv = uv;
|
|
6842
|
-
}`,
|
|
6843
|
-
frag: `precision mediump float;
|
|
6844
|
-
uniform sampler2D sampler;
|
|
6845
|
-
uniform vec4 colors[${MAX_COLORS$1}];
|
|
6846
|
-
varying vec2 vUv;
|
|
6847
|
-
|
|
6848
|
-
float calcWidth() {
|
|
6849
|
-
return distance(vec2(0, 0), vec2(1, 0));
|
|
6850
|
-
}
|
|
6851
|
-
|
|
6852
|
-
int calcCount() {
|
|
6853
|
-
int count = 0;
|
|
6854
|
-
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
6855
|
-
if (colors[i] != vec4(0,0,0,0)){
|
|
6856
|
-
count++;
|
|
6857
|
-
}
|
|
6858
|
-
}
|
|
6859
|
-
return count;
|
|
6860
|
-
}
|
|
6861
|
-
|
|
6862
|
-
vec4 calcColor(float x) {
|
|
6863
|
-
float perUnit = calcWidth() / float(calcCount());
|
|
6864
|
-
int index = int(x / perUnit);
|
|
6865
|
-
|
|
6866
|
-
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
6867
|
-
if(i==index){
|
|
6868
|
-
return colors[i];
|
|
6869
|
-
}
|
|
6870
|
-
}
|
|
6871
|
-
|
|
6872
|
-
return vec4(0, 0, 0, 0);
|
|
6873
|
-
}
|
|
6874
|
-
|
|
6875
|
-
void main(void) {
|
|
6876
|
-
vec4 color = texture2D(sampler, vUv);
|
|
6877
|
-
vec4 mask = calcColor(vUv.x);
|
|
6878
|
-
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
6879
|
-
}`
|
|
6880
|
-
}));
|
|
6881
|
-
__decorateClass$L([
|
|
6882
|
-
property()
|
|
6883
|
-
], ColorOverlayEffect.prototype, "colors", 2);
|
|
6884
|
-
__decorateClass$L([
|
|
6885
|
-
property()
|
|
6886
|
-
], ColorOverlayEffect.prototype, "alpha", 2);
|
|
6887
|
-
ColorOverlayEffect = __decorateClass$L([
|
|
6888
|
-
customNode("ColorOverlayEffect")
|
|
6889
|
-
], ColorOverlayEffect);
|
|
7066
|
+
Transition = __decorateClass$K([
|
|
7067
|
+
customNode("Transition", {
|
|
7068
|
+
effectMode: "transition",
|
|
7069
|
+
processMode: "pausable",
|
|
7070
|
+
duration: 2e3
|
|
7071
|
+
})
|
|
7072
|
+
], Transition);
|
|
6890
7073
|
|
|
6891
7074
|
var __defProp$C = Object.defineProperty;
|
|
6892
7075
|
var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
|
|
6893
|
-
var
|
|
6894
|
-
var __decorateClass$K = (decorators, target, key, kind) => {
|
|
7076
|
+
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
6895
7077
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
|
|
6896
7078
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6897
7079
|
if (decorator = decorators[i])
|
|
@@ -6899,84 +7081,119 @@ var __decorateClass$K = (decorators, target, key, kind) => {
|
|
|
6899
7081
|
if (kind && result) __defProp$C(target, key, result);
|
|
6900
7082
|
return result;
|
|
6901
7083
|
};
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
7084
|
+
let Node2D = class extends CanvasItem {
|
|
7085
|
+
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7086
|
+
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
7087
|
+
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
7088
|
+
transform = new Transform2D();
|
|
7089
|
+
globalPosition = new Vector2();
|
|
7090
|
+
globalScale = new Vector2();
|
|
7091
|
+
globalSkew = new Vector2();
|
|
7092
|
+
globalTransform = new Transform2D();
|
|
7093
|
+
_parentTransformDirtyId;
|
|
7094
|
+
constructor(properties, nodes = []) {
|
|
6906
7095
|
super();
|
|
6907
|
-
this.setProperties(properties).append(
|
|
7096
|
+
this.setProperties(properties).append(nodes);
|
|
6908
7097
|
}
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
});
|
|
6916
|
-
while (colors.length < maxColors) {
|
|
6917
|
-
colors.push([-1, 0, 0]);
|
|
7098
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
7099
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
7100
|
+
switch (key) {
|
|
7101
|
+
case "rotation":
|
|
7102
|
+
this.requestRelayout();
|
|
7103
|
+
break;
|
|
6918
7104
|
}
|
|
6919
|
-
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
6920
|
-
originalColors[i * 3] = originalColor[0];
|
|
6921
|
-
originalColors[i * 3 + 1] = originalColor[1];
|
|
6922
|
-
originalColors[i * 3 + 2] = originalColor[2];
|
|
6923
|
-
});
|
|
6924
|
-
source.redraw(renderer, () => {
|
|
6925
|
-
QuadUvGeometry.draw(renderer, ColorRemoveEffect.material, {
|
|
6926
|
-
sampler: 0,
|
|
6927
|
-
epsilon: this.epsilon,
|
|
6928
|
-
originalColors
|
|
6929
|
-
});
|
|
6930
|
-
});
|
|
6931
7105
|
}
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
7106
|
+
getTransformOrigin() {
|
|
7107
|
+
return new Vector2(0, 0);
|
|
7108
|
+
}
|
|
7109
|
+
getTransform(cb) {
|
|
7110
|
+
const origin = this.getTransformOrigin();
|
|
7111
|
+
const transform = new Transform2D();
|
|
7112
|
+
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
7113
|
+
cb?.(transform);
|
|
7114
|
+
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
7115
|
+
return transform;
|
|
7116
|
+
}
|
|
7117
|
+
updateTransform() {
|
|
7118
|
+
this.transform.copy(this.getTransform());
|
|
7119
|
+
}
|
|
7120
|
+
updateGlobalTransform() {
|
|
7121
|
+
this.updateTransform();
|
|
7122
|
+
const parent = this.getParent();
|
|
7123
|
+
if (parent?.globalTransform) {
|
|
7124
|
+
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
7125
|
+
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
7126
|
+
this.globalRotation = parent.globalRotation + this.rotation;
|
|
7127
|
+
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
7128
|
+
} else {
|
|
7129
|
+
this.globalScale.copy(this.scale);
|
|
7130
|
+
this.globalRotation = this.rotation;
|
|
7131
|
+
this.globalTransform.copy(this.transform);
|
|
6955
7132
|
}
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
7133
|
+
const [
|
|
7134
|
+
a,
|
|
7135
|
+
c,
|
|
7136
|
+
tx,
|
|
7137
|
+
b,
|
|
7138
|
+
d,
|
|
7139
|
+
ty
|
|
7140
|
+
] = this.globalTransform.toArray();
|
|
7141
|
+
this.globalPosition.set(tx, ty);
|
|
7142
|
+
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
7143
|
+
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
7144
|
+
this.requestRelayout();
|
|
7145
|
+
}
|
|
7146
|
+
_transformVertices(vertices, vertTransform) {
|
|
7147
|
+
let a, c, tx, b, d, ty;
|
|
7148
|
+
if (vertTransform) {
|
|
7149
|
+
const globalTransform = this.globalTransform.clone();
|
|
7150
|
+
globalTransform.multiply(
|
|
7151
|
+
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
7152
|
+
);
|
|
7153
|
+
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
7154
|
+
} else {
|
|
7155
|
+
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
7156
|
+
}
|
|
7157
|
+
const newVertices = vertices.slice();
|
|
7158
|
+
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
7159
|
+
const x = vertices[i];
|
|
7160
|
+
const y = vertices[i + 1];
|
|
7161
|
+
newVertices[i] = a * x + c * y + tx;
|
|
7162
|
+
newVertices[i + 1] = b * x + d * y + ty;
|
|
6960
7163
|
}
|
|
7164
|
+
return newVertices;
|
|
6961
7165
|
}
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
7166
|
+
_relayout(batchables) {
|
|
7167
|
+
batchables = super._relayout(batchables);
|
|
7168
|
+
this.updateGlobalTransform();
|
|
7169
|
+
return batchables.map((batchable) => {
|
|
7170
|
+
return {
|
|
7171
|
+
...batchable,
|
|
7172
|
+
vertices: this._transformVertices(batchable.vertices, batchable.vertTransform)
|
|
7173
|
+
};
|
|
7174
|
+
});
|
|
7175
|
+
}
|
|
7176
|
+
_process(delta) {
|
|
7177
|
+
super._process(delta);
|
|
7178
|
+
const parent = this.getParent();
|
|
7179
|
+
if (parent?.globalTransform && this._parentTransformDirtyId !== parent?.globalTransform?.dirtyId) {
|
|
7180
|
+
this.requestRelayout();
|
|
7181
|
+
}
|
|
7182
|
+
}
|
|
7183
|
+
};
|
|
7184
|
+
__decorateClass$J([
|
|
7185
|
+
property({ protected: true, fallback: 0 })
|
|
7186
|
+
], Node2D.prototype, "rotation", 2);
|
|
7187
|
+
__decorateClass$J([
|
|
7188
|
+
property({ protected: true, fallback: 0 })
|
|
7189
|
+
], Node2D.prototype, "globalRotation", 2);
|
|
7190
|
+
Node2D = __decorateClass$J([
|
|
7191
|
+
customNode("Node2D")
|
|
7192
|
+
], Node2D);
|
|
6975
7193
|
|
|
6976
7194
|
var __defProp$B = Object.defineProperty;
|
|
6977
7195
|
var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
|
|
6978
|
-
var
|
|
6979
|
-
var __decorateClass$J = (decorators, target, key, kind) => {
|
|
7196
|
+
var __decorateClass$I = (decorators, target, key, kind) => {
|
|
6980
7197
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
|
|
6981
7198
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6982
7199
|
if (decorator = decorators[i])
|
|
@@ -6984,53 +7201,242 @@ var __decorateClass$J = (decorators, target, key, kind) => {
|
|
|
6984
7201
|
if (kind && result) __defProp$B(target, key, result);
|
|
6985
7202
|
return result;
|
|
6986
7203
|
};
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
_color = new Color();
|
|
6991
|
-
constructor(properties, children = []) {
|
|
7204
|
+
let Camera2D = class extends Node2D {
|
|
7205
|
+
zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
|
|
7206
|
+
constructor(properties, nodes = []) {
|
|
6992
7207
|
super();
|
|
6993
|
-
this.setProperties(properties).append(
|
|
7208
|
+
this.setProperties(properties).append(nodes);
|
|
6994
7209
|
}
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
const
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7210
|
+
_input(event, key) {
|
|
7211
|
+
super._input(event, key);
|
|
7212
|
+
if (key === "wheel") {
|
|
7213
|
+
const e = event;
|
|
7214
|
+
if (e.ctrlKey) {
|
|
7215
|
+
const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
|
|
7216
|
+
if (!isTouchPad) {
|
|
7217
|
+
e.preventDefault();
|
|
7218
|
+
const value = this.zoom.x + e.deltaY * -0.015;
|
|
7219
|
+
const zoom = Math.min(this.maxZoom, Math.max(this.minZoom, value));
|
|
7220
|
+
const ratio = 1 - zoom / this.zoom.x;
|
|
7221
|
+
this.zoom.set([
|
|
7222
|
+
zoom,
|
|
7223
|
+
zoom
|
|
7224
|
+
]);
|
|
7225
|
+
this.position.add([
|
|
7226
|
+
(e.screenX - this.position.x) * ratio,
|
|
7227
|
+
(e.screenY - this.position.y) * ratio
|
|
7228
|
+
]);
|
|
7229
|
+
}
|
|
7230
|
+
} else {
|
|
7231
|
+
e.preventDefault();
|
|
7232
|
+
this.position.add([
|
|
7233
|
+
-e.deltaX,
|
|
7234
|
+
-e.deltaY
|
|
7235
|
+
]);
|
|
7236
|
+
}
|
|
7014
7237
|
}
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7238
|
+
}
|
|
7239
|
+
updateTransform() {
|
|
7240
|
+
super.updateTransform();
|
|
7241
|
+
this.updateCanvasTransform();
|
|
7242
|
+
}
|
|
7243
|
+
updateCanvasTransform() {
|
|
7244
|
+
const viewport = this.getViewport();
|
|
7245
|
+
if (!viewport)
|
|
7246
|
+
return;
|
|
7247
|
+
viewport.canvasTransform.identity().scale(this.zoom.x, this.zoom.y).translate(this.position.x, this.position.y);
|
|
7248
|
+
}
|
|
7249
|
+
};
|
|
7250
|
+
__decorateClass$I([
|
|
7251
|
+
property({ fallback: 6 })
|
|
7252
|
+
], Camera2D.prototype, "maxZoom", 2);
|
|
7253
|
+
__decorateClass$I([
|
|
7254
|
+
property({ fallback: 0.1 })
|
|
7255
|
+
], Camera2D.prototype, "minZoom", 2);
|
|
7256
|
+
Camera2D = __decorateClass$I([
|
|
7257
|
+
customNode("Camera2D")
|
|
7258
|
+
], Camera2D);
|
|
7259
|
+
|
|
7260
|
+
const defaultFilters = {
|
|
7261
|
+
"brightness": 1,
|
|
7262
|
+
"contrast": 1,
|
|
7263
|
+
"grayscale": 0,
|
|
7264
|
+
"hue-rotate": 0,
|
|
7265
|
+
"invert": 0,
|
|
7266
|
+
"opacity": 1,
|
|
7267
|
+
"saturate": 1,
|
|
7268
|
+
"sepia": 0
|
|
7269
|
+
};
|
|
7270
|
+
function parseCSSFilter(filter) {
|
|
7271
|
+
const m = new ColorMatrix();
|
|
7272
|
+
if (filter === "none") {
|
|
7273
|
+
return m;
|
|
7274
|
+
}
|
|
7275
|
+
const filters = parseCssFunctions(filter).reduce((filter2, { name, args }) => {
|
|
7276
|
+
filter2[name] = args[0].normalizedIntValue;
|
|
7277
|
+
return filter2;
|
|
7278
|
+
}, {});
|
|
7279
|
+
Object.keys(defaultFilters).forEach((name) => {
|
|
7280
|
+
filters[name] = filters[name] ?? defaultFilters[name];
|
|
7281
|
+
});
|
|
7282
|
+
for (const name in filters) {
|
|
7283
|
+
const value = filters[name];
|
|
7284
|
+
switch (name) {
|
|
7285
|
+
case "hue-rotate":
|
|
7286
|
+
m.hueRotate(value * PI_2);
|
|
7287
|
+
break;
|
|
7288
|
+
case "saturate":
|
|
7289
|
+
m.saturate(value);
|
|
7290
|
+
break;
|
|
7291
|
+
case "brightness":
|
|
7292
|
+
m.brightness(value);
|
|
7293
|
+
break;
|
|
7294
|
+
case "contrast":
|
|
7295
|
+
m.contrast(value);
|
|
7296
|
+
break;
|
|
7297
|
+
case "invert":
|
|
7298
|
+
m.invert(value);
|
|
7299
|
+
break;
|
|
7300
|
+
case "sepia":
|
|
7301
|
+
m.sepia(value);
|
|
7302
|
+
break;
|
|
7303
|
+
case "opacity":
|
|
7304
|
+
m.opacity(value);
|
|
7305
|
+
break;
|
|
7306
|
+
case "grayscale":
|
|
7307
|
+
m.grayscale(value);
|
|
7308
|
+
break;
|
|
7309
|
+
}
|
|
7310
|
+
}
|
|
7311
|
+
return m;
|
|
7312
|
+
}
|
|
7313
|
+
|
|
7314
|
+
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
7315
|
+
transform = !transform || transform === "none" ? "" : transform;
|
|
7316
|
+
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
7317
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7318
|
+
switch (name) {
|
|
7319
|
+
case "translate":
|
|
7320
|
+
output.translate(values[0] * width, (values[1] ?? values[0]) * height);
|
|
7321
|
+
break;
|
|
7322
|
+
case "translateX":
|
|
7323
|
+
output.translateX(values[0] * width);
|
|
7324
|
+
break;
|
|
7325
|
+
case "translateY":
|
|
7326
|
+
output.translateY(values[0] * height);
|
|
7327
|
+
break;
|
|
7328
|
+
case "translateZ":
|
|
7329
|
+
output.translateZ(values[0]);
|
|
7330
|
+
break;
|
|
7331
|
+
case "translate3d":
|
|
7332
|
+
output.translate3d(
|
|
7333
|
+
values[0] * width,
|
|
7334
|
+
(values[1] ?? values[0]) * height,
|
|
7335
|
+
values[2] ?? values[1] ?? values[0]
|
|
7336
|
+
);
|
|
7337
|
+
break;
|
|
7338
|
+
case "scale":
|
|
7339
|
+
output.scale(values[0], values[1] ?? values[0]);
|
|
7340
|
+
break;
|
|
7341
|
+
case "scaleX":
|
|
7342
|
+
output.scaleX(values[0]);
|
|
7343
|
+
break;
|
|
7344
|
+
case "scaleY":
|
|
7345
|
+
output.scaleY(values[0]);
|
|
7346
|
+
break;
|
|
7347
|
+
case "scale3d":
|
|
7348
|
+
output.scale3d(values[0], values[1] ?? values[0], values[2] ?? values[1] ?? values[0]);
|
|
7349
|
+
break;
|
|
7350
|
+
case "rotate":
|
|
7351
|
+
output.rotate(values[0] * PI_2);
|
|
7352
|
+
break;
|
|
7353
|
+
case "rotateX":
|
|
7354
|
+
output.rotateX(values[0] * PI_2);
|
|
7355
|
+
break;
|
|
7356
|
+
case "rotateY":
|
|
7357
|
+
output.rotateY(values[0] * PI_2);
|
|
7358
|
+
break;
|
|
7359
|
+
case "rotateZ":
|
|
7360
|
+
output.rotateZ(values[0] * PI_2);
|
|
7361
|
+
break;
|
|
7362
|
+
case "rotate3d":
|
|
7363
|
+
output.rotate3d(
|
|
7364
|
+
values[0] * PI_2,
|
|
7365
|
+
(values[1] ?? values[0]) * PI_2,
|
|
7366
|
+
(values[2] ?? values[1] ?? values[0]) * PI_2,
|
|
7367
|
+
(values[3] ?? values[2] ?? values[1] ?? values[0]) * PI_2
|
|
7368
|
+
);
|
|
7369
|
+
break;
|
|
7370
|
+
case "skew":
|
|
7371
|
+
output.skew(values[0], values[0] ?? values[1]);
|
|
7372
|
+
break;
|
|
7373
|
+
case "skewX":
|
|
7374
|
+
output.skewX(values[0]);
|
|
7375
|
+
break;
|
|
7376
|
+
case "skewY":
|
|
7377
|
+
output.skewY(values[0]);
|
|
7378
|
+
break;
|
|
7379
|
+
case "matrix":
|
|
7380
|
+
output.set(values);
|
|
7381
|
+
break;
|
|
7382
|
+
}
|
|
7383
|
+
});
|
|
7384
|
+
return output;
|
|
7385
|
+
}
|
|
7386
|
+
|
|
7387
|
+
function parseCSSTransformOrigin(transformOrigin) {
|
|
7388
|
+
const [originX, originY = originX] = transformOrigin.split(" ");
|
|
7389
|
+
return [originX, originY].map((val) => {
|
|
7390
|
+
val = val.trim();
|
|
7391
|
+
switch (val) {
|
|
7392
|
+
case "left":
|
|
7393
|
+
case "top":
|
|
7394
|
+
return 0;
|
|
7395
|
+
case "center":
|
|
7396
|
+
return 0.5;
|
|
7397
|
+
case "right":
|
|
7398
|
+
case "bottom":
|
|
7399
|
+
return 1;
|
|
7400
|
+
default:
|
|
7401
|
+
return Number(val);
|
|
7402
|
+
}
|
|
7403
|
+
});
|
|
7404
|
+
}
|
|
7405
|
+
|
|
7406
|
+
var __defProp$A = Object.defineProperty;
|
|
7407
|
+
var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
|
|
7408
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7409
|
+
var __decorateClass$H = (decorators, target, key, kind) => {
|
|
7410
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
|
|
7411
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7412
|
+
if (decorator = decorators[i])
|
|
7413
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7414
|
+
if (kind && result) __defProp$A(target, key, result);
|
|
7415
|
+
return result;
|
|
7416
|
+
};
|
|
7417
|
+
var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
|
|
7418
|
+
let ColorAdjustEffect = class extends Effect {
|
|
7419
|
+
constructor(properties, children = []) {
|
|
7420
|
+
super();
|
|
7421
|
+
this.setProperties(properties).append(children);
|
|
7422
|
+
}
|
|
7423
|
+
apply(renderer, source) {
|
|
7023
7424
|
source.redraw(renderer, () => {
|
|
7024
|
-
QuadUvGeometry.draw(renderer,
|
|
7425
|
+
QuadUvGeometry.draw(renderer, ColorAdjustEffect.material, {
|
|
7025
7426
|
sampler: 0,
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7427
|
+
saturation: this.saturation,
|
|
7428
|
+
contrast: this.contrast,
|
|
7429
|
+
brightness: this.brightness,
|
|
7430
|
+
red: this.red,
|
|
7431
|
+
green: this.green,
|
|
7432
|
+
blue: this.blue,
|
|
7433
|
+
alpha: this.alpha,
|
|
7434
|
+
gamma: Math.max(this.gamma ?? 1, 1e-4)
|
|
7029
7435
|
});
|
|
7030
7436
|
});
|
|
7031
7437
|
}
|
|
7032
7438
|
};
|
|
7033
|
-
__publicField$
|
|
7439
|
+
__publicField$i(ColorAdjustEffect, "material", new Material({
|
|
7034
7440
|
vert: `precision mediump float;
|
|
7035
7441
|
attribute vec2 position;
|
|
7036
7442
|
attribute vec2 uv;
|
|
@@ -7041,606 +7447,448 @@ void main() {
|
|
|
7041
7447
|
}`,
|
|
7042
7448
|
frag: `varying vec2 vUv;
|
|
7043
7449
|
uniform sampler2D sampler;
|
|
7044
|
-
uniform float
|
|
7045
|
-
|
|
7046
|
-
uniform
|
|
7047
|
-
uniform
|
|
7450
|
+
uniform float gamma;
|
|
7451
|
+
uniform float contrast;
|
|
7452
|
+
uniform float saturation;
|
|
7453
|
+
uniform float brightness;
|
|
7454
|
+
uniform float red;
|
|
7455
|
+
uniform float green;
|
|
7456
|
+
uniform float blue;
|
|
7457
|
+
uniform float alpha;
|
|
7048
7458
|
|
|
7049
7459
|
void main(void) {
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
vec3 origColor = originalColors[i];
|
|
7061
|
-
if (origColor.r < 0.0) {
|
|
7062
|
-
break;
|
|
7063
|
-
}
|
|
7064
|
-
vec3 colorDiff = origColor - color;
|
|
7065
|
-
if (length(colorDiff) < epsilon) {
|
|
7066
|
-
vec3 targetColor = targetColors[i];
|
|
7067
|
-
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7068
|
-
return;
|
|
7069
|
-
}
|
|
7460
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7461
|
+
if (c.a > 0.0) {
|
|
7462
|
+
c.rgb /= c.a;
|
|
7463
|
+
vec3 rgb = pow(c.rgb, vec3(1. / gamma));
|
|
7464
|
+
rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);
|
|
7465
|
+
rgb.r *= red;
|
|
7466
|
+
rgb.g *= green;
|
|
7467
|
+
rgb.b *= blue;
|
|
7468
|
+
c.rgb = rgb * brightness;
|
|
7469
|
+
c.rgb *= c.a;
|
|
7070
7470
|
}
|
|
7471
|
+
gl_FragColor = c * alpha;
|
|
7071
7472
|
}`
|
|
7072
7473
|
}));
|
|
7073
|
-
__decorateClass$
|
|
7474
|
+
__decorateClass$H([
|
|
7074
7475
|
property()
|
|
7075
|
-
],
|
|
7076
|
-
__decorateClass$
|
|
7476
|
+
], ColorAdjustEffect.prototype, "saturation", 2);
|
|
7477
|
+
__decorateClass$H([
|
|
7077
7478
|
property()
|
|
7078
|
-
],
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
],
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
}
|
|
7101
|
-
}
|
|
7102
|
-
stroke(options) {
|
|
7103
|
-
if (!this.curves.length) {
|
|
7104
|
-
return;
|
|
7105
|
-
}
|
|
7106
|
-
let strokeStyle = this.strokeStyle;
|
|
7107
|
-
if (!strokeStyle && this.style.stroke) {
|
|
7108
|
-
switch (typeof this.style.stroke) {
|
|
7109
|
-
case "string":
|
|
7110
|
-
strokeStyle = this.style.stroke;
|
|
7111
|
-
break;
|
|
7112
|
-
case "object":
|
|
7113
|
-
if (isColorFillObject(this.style.stroke)) {
|
|
7114
|
-
strokeStyle = this.style.stroke.color;
|
|
7115
|
-
}
|
|
7116
|
-
break;
|
|
7117
|
-
}
|
|
7118
|
-
}
|
|
7119
|
-
this._draws.push({
|
|
7120
|
-
...options,
|
|
7121
|
-
type: "stroke",
|
|
7122
|
-
path: new Path2D(this),
|
|
7123
|
-
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7124
|
-
uvTransform: this.uvTransform,
|
|
7125
|
-
vertTransform: this.vertTransform,
|
|
7126
|
-
style: {
|
|
7127
|
-
alignment: 0.5,
|
|
7128
|
-
cap: this.lineCap ?? "butt",
|
|
7129
|
-
join: this.lineJoin ?? "miter",
|
|
7130
|
-
width: this.lineWidth ?? 1,
|
|
7131
|
-
miterLimit: this.miterLimit ?? 10
|
|
7132
|
-
}
|
|
7133
|
-
});
|
|
7134
|
-
super.reset();
|
|
7135
|
-
}
|
|
7136
|
-
fillRect(x, y, width, height) {
|
|
7137
|
-
this.rect(x, y, width, height).fill();
|
|
7138
|
-
}
|
|
7139
|
-
strokeRect(x, y, width, height) {
|
|
7140
|
-
this.rect(x, y, width, height).stroke();
|
|
7141
|
-
}
|
|
7142
|
-
fill(options) {
|
|
7143
|
-
if (!this.curves.length) {
|
|
7144
|
-
return;
|
|
7145
|
-
}
|
|
7146
|
-
let fillStyle = this.fillStyle;
|
|
7147
|
-
if (!fillStyle && this.style.fill) {
|
|
7148
|
-
switch (typeof this.style.fill) {
|
|
7149
|
-
case "string":
|
|
7150
|
-
fillStyle = this.style.fill;
|
|
7151
|
-
break;
|
|
7152
|
-
case "object":
|
|
7153
|
-
if (isColorFillObject(this.style.fill)) {
|
|
7154
|
-
fillStyle = this.style.fill.color;
|
|
7155
|
-
}
|
|
7156
|
-
break;
|
|
7157
|
-
}
|
|
7158
|
-
}
|
|
7159
|
-
this._draws.push({
|
|
7160
|
-
...options,
|
|
7161
|
-
type: "fill",
|
|
7162
|
-
path: new Path2D(this),
|
|
7163
|
-
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7164
|
-
uvTransform: this.uvTransform,
|
|
7165
|
-
vertTransform: this.vertTransform
|
|
7166
|
-
});
|
|
7167
|
-
super.reset();
|
|
7168
|
-
}
|
|
7169
|
-
copy(source) {
|
|
7170
|
-
super.copy(source);
|
|
7171
|
-
this.strokeStyle = source.strokeStyle;
|
|
7172
|
-
this.fillStyle = source.fillStyle;
|
|
7173
|
-
this.uvTransform = source.uvTransform;
|
|
7174
|
-
this.vertTransform = source.vertTransform;
|
|
7175
|
-
this.lineCap = source.lineCap;
|
|
7176
|
-
this.lineJoin = source.lineJoin;
|
|
7177
|
-
this.lineWidth = source.lineWidth;
|
|
7178
|
-
this.miterLimit = source.miterLimit;
|
|
7179
|
-
this._draws = source._draws.slice();
|
|
7180
|
-
return this;
|
|
7181
|
-
}
|
|
7182
|
-
reset() {
|
|
7183
|
-
super.reset();
|
|
7184
|
-
this.strokeStyle = void 0;
|
|
7185
|
-
this.fillStyle = void 0;
|
|
7186
|
-
this.uvTransform = void 0;
|
|
7187
|
-
this.vertTransform = void 0;
|
|
7188
|
-
this.lineCap = void 0;
|
|
7189
|
-
this.lineJoin = void 0;
|
|
7190
|
-
this.lineWidth = void 0;
|
|
7191
|
-
this.miterLimit = void 0;
|
|
7192
|
-
this._draws.length = 0;
|
|
7193
|
-
return this;
|
|
7194
|
-
}
|
|
7195
|
-
buildUvs(start, vertices, uvs, texture, uvTransform) {
|
|
7196
|
-
if (texture) {
|
|
7197
|
-
const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.applyToPoint(x, y) : uvTransform;
|
|
7198
|
-
const w = texture.width;
|
|
7199
|
-
const h = texture.height;
|
|
7200
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7201
|
-
const x = vertices[i];
|
|
7202
|
-
const y = vertices[i + 1];
|
|
7203
|
-
let uvX;
|
|
7204
|
-
let uvY;
|
|
7205
|
-
if (_uvTransform) {
|
|
7206
|
-
[uvX, uvY] = _uvTransform(x, y);
|
|
7207
|
-
} else {
|
|
7208
|
-
[uvX, uvY] = [x / w, y / h];
|
|
7209
|
-
}
|
|
7210
|
-
uvs.push(uvX, uvY);
|
|
7211
|
-
}
|
|
7212
|
-
} else {
|
|
7213
|
-
for (let len = vertices.length, i = start; i < len; i += 2) {
|
|
7214
|
-
uvs.push(0, 0);
|
|
7215
|
-
}
|
|
7216
|
-
}
|
|
7217
|
-
}
|
|
7218
|
-
toBatchables() {
|
|
7219
|
-
const batchables = [];
|
|
7220
|
-
for (let len = this._draws.length, i = 0; i < len; i++) {
|
|
7221
|
-
const current = this._draws[i];
|
|
7222
|
-
const vertices = [];
|
|
7223
|
-
const indices = [];
|
|
7224
|
-
const uvs = [];
|
|
7225
|
-
if (current.type === "fill") {
|
|
7226
|
-
current.path.fillTriangulate({
|
|
7227
|
-
vertices,
|
|
7228
|
-
indices
|
|
7229
|
-
});
|
|
7230
|
-
} else {
|
|
7231
|
-
current.path.strokeTriangulate({
|
|
7232
|
-
vertices,
|
|
7233
|
-
indices,
|
|
7234
|
-
lineStyle: current.style,
|
|
7235
|
-
flipAlignment: false,
|
|
7236
|
-
closed: true
|
|
7237
|
-
});
|
|
7238
|
-
}
|
|
7239
|
-
this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
|
|
7240
|
-
batchables.push({
|
|
7241
|
-
vertices,
|
|
7242
|
-
indices,
|
|
7243
|
-
uvs,
|
|
7244
|
-
texture: current.texture,
|
|
7245
|
-
type: current.type,
|
|
7246
|
-
disableWrapMode: current.disableWrapMode,
|
|
7247
|
-
vertTransform: current.vertTransform
|
|
7248
|
-
});
|
|
7249
|
-
}
|
|
7250
|
-
return batchables;
|
|
7251
|
-
}
|
|
7252
|
-
}
|
|
7479
|
+
], ColorAdjustEffect.prototype, "contrast", 2);
|
|
7480
|
+
__decorateClass$H([
|
|
7481
|
+
property()
|
|
7482
|
+
], ColorAdjustEffect.prototype, "brightness", 2);
|
|
7483
|
+
__decorateClass$H([
|
|
7484
|
+
property()
|
|
7485
|
+
], ColorAdjustEffect.prototype, "red", 2);
|
|
7486
|
+
__decorateClass$H([
|
|
7487
|
+
property()
|
|
7488
|
+
], ColorAdjustEffect.prototype, "green", 2);
|
|
7489
|
+
__decorateClass$H([
|
|
7490
|
+
property()
|
|
7491
|
+
], ColorAdjustEffect.prototype, "blue", 2);
|
|
7492
|
+
__decorateClass$H([
|
|
7493
|
+
property()
|
|
7494
|
+
], ColorAdjustEffect.prototype, "alpha", 2);
|
|
7495
|
+
__decorateClass$H([
|
|
7496
|
+
property()
|
|
7497
|
+
], ColorAdjustEffect.prototype, "gamma", 2);
|
|
7498
|
+
ColorAdjustEffect = __decorateClass$H([
|
|
7499
|
+
customNode("ColorAdjustEffect")
|
|
7500
|
+
], ColorAdjustEffect);
|
|
7253
7501
|
|
|
7254
|
-
var __defProp$
|
|
7255
|
-
var __getOwnPropDesc$
|
|
7256
|
-
var
|
|
7257
|
-
|
|
7502
|
+
var __defProp$z = Object.defineProperty;
|
|
7503
|
+
var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
|
|
7504
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7505
|
+
var __decorateClass$G = (decorators, target, key, kind) => {
|
|
7506
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
|
|
7258
7507
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7259
7508
|
if (decorator = decorators[i])
|
|
7260
7509
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7261
|
-
if (kind && result) __defProp$
|
|
7510
|
+
if (kind && result) __defProp$z(target, key, result);
|
|
7262
7511
|
return result;
|
|
7263
7512
|
};
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
return this._globalVisible ?? true;
|
|
7269
|
-
}
|
|
7270
|
-
_parentGlobalOpacity;
|
|
7271
|
-
_globalOpacity;
|
|
7272
|
-
get globalOpacity() {
|
|
7273
|
-
return this._globalOpacity ?? 1;
|
|
7274
|
-
}
|
|
7275
|
-
_modulate = new Color(4294967295);
|
|
7276
|
-
// Batch render
|
|
7277
|
-
context = new CanvasContext();
|
|
7278
|
-
_resetContext = true;
|
|
7279
|
-
_redrawing = true;
|
|
7280
|
-
_relayouting = false;
|
|
7281
|
-
_repainting = false;
|
|
7282
|
-
_originalBatchables = [];
|
|
7283
|
-
_layoutedBatchables = [];
|
|
7284
|
-
_batchables = [];
|
|
7285
|
-
constructor(properties, nodes = []) {
|
|
7513
|
+
var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
|
|
7514
|
+
let ColorFilterEffect = class extends Effect {
|
|
7515
|
+
_colorMatrix = new ColorMatrix();
|
|
7516
|
+
constructor(properties, children = []) {
|
|
7286
7517
|
super();
|
|
7287
|
-
this.setProperties(properties).append(
|
|
7288
|
-
}
|
|
7289
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7290
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7291
|
-
switch (key) {
|
|
7292
|
-
case "modulate":
|
|
7293
|
-
this._modulate.value = value;
|
|
7294
|
-
this.requestRepaint();
|
|
7295
|
-
break;
|
|
7296
|
-
case "blendMode":
|
|
7297
|
-
this.requestRepaint();
|
|
7298
|
-
break;
|
|
7299
|
-
case "opacity":
|
|
7300
|
-
this._updateGlobalOpacity();
|
|
7301
|
-
break;
|
|
7302
|
-
case "visible":
|
|
7303
|
-
case "insideTimeRange":
|
|
7304
|
-
this._updateGlobalVisible();
|
|
7305
|
-
break;
|
|
7306
|
-
}
|
|
7307
|
-
}
|
|
7308
|
-
show() {
|
|
7309
|
-
this.visible = true;
|
|
7310
|
-
}
|
|
7311
|
-
hide() {
|
|
7312
|
-
this.visible = false;
|
|
7313
|
-
}
|
|
7314
|
-
isVisibleInTree() {
|
|
7315
|
-
return this.globalOpacity > 0 && this.globalVisible;
|
|
7316
|
-
}
|
|
7317
|
-
canRender() {
|
|
7318
|
-
return super.canRender() && this.isVisibleInTree();
|
|
7319
|
-
}
|
|
7320
|
-
requestRedraw() {
|
|
7321
|
-
this._redrawing = true;
|
|
7322
|
-
}
|
|
7323
|
-
requestRelayout() {
|
|
7324
|
-
this._relayouting = true;
|
|
7325
|
-
}
|
|
7326
|
-
requestRepaint() {
|
|
7327
|
-
this._repainting = true;
|
|
7328
|
-
}
|
|
7329
|
-
_updateGlobalVisible() {
|
|
7330
|
-
this._parentGlobalVisible = this.getParent()?.globalVisible;
|
|
7331
|
-
this._globalVisible = (this._parentGlobalVisible ?? true) && this.visible && this.insideTimeRange;
|
|
7332
|
-
}
|
|
7333
|
-
_updateGlobalOpacity() {
|
|
7334
|
-
this._parentGlobalOpacity = this.getParent()?.opacity;
|
|
7335
|
-
const globalOpacity = clamp(0, this.opacity, 1) * (this._parentGlobalOpacity ?? 1);
|
|
7336
|
-
if (this._globalOpacity !== globalOpacity) {
|
|
7337
|
-
this._globalOpacity = globalOpacity;
|
|
7338
|
-
this.requestRepaint();
|
|
7339
|
-
}
|
|
7340
|
-
}
|
|
7341
|
-
_draw() {
|
|
7342
|
-
this.emit("draw");
|
|
7343
|
-
}
|
|
7344
|
-
_redraw() {
|
|
7345
|
-
this.log(this.name, "drawing");
|
|
7346
|
-
this._draw();
|
|
7347
|
-
return this.context.toBatchables();
|
|
7348
|
-
}
|
|
7349
|
-
_relayout(batchables) {
|
|
7350
|
-
this.log(this.name, "layouting");
|
|
7351
|
-
return batchables;
|
|
7352
|
-
}
|
|
7353
|
-
_repaint(batchables) {
|
|
7354
|
-
this.log(this.name, "painting");
|
|
7355
|
-
return batchables.map((batchable) => {
|
|
7356
|
-
return {
|
|
7357
|
-
...batchable,
|
|
7358
|
-
modulate: this._modulate.toArgb(this.globalOpacity, true),
|
|
7359
|
-
blendMode: this.blendMode
|
|
7360
|
-
};
|
|
7361
|
-
});
|
|
7362
|
-
}
|
|
7363
|
-
_process(delta) {
|
|
7364
|
-
super._process(delta);
|
|
7365
|
-
const parent = this.getParent();
|
|
7366
|
-
if (this._parentGlobalVisible !== parent?.globalVisible) {
|
|
7367
|
-
this._updateGlobalVisible();
|
|
7368
|
-
}
|
|
7369
|
-
if (this._parentGlobalOpacity !== parent?.globalOpacity) {
|
|
7370
|
-
this._updateGlobalOpacity();
|
|
7371
|
-
}
|
|
7518
|
+
this.setProperties(properties).append(children);
|
|
7372
7519
|
}
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7520
|
+
apply(renderer, source) {
|
|
7521
|
+
if (!this.filter)
|
|
7522
|
+
return;
|
|
7523
|
+
const funs = parseCssFunctions(this.filter);
|
|
7524
|
+
const matrix = this._colorMatrix.identity();
|
|
7525
|
+
funs.forEach(({ name, args }) => {
|
|
7526
|
+
const values = args.map((arg) => arg.normalizedIntValue);
|
|
7527
|
+
switch (name) {
|
|
7528
|
+
case "hue-rotate":
|
|
7529
|
+
case "hueRotate":
|
|
7530
|
+
matrix.hueRotate(values[0] * PI_2);
|
|
7531
|
+
break;
|
|
7532
|
+
case "saturate":
|
|
7533
|
+
matrix.saturate(values[0]);
|
|
7534
|
+
break;
|
|
7535
|
+
case "brightness":
|
|
7536
|
+
matrix.brightness(values[0]);
|
|
7537
|
+
break;
|
|
7538
|
+
case "contrast":
|
|
7539
|
+
matrix.contrast(values[0]);
|
|
7540
|
+
break;
|
|
7541
|
+
case "invert":
|
|
7542
|
+
matrix.invert(values[0]);
|
|
7543
|
+
break;
|
|
7544
|
+
case "sepia":
|
|
7545
|
+
matrix.sepia(values[0]);
|
|
7546
|
+
break;
|
|
7547
|
+
case "opacity":
|
|
7548
|
+
matrix.opacity(values[0]);
|
|
7549
|
+
break;
|
|
7550
|
+
case "grayscale":
|
|
7551
|
+
matrix.grayscale(values[0]);
|
|
7552
|
+
break;
|
|
7392
7553
|
}
|
|
7393
|
-
}
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
this._repainting = false;
|
|
7399
|
-
}
|
|
7400
|
-
}
|
|
7401
|
-
_render(renderer) {
|
|
7402
|
-
this._updateBatchables();
|
|
7403
|
-
this._batchables.forEach((batchable) => {
|
|
7404
|
-
batchable.texture?.upload(renderer);
|
|
7405
|
-
renderer.batch2D.render({
|
|
7406
|
-
...batchable,
|
|
7407
|
-
texture: batchable.texture?._glTexture(renderer)
|
|
7554
|
+
});
|
|
7555
|
+
source.redraw(renderer, () => {
|
|
7556
|
+
QuadUvGeometry.draw(renderer, ColorFilterEffect.material, {
|
|
7557
|
+
sampler: 0,
|
|
7558
|
+
m: matrix.toArray()
|
|
7408
7559
|
});
|
|
7409
7560
|
});
|
|
7410
|
-
super._render(renderer);
|
|
7411
7561
|
}
|
|
7412
7562
|
};
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
calls = [];
|
|
7432
|
-
createCall(renderable) {
|
|
7433
|
-
return {
|
|
7434
|
-
renderable,
|
|
7435
|
-
parentCall: this.currentCall,
|
|
7436
|
-
fn: renderable.render.bind(renderable),
|
|
7437
|
-
calls: []
|
|
7438
|
-
};
|
|
7439
|
-
}
|
|
7440
|
-
push(renderable) {
|
|
7441
|
-
const call = this.createCall(renderable);
|
|
7442
|
-
(this.currentCall?.calls ?? this.calls).push(call);
|
|
7443
|
-
return call;
|
|
7444
|
-
}
|
|
7445
|
-
render(renderer) {
|
|
7446
|
-
this.calls.forEach(function render(call) {
|
|
7447
|
-
call.fn(renderer, () => {
|
|
7448
|
-
call.calls.forEach(render);
|
|
7449
|
-
});
|
|
7450
|
-
});
|
|
7451
|
-
this.calls = [];
|
|
7563
|
+
__publicField$h(ColorFilterEffect, "material", new Material({
|
|
7564
|
+
vert: `precision mediump float;
|
|
7565
|
+
attribute vec2 position;
|
|
7566
|
+
attribute vec2 uv;
|
|
7567
|
+
varying vec2 vUv;
|
|
7568
|
+
void main() {
|
|
7569
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7570
|
+
vUv = uv;
|
|
7571
|
+
}`,
|
|
7572
|
+
frag: `precision highp float;
|
|
7573
|
+
varying vec2 vUv;
|
|
7574
|
+
uniform sampler2D sampler;
|
|
7575
|
+
uniform float m[20];
|
|
7576
|
+
|
|
7577
|
+
void main(void) {
|
|
7578
|
+
vec4 c = texture2D(sampler, vUv);
|
|
7579
|
+
if (c.a > 0.0) {
|
|
7580
|
+
c.rgb /= c.a;
|
|
7452
7581
|
}
|
|
7453
|
-
|
|
7582
|
+
gl_FragColor = vec4(
|
|
7583
|
+
m[0] * c.r + m[1] * c.g + m[2] * c.b + m[3] * c.a + m[4] / 255.0,
|
|
7584
|
+
m[5] * c.r + m[6] * c.g + m[7] * c.b + m[8] * c.a + m[9] / 255.0,
|
|
7585
|
+
m[10] * c.r + m[11] * c.g + m[12] * c.b + m[13] * c.a + m[14] / 255.0,
|
|
7586
|
+
m[15] * c.r + m[16] * c.g + m[17] * c.b + m[18] * c.a + m[19] / 255.0
|
|
7587
|
+
);
|
|
7588
|
+
}`
|
|
7589
|
+
}));
|
|
7590
|
+
__decorateClass$G([
|
|
7591
|
+
property()
|
|
7592
|
+
], ColorFilterEffect.prototype, "filter", 2);
|
|
7593
|
+
ColorFilterEffect = __decorateClass$G([
|
|
7594
|
+
customNode("ColorFilterEffect")
|
|
7595
|
+
], ColorFilterEffect);
|
|
7454
7596
|
|
|
7455
|
-
var __defProp$
|
|
7456
|
-
var __getOwnPropDesc$
|
|
7457
|
-
var
|
|
7458
|
-
|
|
7597
|
+
var __defProp$y = Object.defineProperty;
|
|
7598
|
+
var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
|
|
7599
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7600
|
+
var __decorateClass$F = (decorators, target, key, kind) => {
|
|
7601
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
|
|
7459
7602
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7460
7603
|
if (decorator = decorators[i])
|
|
7461
7604
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7462
|
-
if (kind && result) __defProp$
|
|
7605
|
+
if (kind && result) __defProp$y(target, key, result);
|
|
7463
7606
|
return result;
|
|
7464
7607
|
};
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
endTime,
|
|
7471
|
-
loop
|
|
7472
|
-
});
|
|
7473
|
-
}
|
|
7474
|
-
constructor(properties) {
|
|
7608
|
+
var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
|
|
7609
|
+
const MAX_COLORS$1 = 50;
|
|
7610
|
+
let ColorOverlayEffect = class extends Effect {
|
|
7611
|
+
_color = new Color();
|
|
7612
|
+
constructor(properties, children = []) {
|
|
7475
7613
|
super();
|
|
7476
|
-
this.setProperties(properties);
|
|
7614
|
+
this.setProperties(properties).append(children);
|
|
7477
7615
|
}
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7616
|
+
apply(renderer, source) {
|
|
7617
|
+
source.redraw(renderer, () => {
|
|
7618
|
+
const colors = this.colors.map((val) => {
|
|
7619
|
+
this._color.value = val;
|
|
7620
|
+
const rgba = this._color.toArray();
|
|
7621
|
+
rgba[3] = this.alpha;
|
|
7622
|
+
return rgba;
|
|
7623
|
+
});
|
|
7624
|
+
while (colors.length < MAX_COLORS$1) {
|
|
7625
|
+
colors.push([0, 0, 0, 0]);
|
|
7626
|
+
}
|
|
7627
|
+
QuadUvGeometry.draw(renderer, ColorOverlayEffect.material, {
|
|
7628
|
+
sampler: 0,
|
|
7629
|
+
colors: colors.slice(0, MAX_COLORS$1).flatMap((item) => item)
|
|
7630
|
+
});
|
|
7631
|
+
});
|
|
7488
7632
|
}
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7633
|
+
};
|
|
7634
|
+
__publicField$g(ColorOverlayEffect, "material", new Material({
|
|
7635
|
+
vert: `precision mediump float;
|
|
7636
|
+
attribute vec2 position;
|
|
7637
|
+
attribute vec2 uv;
|
|
7638
|
+
varying vec2 vUv;
|
|
7639
|
+
void main() {
|
|
7640
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7641
|
+
vUv = uv;
|
|
7642
|
+
}`,
|
|
7643
|
+
frag: `precision mediump float;
|
|
7644
|
+
uniform sampler2D sampler;
|
|
7645
|
+
uniform vec4 colors[${MAX_COLORS$1}];
|
|
7646
|
+
varying vec2 vUv;
|
|
7647
|
+
|
|
7648
|
+
float calcWidth() {
|
|
7649
|
+
return distance(vec2(0, 0), vec2(1, 0));
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7652
|
+
int calcCount() {
|
|
7653
|
+
int count = 0;
|
|
7654
|
+
for (int i = 0; i < ${MAX_COLORS$1}; i++) {
|
|
7655
|
+
if (colors[i] != vec4(0,0,0,0)){
|
|
7656
|
+
count++;
|
|
7657
|
+
}
|
|
7658
|
+
}
|
|
7659
|
+
return count;
|
|
7660
|
+
}
|
|
7661
|
+
|
|
7662
|
+
vec4 calcColor(float x) {
|
|
7663
|
+
float perUnit = calcWidth() / float(calcCount());
|
|
7664
|
+
int index = int(x / perUnit);
|
|
7665
|
+
|
|
7666
|
+
for(int i=0; i<${MAX_COLORS$1}; i++){
|
|
7667
|
+
if(i==index){
|
|
7668
|
+
return colors[i];
|
|
7496
7669
|
}
|
|
7497
|
-
current = clamp(start, current, end);
|
|
7498
|
-
this.currentTime = current;
|
|
7499
|
-
this.emit("updateCurrentTime", current, delta);
|
|
7500
|
-
return this;
|
|
7501
|
-
}
|
|
7502
|
-
_process(delta) {
|
|
7503
|
-
super._process(delta);
|
|
7504
|
-
this.addTime(delta);
|
|
7505
7670
|
}
|
|
7506
|
-
};
|
|
7507
|
-
__decorateClass$H([
|
|
7508
|
-
property({ fallback: 0 })
|
|
7509
|
-
], Timeline.prototype, "startTime", 2);
|
|
7510
|
-
__decorateClass$H([
|
|
7511
|
-
property({ fallback: 0 })
|
|
7512
|
-
], Timeline.prototype, "currentTime", 2);
|
|
7513
|
-
__decorateClass$H([
|
|
7514
|
-
property({ fallback: Number.MAX_SAFE_INTEGER })
|
|
7515
|
-
], Timeline.prototype, "endTime", 2);
|
|
7516
|
-
__decorateClass$H([
|
|
7517
|
-
property({ fallback: false })
|
|
7518
|
-
], Timeline.prototype, "loop", 2);
|
|
7519
|
-
Timeline = __decorateClass$H([
|
|
7520
|
-
customNode("Timeline")
|
|
7521
|
-
], Timeline);
|
|
7522
7671
|
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7672
|
+
return vec4(0, 0, 0, 0);
|
|
7673
|
+
}
|
|
7674
|
+
|
|
7675
|
+
void main(void) {
|
|
7676
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7677
|
+
vec4 mask = calcColor(vUv.x);
|
|
7678
|
+
gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
|
|
7679
|
+
}`
|
|
7680
|
+
}));
|
|
7681
|
+
__decorateClass$F([
|
|
7682
|
+
property()
|
|
7683
|
+
], ColorOverlayEffect.prototype, "colors", 2);
|
|
7684
|
+
__decorateClass$F([
|
|
7685
|
+
property()
|
|
7686
|
+
], ColorOverlayEffect.prototype, "alpha", 2);
|
|
7687
|
+
ColorOverlayEffect = __decorateClass$F([
|
|
7688
|
+
customNode("ColorOverlayEffect")
|
|
7689
|
+
], ColorOverlayEffect);
|
|
7690
|
+
|
|
7691
|
+
var __defProp$x = Object.defineProperty;
|
|
7692
|
+
var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
|
|
7693
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7694
|
+
var __decorateClass$E = (decorators, target, key, kind) => {
|
|
7695
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
|
|
7526
7696
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7527
7697
|
if (decorator = decorators[i])
|
|
7528
|
-
result = (decorator(target, key, result) ) || result;
|
|
7529
|
-
if (result) __defProp$
|
|
7698
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7699
|
+
if (kind && result) __defProp$x(target, key, result);
|
|
7530
7700
|
return result;
|
|
7531
7701
|
};
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
timeline;
|
|
7537
|
-
nodes = /* @__PURE__ */ new Map();
|
|
7538
|
-
_backgroundColor = new Color();
|
|
7539
|
-
_currentViewport;
|
|
7540
|
-
getCurrentViewport() {
|
|
7541
|
-
return this._currentViewport;
|
|
7542
|
-
}
|
|
7543
|
-
setCurrentViewport(viewport) {
|
|
7544
|
-
this._currentViewport = viewport;
|
|
7545
|
-
}
|
|
7546
|
-
constructor(timeline = new Timeline()) {
|
|
7702
|
+
var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
|
|
7703
|
+
let ColorRemoveEffect = class extends Effect {
|
|
7704
|
+
_color = new Color();
|
|
7705
|
+
constructor(properties, children = []) {
|
|
7547
7706
|
super();
|
|
7548
|
-
this.
|
|
7549
|
-
}
|
|
7550
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
7551
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
7552
|
-
switch (key) {
|
|
7553
|
-
case "backgroundColor":
|
|
7554
|
-
this._backgroundColor.value = value;
|
|
7555
|
-
break;
|
|
7556
|
-
}
|
|
7707
|
+
this.setProperties(properties).append(children);
|
|
7557
7708
|
}
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7709
|
+
apply(renderer, source) {
|
|
7710
|
+
const maxColors = 50;
|
|
7711
|
+
const originalColors = new Float32Array(maxColors * 3);
|
|
7712
|
+
const colors = this.colors.map((val) => {
|
|
7713
|
+
this._color.value = val;
|
|
7714
|
+
return this._color.toArray().slice(0, 3);
|
|
7715
|
+
});
|
|
7716
|
+
while (colors.length < maxColors) {
|
|
7717
|
+
colors.push([-1, 0, 0]);
|
|
7561
7718
|
}
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
this.root.emit("process", delta);
|
|
7567
|
-
this.emit("processed");
|
|
7568
|
-
}
|
|
7569
|
-
_render(renderer) {
|
|
7570
|
-
this.emit("rendering");
|
|
7571
|
-
renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
|
|
7572
|
-
this.renderStack.render(renderer);
|
|
7573
|
-
this._renderScreen(renderer);
|
|
7574
|
-
this.emit("rendered");
|
|
7575
|
-
}
|
|
7576
|
-
_renderScreen(renderer) {
|
|
7577
|
-
renderer.state.reset();
|
|
7578
|
-
renderer.framebuffer.bind(null);
|
|
7579
|
-
renderer.viewport.bind({
|
|
7580
|
-
x: 0,
|
|
7581
|
-
y: 0,
|
|
7582
|
-
width: this.root.width * renderer.pixelRatio,
|
|
7583
|
-
height: this.root.height * renderer.pixelRatio
|
|
7719
|
+
colors.slice(0, maxColors).forEach((originalColor, i) => {
|
|
7720
|
+
originalColors[i * 3] = originalColor[0];
|
|
7721
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7722
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7584
7723
|
});
|
|
7585
|
-
|
|
7586
|
-
|
|
7724
|
+
source.redraw(renderer, () => {
|
|
7725
|
+
QuadUvGeometry.draw(renderer, ColorRemoveEffect.material, {
|
|
7726
|
+
sampler: 0,
|
|
7727
|
+
epsilon: this.epsilon,
|
|
7728
|
+
originalColors
|
|
7729
|
+
});
|
|
7730
|
+
});
|
|
7731
|
+
}
|
|
7732
|
+
};
|
|
7733
|
+
__publicField$f(ColorRemoveEffect, "material", new Material({
|
|
7734
|
+
vert: `precision mediump float;
|
|
7735
|
+
attribute vec2 position;
|
|
7736
|
+
attribute vec2 uv;
|
|
7737
|
+
varying vec2 vUv;
|
|
7738
|
+
void main() {
|
|
7739
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7740
|
+
vUv = uv;
|
|
7741
|
+
}`,
|
|
7742
|
+
frag: `varying vec2 vUv;
|
|
7743
|
+
uniform sampler2D sampler;
|
|
7744
|
+
uniform float epsilon;
|
|
7745
|
+
const int MAX_COLORS = 50;
|
|
7746
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7747
|
+
|
|
7748
|
+
void main(void) {
|
|
7749
|
+
vec4 color = texture2D(sampler, vUv);
|
|
7750
|
+
|
|
7751
|
+
for (int i = 0; i < MAX_COLORS; i++) {
|
|
7752
|
+
vec3 origColor = originalColors[i];
|
|
7753
|
+
if (origColor.r < 0.0) {
|
|
7754
|
+
break;
|
|
7587
7755
|
}
|
|
7588
|
-
|
|
7589
|
-
if (
|
|
7590
|
-
|
|
7756
|
+
vec3 colorDiff = origColor - color.rgb;
|
|
7757
|
+
if (length(colorDiff) < epsilon) {
|
|
7758
|
+
gl_FragColor = vec4(0, 0, 0, 0);
|
|
7759
|
+
return;
|
|
7591
7760
|
}
|
|
7592
|
-
const texture = this.root.texture;
|
|
7593
|
-
texture.activate(renderer, 0);
|
|
7594
|
-
QuadUvGeometry.draw(renderer);
|
|
7595
|
-
renderer.texture.unbind(texture);
|
|
7596
|
-
}
|
|
7597
|
-
free() {
|
|
7598
|
-
super.free();
|
|
7599
|
-
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7600
|
-
this.input.removeEventListeners();
|
|
7601
7761
|
}
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
__decorateClass$
|
|
7762
|
+
|
|
7763
|
+
gl_FragColor = color;
|
|
7764
|
+
}`
|
|
7765
|
+
}));
|
|
7766
|
+
__decorateClass$E([
|
|
7607
7767
|
property()
|
|
7608
|
-
],
|
|
7609
|
-
__decorateClass$
|
|
7610
|
-
property(
|
|
7611
|
-
],
|
|
7768
|
+
], ColorRemoveEffect.prototype, "colors", 2);
|
|
7769
|
+
__decorateClass$E([
|
|
7770
|
+
property()
|
|
7771
|
+
], ColorRemoveEffect.prototype, "epsilon", 2);
|
|
7772
|
+
ColorRemoveEffect = __decorateClass$E([
|
|
7773
|
+
customNode("ColorRemoveEffect")
|
|
7774
|
+
], ColorRemoveEffect);
|
|
7612
7775
|
|
|
7613
|
-
var
|
|
7614
|
-
var
|
|
7615
|
-
|
|
7776
|
+
var __defProp$w = Object.defineProperty;
|
|
7777
|
+
var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
|
|
7778
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7779
|
+
var __decorateClass$D = (decorators, target, key, kind) => {
|
|
7780
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
|
|
7616
7781
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7617
7782
|
if (decorator = decorators[i])
|
|
7618
|
-
result = (decorator(result)) || result;
|
|
7783
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7784
|
+
if (kind && result) __defProp$w(target, key, result);
|
|
7619
7785
|
return result;
|
|
7620
7786
|
};
|
|
7621
|
-
|
|
7787
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
|
|
7788
|
+
const MAX_COLORS = 50;
|
|
7789
|
+
let ColorReplaceEffect = class extends Effect {
|
|
7790
|
+
_color = new Color();
|
|
7622
7791
|
constructor(properties, children = []) {
|
|
7623
7792
|
super();
|
|
7624
7793
|
this.setProperties(properties).append(children);
|
|
7625
7794
|
}
|
|
7795
|
+
apply(renderer, source) {
|
|
7796
|
+
const colors = this.colors.map((val) => {
|
|
7797
|
+
this._color.value = val[0];
|
|
7798
|
+
const color0 = this._color.toArray().slice(0, 3);
|
|
7799
|
+
this._color.value = val[1];
|
|
7800
|
+
const color1 = this._color.toArray().slice(0, 3);
|
|
7801
|
+
return [
|
|
7802
|
+
color0,
|
|
7803
|
+
color1
|
|
7804
|
+
];
|
|
7805
|
+
});
|
|
7806
|
+
const epsilon = this.epsilon;
|
|
7807
|
+
const originalColors = new Float32Array(MAX_COLORS * 3);
|
|
7808
|
+
const targetColors = new Float32Array(MAX_COLORS * 3);
|
|
7809
|
+
while (colors.length < MAX_COLORS) {
|
|
7810
|
+
colors.push([
|
|
7811
|
+
[-1, 0, 0],
|
|
7812
|
+
[0, 0, 0, 1]
|
|
7813
|
+
]);
|
|
7814
|
+
}
|
|
7815
|
+
colors.slice(0, MAX_COLORS).forEach(([originalColor, targetColor], i) => {
|
|
7816
|
+
originalColors[i * 3] = originalColor[0];
|
|
7817
|
+
originalColors[i * 3 + 1] = originalColor[1];
|
|
7818
|
+
originalColors[i * 3 + 2] = originalColor[2];
|
|
7819
|
+
targetColors[i * 3] = targetColor[0];
|
|
7820
|
+
targetColors[i * 3 + 1] = targetColor[1];
|
|
7821
|
+
targetColors[i * 3 + 2] = targetColor[2];
|
|
7822
|
+
});
|
|
7823
|
+
source.redraw(renderer, () => {
|
|
7824
|
+
QuadUvGeometry.draw(renderer, ColorReplaceEffect.material, {
|
|
7825
|
+
sampler: 0,
|
|
7826
|
+
epsilon,
|
|
7827
|
+
originalColors,
|
|
7828
|
+
targetColors
|
|
7829
|
+
});
|
|
7830
|
+
});
|
|
7831
|
+
}
|
|
7626
7832
|
};
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7833
|
+
__publicField$e(ColorReplaceEffect, "material", new Material({
|
|
7834
|
+
vert: `precision mediump float;
|
|
7835
|
+
attribute vec2 position;
|
|
7836
|
+
attribute vec2 uv;
|
|
7837
|
+
varying vec2 vUv;
|
|
7838
|
+
void main() {
|
|
7839
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
7840
|
+
vUv = uv;
|
|
7841
|
+
}`,
|
|
7842
|
+
frag: `varying vec2 vUv;
|
|
7843
|
+
uniform sampler2D sampler;
|
|
7844
|
+
uniform float epsilon;
|
|
7845
|
+
const int MAX_COLORS = ${MAX_COLORS};
|
|
7846
|
+
uniform vec3 originalColors[MAX_COLORS];
|
|
7847
|
+
uniform vec3 targetColors[MAX_COLORS];
|
|
7634
7848
|
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7849
|
+
void main(void) {
|
|
7850
|
+
gl_FragColor = texture2D(sampler, vUv);
|
|
7851
|
+
|
|
7852
|
+
float alpha = gl_FragColor.a;
|
|
7853
|
+
if (alpha < 0.0001) {
|
|
7854
|
+
return;
|
|
7855
|
+
}
|
|
7856
|
+
|
|
7857
|
+
vec3 color = gl_FragColor.rgb / alpha;
|
|
7858
|
+
|
|
7859
|
+
for(int i = 0; i < MAX_COLORS; i++) {
|
|
7860
|
+
vec3 origColor = originalColors[i];
|
|
7861
|
+
if (origColor.r < 0.0) {
|
|
7862
|
+
break;
|
|
7863
|
+
}
|
|
7864
|
+
vec3 colorDiff = origColor - color;
|
|
7865
|
+
if (length(colorDiff) < epsilon) {
|
|
7866
|
+
vec3 targetColor = targetColors[i];
|
|
7867
|
+
gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha);
|
|
7868
|
+
return;
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
}`
|
|
7872
|
+
}));
|
|
7873
|
+
__decorateClass$D([
|
|
7874
|
+
property()
|
|
7875
|
+
], ColorReplaceEffect.prototype, "colors", 2);
|
|
7876
|
+
__decorateClass$D([
|
|
7877
|
+
property()
|
|
7878
|
+
], ColorReplaceEffect.prototype, "epsilon", 2);
|
|
7879
|
+
ColorReplaceEffect = __decorateClass$D([
|
|
7880
|
+
customNode("ColorReplaceEffect")
|
|
7881
|
+
], ColorReplaceEffect);
|
|
7882
|
+
|
|
7883
|
+
var __defProp$v = Object.defineProperty;
|
|
7884
|
+
var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
|
|
7885
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7886
|
+
var __decorateClass$C = (decorators, target, key, kind) => {
|
|
7887
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
|
|
7640
7888
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7641
7889
|
if (decorator = decorators[i])
|
|
7642
7890
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7643
|
-
if (kind && result) __defProp$
|
|
7891
|
+
if (kind && result) __defProp$v(target, key, result);
|
|
7644
7892
|
return result;
|
|
7645
7893
|
};
|
|
7646
7894
|
var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -7746,25 +7994,25 @@ void main(void) {
|
|
|
7746
7994
|
}`,
|
|
7747
7995
|
frag: frag$2
|
|
7748
7996
|
}));
|
|
7749
|
-
__decorateClass$
|
|
7997
|
+
__decorateClass$C([
|
|
7750
7998
|
property({ default: 4 })
|
|
7751
7999
|
], GaussianBlurEffect.prototype, "strength", 2);
|
|
7752
|
-
__decorateClass$
|
|
8000
|
+
__decorateClass$C([
|
|
7753
8001
|
property({ default: 3 })
|
|
7754
8002
|
], GaussianBlurEffect.prototype, "quality", 2);
|
|
7755
|
-
GaussianBlurEffect = __decorateClass$
|
|
8003
|
+
GaussianBlurEffect = __decorateClass$C([
|
|
7756
8004
|
customNode("GaussianBlurEffect")
|
|
7757
8005
|
], GaussianBlurEffect);
|
|
7758
8006
|
|
|
7759
|
-
var __defProp$
|
|
7760
|
-
var __getOwnPropDesc$
|
|
7761
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$
|
|
7762
|
-
var __decorateClass$
|
|
7763
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8007
|
+
var __defProp$u = Object.defineProperty;
|
|
8008
|
+
var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
|
|
8009
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8010
|
+
var __decorateClass$B = (decorators, target, key, kind) => {
|
|
8011
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
|
|
7764
8012
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7765
8013
|
if (decorator = decorators[i])
|
|
7766
8014
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7767
|
-
if (kind && result) __defProp$
|
|
8015
|
+
if (kind && result) __defProp$u(target, key, result);
|
|
7768
8016
|
return result;
|
|
7769
8017
|
};
|
|
7770
8018
|
var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
|
|
@@ -7828,34 +8076,34 @@ void main(void) {
|
|
|
7828
8076
|
gl_FragColor = sample;
|
|
7829
8077
|
}`
|
|
7830
8078
|
}));
|
|
7831
|
-
__decorateClass$
|
|
8079
|
+
__decorateClass$B([
|
|
7832
8080
|
property()
|
|
7833
8081
|
], DropShadowEffect.prototype, "color", 2);
|
|
7834
|
-
__decorateClass$
|
|
8082
|
+
__decorateClass$B([
|
|
7835
8083
|
property()
|
|
7836
8084
|
], DropShadowEffect.prototype, "blur", 2);
|
|
7837
|
-
__decorateClass$
|
|
8085
|
+
__decorateClass$B([
|
|
7838
8086
|
property()
|
|
7839
8087
|
], DropShadowEffect.prototype, "offsetX", 2);
|
|
7840
|
-
__decorateClass$
|
|
8088
|
+
__decorateClass$B([
|
|
7841
8089
|
property()
|
|
7842
8090
|
], DropShadowEffect.prototype, "offsetY", 2);
|
|
7843
|
-
__decorateClass$
|
|
8091
|
+
__decorateClass$B([
|
|
7844
8092
|
property()
|
|
7845
8093
|
], DropShadowEffect.prototype, "shadowOnly", 2);
|
|
7846
|
-
DropShadowEffect = __decorateClass$
|
|
8094
|
+
DropShadowEffect = __decorateClass$B([
|
|
7847
8095
|
customNode("DropShadowEffect")
|
|
7848
8096
|
], DropShadowEffect);
|
|
7849
8097
|
|
|
7850
|
-
var __defProp$
|
|
7851
|
-
var __getOwnPropDesc$
|
|
7852
|
-
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$
|
|
7853
|
-
var __decorateClass$
|
|
7854
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8098
|
+
var __defProp$t = Object.defineProperty;
|
|
8099
|
+
var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
|
|
8100
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8101
|
+
var __decorateClass$A = (decorators, target, key, kind) => {
|
|
8102
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
|
|
7855
8103
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7856
8104
|
if (decorator = decorators[i])
|
|
7857
8105
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7858
|
-
if (kind && result) __defProp$
|
|
8106
|
+
if (kind && result) __defProp$t(target, key, result);
|
|
7859
8107
|
return result;
|
|
7860
8108
|
};
|
|
7861
8109
|
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
|
|
@@ -7900,22 +8148,22 @@ void main(void) {
|
|
|
7900
8148
|
gl_FragColor = vec4(color.rgb * alpha, alpha);
|
|
7901
8149
|
}`
|
|
7902
8150
|
}));
|
|
7903
|
-
__decorateClass$
|
|
8151
|
+
__decorateClass$A([
|
|
7904
8152
|
property()
|
|
7905
8153
|
], EmbossEffect.prototype, "strength", 2);
|
|
7906
|
-
EmbossEffect = __decorateClass$
|
|
8154
|
+
EmbossEffect = __decorateClass$A([
|
|
7907
8155
|
customNode("EmbossEffect")
|
|
7908
8156
|
], EmbossEffect);
|
|
7909
8157
|
|
|
7910
|
-
var __defProp$
|
|
7911
|
-
var __getOwnPropDesc$
|
|
7912
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$
|
|
7913
|
-
var __decorateClass$
|
|
7914
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8158
|
+
var __defProp$s = Object.defineProperty;
|
|
8159
|
+
var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
|
|
8160
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8161
|
+
var __decorateClass$z = (decorators, target, key, kind) => {
|
|
8162
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
|
|
7915
8163
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7916
8164
|
if (decorator = decorators[i])
|
|
7917
8165
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7918
|
-
if (kind && result) __defProp$
|
|
8166
|
+
if (kind && result) __defProp$s(target, key, result);
|
|
7919
8167
|
return result;
|
|
7920
8168
|
};
|
|
7921
8169
|
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
|
|
@@ -8089,46 +8337,46 @@ void main(void) {
|
|
|
8089
8337
|
gl_FragColor.a = texture2D(sampler, coord).a;
|
|
8090
8338
|
}`
|
|
8091
8339
|
}));
|
|
8092
|
-
__decorateClass$
|
|
8340
|
+
__decorateClass$z([
|
|
8093
8341
|
property()
|
|
8094
8342
|
], GlitchEffect.prototype, "slices", 2);
|
|
8095
|
-
__decorateClass$
|
|
8343
|
+
__decorateClass$z([
|
|
8096
8344
|
property()
|
|
8097
8345
|
], GlitchEffect.prototype, "sampleSize", 2);
|
|
8098
|
-
__decorateClass$
|
|
8346
|
+
__decorateClass$z([
|
|
8099
8347
|
property()
|
|
8100
8348
|
], GlitchEffect.prototype, "offset", 2);
|
|
8101
|
-
__decorateClass$
|
|
8349
|
+
__decorateClass$z([
|
|
8102
8350
|
property()
|
|
8103
8351
|
], GlitchEffect.prototype, "direction", 2);
|
|
8104
|
-
__decorateClass$
|
|
8352
|
+
__decorateClass$z([
|
|
8105
8353
|
property()
|
|
8106
8354
|
], GlitchEffect.prototype, "fillMode", 2);
|
|
8107
|
-
__decorateClass$
|
|
8355
|
+
__decorateClass$z([
|
|
8108
8356
|
property()
|
|
8109
8357
|
], GlitchEffect.prototype, "seed", 2);
|
|
8110
|
-
__decorateClass$
|
|
8358
|
+
__decorateClass$z([
|
|
8111
8359
|
property()
|
|
8112
8360
|
], GlitchEffect.prototype, "red", 2);
|
|
8113
|
-
__decorateClass$
|
|
8361
|
+
__decorateClass$z([
|
|
8114
8362
|
property()
|
|
8115
8363
|
], GlitchEffect.prototype, "green", 2);
|
|
8116
|
-
__decorateClass$
|
|
8364
|
+
__decorateClass$z([
|
|
8117
8365
|
property()
|
|
8118
8366
|
], GlitchEffect.prototype, "blue", 2);
|
|
8119
|
-
GlitchEffect = __decorateClass$
|
|
8367
|
+
GlitchEffect = __decorateClass$z([
|
|
8120
8368
|
customNode("GlitchEffect")
|
|
8121
8369
|
], GlitchEffect);
|
|
8122
8370
|
|
|
8123
|
-
var __defProp$
|
|
8124
|
-
var __getOwnPropDesc$
|
|
8125
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$
|
|
8126
|
-
var __decorateClass$
|
|
8127
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8371
|
+
var __defProp$r = Object.defineProperty;
|
|
8372
|
+
var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
|
|
8373
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8374
|
+
var __decorateClass$y = (decorators, target, key, kind) => {
|
|
8375
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
|
|
8128
8376
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8129
8377
|
if (decorator = decorators[i])
|
|
8130
8378
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8131
|
-
if (kind && result) __defProp$
|
|
8379
|
+
if (kind && result) __defProp$r(target, key, result);
|
|
8132
8380
|
return result;
|
|
8133
8381
|
};
|
|
8134
8382
|
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
|
|
@@ -8306,39 +8554,39 @@ void main(void) {
|
|
|
8306
8554
|
gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
|
|
8307
8555
|
}`
|
|
8308
8556
|
}));
|
|
8309
|
-
__decorateClass$
|
|
8557
|
+
__decorateClass$y([
|
|
8310
8558
|
property()
|
|
8311
8559
|
], GodrayEffect.prototype, "time", 2);
|
|
8312
|
-
__decorateClass$
|
|
8560
|
+
__decorateClass$y([
|
|
8313
8561
|
property()
|
|
8314
8562
|
], GodrayEffect.prototype, "angle", 2);
|
|
8315
|
-
__decorateClass$
|
|
8563
|
+
__decorateClass$y([
|
|
8316
8564
|
property()
|
|
8317
8565
|
], GodrayEffect.prototype, "gain", 2);
|
|
8318
|
-
__decorateClass$
|
|
8566
|
+
__decorateClass$y([
|
|
8319
8567
|
property()
|
|
8320
8568
|
], GodrayEffect.prototype, "lacunarity", 2);
|
|
8321
|
-
__decorateClass$
|
|
8569
|
+
__decorateClass$y([
|
|
8322
8570
|
property()
|
|
8323
8571
|
], GodrayEffect.prototype, "parallel", 2);
|
|
8324
|
-
__decorateClass$
|
|
8572
|
+
__decorateClass$y([
|
|
8325
8573
|
property()
|
|
8326
8574
|
], GodrayEffect.prototype, "center", 2);
|
|
8327
|
-
__decorateClass$
|
|
8575
|
+
__decorateClass$y([
|
|
8328
8576
|
property()
|
|
8329
8577
|
], GodrayEffect.prototype, "alpha", 2);
|
|
8330
|
-
GodrayEffect = __decorateClass$
|
|
8578
|
+
GodrayEffect = __decorateClass$y([
|
|
8331
8579
|
customNode("GodrayEffect")
|
|
8332
8580
|
], GodrayEffect);
|
|
8333
8581
|
|
|
8334
|
-
var __defProp$
|
|
8335
|
-
var __getOwnPropDesc$
|
|
8336
|
-
var __decorateClass$
|
|
8337
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8582
|
+
var __defProp$q = Object.defineProperty;
|
|
8583
|
+
var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
|
|
8584
|
+
var __decorateClass$x = (decorators, target, key, kind) => {
|
|
8585
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
|
|
8338
8586
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8339
8587
|
if (decorator = decorators[i])
|
|
8340
8588
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8341
|
-
if (kind && result) __defProp$
|
|
8589
|
+
if (kind && result) __defProp$q(target, key, result);
|
|
8342
8590
|
return result;
|
|
8343
8591
|
};
|
|
8344
8592
|
const frag$1 = `varying vec2 vUv;
|
|
@@ -8428,28 +8676,28 @@ void main() {
|
|
|
8428
8676
|
});
|
|
8429
8677
|
}
|
|
8430
8678
|
};
|
|
8431
|
-
__decorateClass$
|
|
8679
|
+
__decorateClass$x([
|
|
8432
8680
|
property()
|
|
8433
8681
|
], KawaseBlurEffect.prototype, "strength", 2);
|
|
8434
|
-
__decorateClass$
|
|
8682
|
+
__decorateClass$x([
|
|
8435
8683
|
property()
|
|
8436
8684
|
], KawaseBlurEffect.prototype, "quality", 2);
|
|
8437
|
-
__decorateClass$
|
|
8685
|
+
__decorateClass$x([
|
|
8438
8686
|
property()
|
|
8439
8687
|
], KawaseBlurEffect.prototype, "pixelSize", 2);
|
|
8440
|
-
KawaseBlurEffect = __decorateClass$
|
|
8688
|
+
KawaseBlurEffect = __decorateClass$x([
|
|
8441
8689
|
customNode("KawaseBlurEffect")
|
|
8442
8690
|
], KawaseBlurEffect);
|
|
8443
8691
|
|
|
8444
|
-
var __defProp$
|
|
8445
|
-
var __getOwnPropDesc$
|
|
8446
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$
|
|
8447
|
-
var __decorateClass$
|
|
8448
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8692
|
+
var __defProp$p = Object.defineProperty;
|
|
8693
|
+
var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
|
|
8694
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8695
|
+
var __decorateClass$w = (decorators, target, key, kind) => {
|
|
8696
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
|
|
8449
8697
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8450
8698
|
if (decorator = decorators[i])
|
|
8451
8699
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8452
|
-
if (kind && result) __defProp$
|
|
8700
|
+
if (kind && result) __defProp$p(target, key, result);
|
|
8453
8701
|
return result;
|
|
8454
8702
|
};
|
|
8455
8703
|
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
|
|
@@ -8537,25 +8785,25 @@ void main(void) {
|
|
|
8537
8785
|
}
|
|
8538
8786
|
}`
|
|
8539
8787
|
}));
|
|
8540
|
-
__decorateClass$
|
|
8788
|
+
__decorateClass$w([
|
|
8541
8789
|
property({ protected: true })
|
|
8542
8790
|
], MaskEffect.prototype, "texture", 2);
|
|
8543
|
-
__decorateClass$
|
|
8791
|
+
__decorateClass$w([
|
|
8544
8792
|
property({ default: "" })
|
|
8545
8793
|
], MaskEffect.prototype, "src", 2);
|
|
8546
|
-
MaskEffect = __decorateClass$
|
|
8794
|
+
MaskEffect = __decorateClass$w([
|
|
8547
8795
|
customNode("MaskEffect")
|
|
8548
8796
|
], MaskEffect);
|
|
8549
8797
|
|
|
8550
|
-
var __defProp$
|
|
8551
|
-
var __getOwnPropDesc$
|
|
8552
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$
|
|
8553
|
-
var __decorateClass$
|
|
8554
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8798
|
+
var __defProp$o = Object.defineProperty;
|
|
8799
|
+
var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
|
|
8800
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8801
|
+
var __decorateClass$v = (decorators, target, key, kind) => {
|
|
8802
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
|
|
8555
8803
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8556
8804
|
if (decorator = decorators[i])
|
|
8557
8805
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8558
|
-
if (kind && result) __defProp$
|
|
8806
|
+
if (kind && result) __defProp$o(target, key, result);
|
|
8559
8807
|
return result;
|
|
8560
8808
|
};
|
|
8561
8809
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -8642,40 +8890,40 @@ void main() {
|
|
|
8642
8890
|
};
|
|
8643
8891
|
__publicField$7(OutlineEffect, "MIN_SAMPLES", 1);
|
|
8644
8892
|
__publicField$7(OutlineEffect, "MAX_SAMPLES", 100);
|
|
8645
|
-
__decorateClass$
|
|
8893
|
+
__decorateClass$v([
|
|
8646
8894
|
property()
|
|
8647
8895
|
], OutlineEffect.prototype, "color", 2);
|
|
8648
|
-
__decorateClass$
|
|
8896
|
+
__decorateClass$v([
|
|
8649
8897
|
property()
|
|
8650
8898
|
], OutlineEffect.prototype, "width", 2);
|
|
8651
|
-
__decorateClass$
|
|
8899
|
+
__decorateClass$v([
|
|
8652
8900
|
property()
|
|
8653
8901
|
], OutlineEffect.prototype, "style", 2);
|
|
8654
|
-
__decorateClass$
|
|
8902
|
+
__decorateClass$v([
|
|
8655
8903
|
property()
|
|
8656
8904
|
], OutlineEffect.prototype, "image", 2);
|
|
8657
|
-
__decorateClass$
|
|
8905
|
+
__decorateClass$v([
|
|
8658
8906
|
property()
|
|
8659
8907
|
], OutlineEffect.prototype, "opacity", 2);
|
|
8660
|
-
__decorateClass$
|
|
8908
|
+
__decorateClass$v([
|
|
8661
8909
|
property()
|
|
8662
8910
|
], OutlineEffect.prototype, "quality", 2);
|
|
8663
|
-
__decorateClass$
|
|
8911
|
+
__decorateClass$v([
|
|
8664
8912
|
property()
|
|
8665
8913
|
], OutlineEffect.prototype, "knockout", 2);
|
|
8666
|
-
OutlineEffect = __decorateClass$
|
|
8914
|
+
OutlineEffect = __decorateClass$v([
|
|
8667
8915
|
customNode("OutlineEffect")
|
|
8668
8916
|
], OutlineEffect);
|
|
8669
8917
|
|
|
8670
|
-
var __defProp$
|
|
8671
|
-
var __getOwnPropDesc$
|
|
8672
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$
|
|
8673
|
-
var __decorateClass$
|
|
8674
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8918
|
+
var __defProp$n = Object.defineProperty;
|
|
8919
|
+
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
8920
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8921
|
+
var __decorateClass$u = (decorators, target, key, kind) => {
|
|
8922
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
8675
8923
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8676
8924
|
if (decorator = decorators[i])
|
|
8677
8925
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8678
|
-
if (kind && result) __defProp$
|
|
8926
|
+
if (kind && result) __defProp$n(target, key, result);
|
|
8679
8927
|
return result;
|
|
8680
8928
|
};
|
|
8681
8929
|
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
|
|
@@ -8731,22 +8979,22 @@ void main(void) {
|
|
|
8731
8979
|
gl_FragColor = texture2D(sampler, coord);
|
|
8732
8980
|
}`
|
|
8733
8981
|
}));
|
|
8734
|
-
__decorateClass$
|
|
8982
|
+
__decorateClass$u([
|
|
8735
8983
|
property()
|
|
8736
8984
|
], PixelateEffect.prototype, "strength", 2);
|
|
8737
|
-
PixelateEffect = __decorateClass$
|
|
8985
|
+
PixelateEffect = __decorateClass$u([
|
|
8738
8986
|
customNode("PixelateEffect")
|
|
8739
8987
|
], PixelateEffect);
|
|
8740
8988
|
|
|
8741
|
-
var __defProp$
|
|
8742
|
-
var __getOwnPropDesc$
|
|
8743
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$
|
|
8744
|
-
var __decorateClass$
|
|
8745
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
8989
|
+
var __defProp$m = Object.defineProperty;
|
|
8990
|
+
var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
|
|
8991
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8992
|
+
var __decorateClass$t = (decorators, target, key, kind) => {
|
|
8993
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
|
|
8746
8994
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8747
8995
|
if (decorator = decorators[i])
|
|
8748
8996
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8749
|
-
if (kind && result) __defProp$
|
|
8997
|
+
if (kind && result) __defProp$m(target, key, result);
|
|
8750
8998
|
return result;
|
|
8751
8999
|
};
|
|
8752
9000
|
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
|
|
@@ -8859,29 +9107,29 @@ void main() {
|
|
|
8859
9107
|
gl_FragColor = color;
|
|
8860
9108
|
}`
|
|
8861
9109
|
}));
|
|
8862
|
-
__decorateClass$
|
|
9110
|
+
__decorateClass$t([
|
|
8863
9111
|
property()
|
|
8864
9112
|
], ZoomBlurEffect.prototype, "center", 2);
|
|
8865
|
-
__decorateClass$
|
|
9113
|
+
__decorateClass$t([
|
|
8866
9114
|
property()
|
|
8867
9115
|
], ZoomBlurEffect.prototype, "innerRadius", 2);
|
|
8868
|
-
__decorateClass$
|
|
9116
|
+
__decorateClass$t([
|
|
8869
9117
|
property()
|
|
8870
9118
|
], ZoomBlurEffect.prototype, "radius", 2);
|
|
8871
|
-
__decorateClass$
|
|
9119
|
+
__decorateClass$t([
|
|
8872
9120
|
property()
|
|
8873
9121
|
], ZoomBlurEffect.prototype, "strength", 2);
|
|
8874
|
-
ZoomBlurEffect = __decorateClass$
|
|
9122
|
+
ZoomBlurEffect = __decorateClass$t([
|
|
8875
9123
|
customNode("ZoomBlurEffect")
|
|
8876
9124
|
], ZoomBlurEffect);
|
|
8877
9125
|
|
|
8878
|
-
var __defProp$
|
|
8879
|
-
var __decorateClass$
|
|
9126
|
+
var __defProp$l = Object.defineProperty;
|
|
9127
|
+
var __decorateClass$s = (decorators, target, key, kind) => {
|
|
8880
9128
|
var result = void 0 ;
|
|
8881
9129
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8882
9130
|
if (decorator = decorators[i])
|
|
8883
9131
|
result = (decorator(target, key, result) ) || result;
|
|
8884
|
-
if (result) __defProp$
|
|
9132
|
+
if (result) __defProp$l(target, key, result);
|
|
8885
9133
|
return result;
|
|
8886
9134
|
};
|
|
8887
9135
|
class BaseElement2DFill extends CoreObject {
|
|
@@ -8989,47 +9237,47 @@ class BaseElement2DFill extends CoreObject {
|
|
|
8989
9237
|
});
|
|
8990
9238
|
}
|
|
8991
9239
|
}
|
|
8992
|
-
__decorateClass$
|
|
9240
|
+
__decorateClass$s([
|
|
8993
9241
|
property({ fallback: true })
|
|
8994
9242
|
], BaseElement2DFill.prototype, "enabled");
|
|
8995
|
-
__decorateClass$
|
|
9243
|
+
__decorateClass$s([
|
|
8996
9244
|
property()
|
|
8997
9245
|
], BaseElement2DFill.prototype, "color");
|
|
8998
|
-
__decorateClass$
|
|
9246
|
+
__decorateClass$s([
|
|
8999
9247
|
property()
|
|
9000
9248
|
], BaseElement2DFill.prototype, "image");
|
|
9001
|
-
__decorateClass$
|
|
9249
|
+
__decorateClass$s([
|
|
9002
9250
|
property()
|
|
9003
9251
|
], BaseElement2DFill.prototype, "linearGradient");
|
|
9004
|
-
__decorateClass$
|
|
9252
|
+
__decorateClass$s([
|
|
9005
9253
|
property()
|
|
9006
9254
|
], BaseElement2DFill.prototype, "radialGradient");
|
|
9007
|
-
__decorateClass$
|
|
9255
|
+
__decorateClass$s([
|
|
9008
9256
|
property()
|
|
9009
9257
|
], BaseElement2DFill.prototype, "cropRect");
|
|
9010
|
-
__decorateClass$
|
|
9258
|
+
__decorateClass$s([
|
|
9011
9259
|
property()
|
|
9012
9260
|
], BaseElement2DFill.prototype, "stretchRect");
|
|
9013
|
-
__decorateClass$
|
|
9261
|
+
__decorateClass$s([
|
|
9014
9262
|
property()
|
|
9015
9263
|
], BaseElement2DFill.prototype, "dpi");
|
|
9016
|
-
__decorateClass$
|
|
9264
|
+
__decorateClass$s([
|
|
9017
9265
|
property()
|
|
9018
9266
|
], BaseElement2DFill.prototype, "rotateWithShape");
|
|
9019
|
-
__decorateClass$
|
|
9267
|
+
__decorateClass$s([
|
|
9020
9268
|
property()
|
|
9021
9269
|
], BaseElement2DFill.prototype, "tile");
|
|
9022
|
-
__decorateClass$
|
|
9270
|
+
__decorateClass$s([
|
|
9023
9271
|
property()
|
|
9024
9272
|
], BaseElement2DFill.prototype, "opacity");
|
|
9025
9273
|
|
|
9026
|
-
var __defProp$
|
|
9027
|
-
var __decorateClass$
|
|
9274
|
+
var __defProp$k = Object.defineProperty;
|
|
9275
|
+
var __decorateClass$r = (decorators, target, key, kind) => {
|
|
9028
9276
|
var result = void 0 ;
|
|
9029
9277
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9030
9278
|
if (decorator = decorators[i])
|
|
9031
9279
|
result = (decorator(target, key, result) ) || result;
|
|
9032
|
-
if (result) __defProp$
|
|
9280
|
+
if (result) __defProp$k(target, key, result);
|
|
9033
9281
|
return result;
|
|
9034
9282
|
};
|
|
9035
9283
|
class BaseElement2DBackground extends BaseElement2DFill {
|
|
@@ -9039,17 +9287,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
|
|
|
9039
9287
|
);
|
|
9040
9288
|
}
|
|
9041
9289
|
}
|
|
9042
|
-
__decorateClass$
|
|
9290
|
+
__decorateClass$r([
|
|
9043
9291
|
property()
|
|
9044
9292
|
], BaseElement2DBackground.prototype, "fillWithShape");
|
|
9045
9293
|
|
|
9046
|
-
var __defProp$
|
|
9047
|
-
var __decorateClass$
|
|
9294
|
+
var __defProp$j = Object.defineProperty;
|
|
9295
|
+
var __decorateClass$q = (decorators, target, key, kind) => {
|
|
9048
9296
|
var result = void 0 ;
|
|
9049
9297
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9050
9298
|
if (decorator = decorators[i])
|
|
9051
9299
|
result = (decorator(target, key, result) ) || result;
|
|
9052
|
-
if (result) __defProp$
|
|
9300
|
+
if (result) __defProp$j(target, key, result);
|
|
9053
9301
|
return result;
|
|
9054
9302
|
};
|
|
9055
9303
|
class BaseElement2DForeground extends BaseElement2DFill {
|
|
@@ -9059,17 +9307,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
|
|
|
9059
9307
|
);
|
|
9060
9308
|
}
|
|
9061
9309
|
}
|
|
9062
|
-
__decorateClass$
|
|
9310
|
+
__decorateClass$q([
|
|
9063
9311
|
property()
|
|
9064
9312
|
], BaseElement2DForeground.prototype, "fillWithShape");
|
|
9065
9313
|
|
|
9066
|
-
var __defProp$
|
|
9067
|
-
var __decorateClass$
|
|
9314
|
+
var __defProp$i = Object.defineProperty;
|
|
9315
|
+
var __decorateClass$p = (decorators, target, key, kind) => {
|
|
9068
9316
|
var result = void 0 ;
|
|
9069
9317
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9070
9318
|
if (decorator = decorators[i])
|
|
9071
9319
|
result = (decorator(target, key, result) ) || result;
|
|
9072
|
-
if (result) __defProp$
|
|
9320
|
+
if (result) __defProp$i(target, key, result);
|
|
9073
9321
|
return result;
|
|
9074
9322
|
};
|
|
9075
9323
|
class BaseElement2DOutline extends BaseElement2DFill {
|
|
@@ -9102,23 +9350,23 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9102
9350
|
ctx.stroke({ disableWrapMode });
|
|
9103
9351
|
}
|
|
9104
9352
|
}
|
|
9105
|
-
__decorateClass$
|
|
9353
|
+
__decorateClass$p([
|
|
9106
9354
|
property({ fallback: "#00000000" })
|
|
9107
9355
|
], BaseElement2DOutline.prototype, "color");
|
|
9108
|
-
__decorateClass$
|
|
9356
|
+
__decorateClass$p([
|
|
9109
9357
|
property({ fallback: 0 })
|
|
9110
9358
|
], BaseElement2DOutline.prototype, "width");
|
|
9111
|
-
__decorateClass$
|
|
9359
|
+
__decorateClass$p([
|
|
9112
9360
|
property({ fallback: "solid" })
|
|
9113
9361
|
], BaseElement2DOutline.prototype, "style");
|
|
9114
9362
|
|
|
9115
|
-
var __defProp$
|
|
9116
|
-
var __decorateClass$
|
|
9363
|
+
var __defProp$h = Object.defineProperty;
|
|
9364
|
+
var __decorateClass$o = (decorators, target, key, kind) => {
|
|
9117
9365
|
var result = void 0 ;
|
|
9118
9366
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9119
9367
|
if (decorator = decorators[i])
|
|
9120
9368
|
result = (decorator(target, key, result) ) || result;
|
|
9121
|
-
if (result) __defProp$
|
|
9369
|
+
if (result) __defProp$h(target, key, result);
|
|
9122
9370
|
return result;
|
|
9123
9371
|
};
|
|
9124
9372
|
class BaseElement2DShadow extends CoreObject {
|
|
@@ -9158,29 +9406,29 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9158
9406
|
}
|
|
9159
9407
|
}
|
|
9160
9408
|
}
|
|
9161
|
-
__decorateClass$
|
|
9409
|
+
__decorateClass$o([
|
|
9162
9410
|
property({ fallback: true })
|
|
9163
9411
|
], BaseElement2DShadow.prototype, "enabled");
|
|
9164
|
-
__decorateClass$
|
|
9412
|
+
__decorateClass$o([
|
|
9165
9413
|
property({ fallback: "#000000FF" })
|
|
9166
9414
|
], BaseElement2DShadow.prototype, "color");
|
|
9167
|
-
__decorateClass$
|
|
9415
|
+
__decorateClass$o([
|
|
9168
9416
|
property({ fallback: 0 })
|
|
9169
9417
|
], BaseElement2DShadow.prototype, "blur");
|
|
9170
|
-
__decorateClass$
|
|
9418
|
+
__decorateClass$o([
|
|
9171
9419
|
property({ fallback: 0 })
|
|
9172
9420
|
], BaseElement2DShadow.prototype, "offsetY");
|
|
9173
|
-
__decorateClass$
|
|
9421
|
+
__decorateClass$o([
|
|
9174
9422
|
property({ fallback: 0 })
|
|
9175
9423
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9176
9424
|
|
|
9177
|
-
var __defProp$
|
|
9178
|
-
var __decorateClass$
|
|
9425
|
+
var __defProp$g = Object.defineProperty;
|
|
9426
|
+
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9179
9427
|
var result = void 0 ;
|
|
9180
9428
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9181
9429
|
if (decorator = decorators[i])
|
|
9182
9430
|
result = (decorator(target, key, result) ) || result;
|
|
9183
|
-
if (result) __defProp$
|
|
9431
|
+
if (result) __defProp$g(target, key, result);
|
|
9184
9432
|
return result;
|
|
9185
9433
|
};
|
|
9186
9434
|
class BaseElement2DShape extends CoreObject {
|
|
@@ -9255,19 +9503,19 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9255
9503
|
}
|
|
9256
9504
|
}
|
|
9257
9505
|
}
|
|
9258
|
-
__decorateClass$
|
|
9506
|
+
__decorateClass$n([
|
|
9259
9507
|
property({ fallback: true })
|
|
9260
9508
|
], BaseElement2DShape.prototype, "enabled");
|
|
9261
|
-
__decorateClass$
|
|
9509
|
+
__decorateClass$n([
|
|
9262
9510
|
property()
|
|
9263
9511
|
], BaseElement2DShape.prototype, "preset");
|
|
9264
|
-
__decorateClass$
|
|
9512
|
+
__decorateClass$n([
|
|
9265
9513
|
property()
|
|
9266
9514
|
], BaseElement2DShape.prototype, "svg");
|
|
9267
|
-
__decorateClass$
|
|
9515
|
+
__decorateClass$n([
|
|
9268
9516
|
property()
|
|
9269
9517
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9270
|
-
__decorateClass$
|
|
9518
|
+
__decorateClass$n([
|
|
9271
9519
|
property()
|
|
9272
9520
|
], BaseElement2DShape.prototype, "paths");
|
|
9273
9521
|
|
|
@@ -9283,13 +9531,13 @@ for (const key in defaultStyles$1) {
|
|
|
9283
9531
|
defineProperty(BaseElement2DStyle, key, { fallback });
|
|
9284
9532
|
}
|
|
9285
9533
|
|
|
9286
|
-
var __defProp$
|
|
9287
|
-
var __decorateClass$
|
|
9534
|
+
var __defProp$f = Object.defineProperty;
|
|
9535
|
+
var __decorateClass$m = (decorators, target, key, kind) => {
|
|
9288
9536
|
var result = void 0 ;
|
|
9289
9537
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9290
9538
|
if (decorator = decorators[i])
|
|
9291
9539
|
result = (decorator(target, key, result) ) || result;
|
|
9292
|
-
if (result) __defProp$
|
|
9540
|
+
if (result) __defProp$f(target, key, result);
|
|
9293
9541
|
return result;
|
|
9294
9542
|
};
|
|
9295
9543
|
class BaseElement2DText extends CoreObject {
|
|
@@ -9337,180 +9585,60 @@ class BaseElement2DText extends CoreObject {
|
|
|
9337
9585
|
textAlign: "center",
|
|
9338
9586
|
...this.parent.style.toJSON()
|
|
9339
9587
|
};
|
|
9340
|
-
this.base.requestUpdate();
|
|
9341
|
-
}
|
|
9342
|
-
measure() {
|
|
9343
|
-
this._updateText();
|
|
9344
|
-
return this.base.measure();
|
|
9345
|
-
}
|
|
9346
|
-
updateMeasure() {
|
|
9347
|
-
this.measureResult = this.measure();
|
|
9348
|
-
return this;
|
|
9349
|
-
}
|
|
9350
|
-
canDraw() {
|
|
9351
|
-
return Boolean(
|
|
9352
|
-
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9353
|
-
);
|
|
9354
|
-
}
|
|
9355
|
-
draw() {
|
|
9356
|
-
const ctx = this.parent.context;
|
|
9357
|
-
this.base.update();
|
|
9358
|
-
this.base.pathSets.forEach((pathSet) => {
|
|
9359
|
-
pathSet.paths.forEach((path) => {
|
|
9360
|
-
ctx.addPath(path);
|
|
9361
|
-
ctx.style = { ...path.style };
|
|
9362
|
-
ctx.fillStyle = void 0;
|
|
9363
|
-
ctx.strokeStyle = void 0;
|
|
9364
|
-
ctx.fill();
|
|
9365
|
-
});
|
|
9366
|
-
});
|
|
9367
|
-
}
|
|
9368
|
-
}
|
|
9369
|
-
__decorateClass$o([
|
|
9370
|
-
property({ fallback: true })
|
|
9371
|
-
], BaseElement2DText.prototype, "enabled");
|
|
9372
|
-
__decorateClass$o([
|
|
9373
|
-
property({ alias: "base.content", fallback: () => [] })
|
|
9374
|
-
], BaseElement2DText.prototype, "content");
|
|
9375
|
-
__decorateClass$o([
|
|
9376
|
-
property({ alias: "base.effects" })
|
|
9377
|
-
], BaseElement2DText.prototype, "effects");
|
|
9378
|
-
__decorateClass$o([
|
|
9379
|
-
property({ alias: "base.fill" })
|
|
9380
|
-
], BaseElement2DText.prototype, "fill");
|
|
9381
|
-
__decorateClass$o([
|
|
9382
|
-
property({ alias: "base.outline" })
|
|
9383
|
-
], BaseElement2DText.prototype, "outline");
|
|
9384
|
-
__decorateClass$o([
|
|
9385
|
-
property({ protected: true, alias: "base.measureDom" })
|
|
9386
|
-
], BaseElement2DText.prototype, "measureDom");
|
|
9387
|
-
__decorateClass$o([
|
|
9388
|
-
property({ protected: true, alias: "base.fonts" })
|
|
9389
|
-
], BaseElement2DText.prototype, "fonts");
|
|
9390
|
-
|
|
9391
|
-
var __defProp$g = Object.defineProperty;
|
|
9392
|
-
var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
|
|
9393
|
-
var __decorateClass$n = (decorators, target, key, kind) => {
|
|
9394
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
|
|
9395
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9396
|
-
if (decorator = decorators[i])
|
|
9397
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9398
|
-
if (kind && result) __defProp$g(target, key, result);
|
|
9399
|
-
return result;
|
|
9400
|
-
};
|
|
9401
|
-
let Node2D = class extends CanvasItem {
|
|
9402
|
-
position = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9403
|
-
scale = new Vector2(1, 1).on("update", () => this.updateGlobalTransform());
|
|
9404
|
-
skew = new Vector2().on("update", () => this.updateGlobalTransform());
|
|
9405
|
-
transform = new Transform2D();
|
|
9406
|
-
globalPosition = new Vector2();
|
|
9407
|
-
globalScale = new Vector2();
|
|
9408
|
-
globalSkew = new Vector2();
|
|
9409
|
-
globalTransform = new Transform2D();
|
|
9410
|
-
_parentTransformDirtyId;
|
|
9411
|
-
constructor(properties, nodes = []) {
|
|
9412
|
-
super();
|
|
9413
|
-
this.setProperties(properties).append(nodes);
|
|
9414
|
-
}
|
|
9415
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9416
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9417
|
-
switch (key) {
|
|
9418
|
-
case "rotation":
|
|
9419
|
-
this.requestRelayout();
|
|
9420
|
-
break;
|
|
9421
|
-
}
|
|
9422
|
-
}
|
|
9423
|
-
getTransformOrigin() {
|
|
9424
|
-
return new Vector2(0, 0);
|
|
9425
|
-
}
|
|
9426
|
-
getTransform(cb) {
|
|
9427
|
-
const origin = this.getTransformOrigin();
|
|
9428
|
-
const transform = new Transform2D();
|
|
9429
|
-
transform.translate(-origin.x, -origin.y).scale(this.scale.x, this.scale.y).skew(this.skew.x, this.skew.y).rotate(this.rotation);
|
|
9430
|
-
cb?.(transform);
|
|
9431
|
-
transform.translate(this.position.x, this.position.y).translate(origin.x, origin.y);
|
|
9432
|
-
return transform;
|
|
9588
|
+
this.base.requestUpdate();
|
|
9433
9589
|
}
|
|
9434
|
-
|
|
9435
|
-
this.
|
|
9590
|
+
measure() {
|
|
9591
|
+
this._updateText();
|
|
9592
|
+
return this.base.measure();
|
|
9436
9593
|
}
|
|
9437
|
-
|
|
9438
|
-
this.
|
|
9439
|
-
|
|
9440
|
-
if (parent?.globalTransform) {
|
|
9441
|
-
this._parentTransformDirtyId = parent.globalTransform.dirtyId;
|
|
9442
|
-
this.globalScale.set(parent.globalScale.x * this.scale.x, parent.globalScale.y * this.scale.y);
|
|
9443
|
-
this.globalRotation = parent.globalRotation + this.rotation;
|
|
9444
|
-
parent.globalTransform.multiply(this.transform, this.globalTransform);
|
|
9445
|
-
} else {
|
|
9446
|
-
this.globalScale.copy(this.scale);
|
|
9447
|
-
this.globalRotation = this.rotation;
|
|
9448
|
-
this.globalTransform.copy(this.transform);
|
|
9449
|
-
}
|
|
9450
|
-
const [
|
|
9451
|
-
a,
|
|
9452
|
-
c,
|
|
9453
|
-
tx,
|
|
9454
|
-
b,
|
|
9455
|
-
d,
|
|
9456
|
-
ty
|
|
9457
|
-
] = this.globalTransform.toArray();
|
|
9458
|
-
this.globalPosition.set(tx, ty);
|
|
9459
|
-
this.globalSkew.x = Math.atan2(c, a) - this.globalRotation;
|
|
9460
|
-
this.globalSkew.y = Math.atan2(b, d) - this.globalRotation;
|
|
9461
|
-
this.requestRelayout();
|
|
9594
|
+
updateMeasure() {
|
|
9595
|
+
this.measureResult = this.measure();
|
|
9596
|
+
return this;
|
|
9462
9597
|
}
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
globalTransform.multiply(
|
|
9468
|
-
typeof vertTransform === "function" ? vertTransform?.() : vertTransform
|
|
9469
|
-
);
|
|
9470
|
-
[a, c, tx, b, d, ty] = globalTransform.toArray();
|
|
9471
|
-
} else {
|
|
9472
|
-
[a, c, tx, b, d, ty] = this.globalTransform.toArray();
|
|
9473
|
-
}
|
|
9474
|
-
const newVertices = vertices.slice();
|
|
9475
|
-
for (let len = vertices.length, i = 0; i < len; i += 2) {
|
|
9476
|
-
const x = vertices[i];
|
|
9477
|
-
const y = vertices[i + 1];
|
|
9478
|
-
newVertices[i] = a * x + c * y + tx;
|
|
9479
|
-
newVertices[i + 1] = b * x + d * y + ty;
|
|
9480
|
-
}
|
|
9481
|
-
return newVertices;
|
|
9598
|
+
canDraw() {
|
|
9599
|
+
return Boolean(
|
|
9600
|
+
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9601
|
+
);
|
|
9482
9602
|
}
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
this.
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9603
|
+
draw() {
|
|
9604
|
+
const ctx = this.parent.context;
|
|
9605
|
+
this.base.update();
|
|
9606
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9607
|
+
pathSet.paths.forEach((path) => {
|
|
9608
|
+
ctx.addPath(path);
|
|
9609
|
+
ctx.style = { ...path.style };
|
|
9610
|
+
ctx.fillStyle = void 0;
|
|
9611
|
+
ctx.strokeStyle = void 0;
|
|
9612
|
+
ctx.fill();
|
|
9613
|
+
});
|
|
9491
9614
|
});
|
|
9492
9615
|
}
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9616
|
+
}
|
|
9617
|
+
__decorateClass$m([
|
|
9618
|
+
property({ fallback: true })
|
|
9619
|
+
], BaseElement2DText.prototype, "enabled");
|
|
9620
|
+
__decorateClass$m([
|
|
9621
|
+
property({ alias: "base.content", fallback: () => [] })
|
|
9622
|
+
], BaseElement2DText.prototype, "content");
|
|
9623
|
+
__decorateClass$m([
|
|
9624
|
+
property({ alias: "base.effects" })
|
|
9625
|
+
], BaseElement2DText.prototype, "effects");
|
|
9626
|
+
__decorateClass$m([
|
|
9627
|
+
property({ alias: "base.fill" })
|
|
9628
|
+
], BaseElement2DText.prototype, "fill");
|
|
9629
|
+
__decorateClass$m([
|
|
9630
|
+
property({ alias: "base.outline" })
|
|
9631
|
+
], BaseElement2DText.prototype, "outline");
|
|
9632
|
+
__decorateClass$m([
|
|
9633
|
+
property({ protected: true, alias: "base.measureDom" })
|
|
9634
|
+
], BaseElement2DText.prototype, "measureDom");
|
|
9635
|
+
__decorateClass$m([
|
|
9636
|
+
property({ protected: true, alias: "base.fonts" })
|
|
9637
|
+
], BaseElement2DText.prototype, "fonts");
|
|
9510
9638
|
|
|
9511
|
-
var __getOwnPropDesc$
|
|
9512
|
-
var __decorateClass$
|
|
9513
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
9639
|
+
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
9640
|
+
var __decorateClass$l = (decorators, target, key, kind) => {
|
|
9641
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
|
|
9514
9642
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9515
9643
|
if (decorator = decorators[i])
|
|
9516
9644
|
result = (decorator(result)) || result;
|
|
@@ -9734,15 +9862,46 @@ let BaseElement2D = class extends Node2D {
|
|
|
9734
9862
|
maxY - minY
|
|
9735
9863
|
);
|
|
9736
9864
|
}
|
|
9865
|
+
// protected _rectsOverlap(r1: any, r2: any): boolean {
|
|
9866
|
+
// return (
|
|
9867
|
+
// r1.x < r2.x + r2.width
|
|
9868
|
+
// && r1.x + r1.width > r2.x
|
|
9869
|
+
// && r1.y < r2.y + r2.height
|
|
9870
|
+
// && r1.y + r1.height > r2.y
|
|
9871
|
+
// )
|
|
9872
|
+
// }
|
|
9873
|
+
// TODO
|
|
9874
|
+
// override isVisibleInTree(): boolean {
|
|
9875
|
+
// if (this._tree) {
|
|
9876
|
+
// const root = this._tree.root
|
|
9877
|
+
// const camera = root.canvasTransform.inverse()
|
|
9878
|
+
// const { x, y, width, height } = root
|
|
9879
|
+
// const p1 = camera.applyToPoint(x, y)
|
|
9880
|
+
// const p2 = camera.applyToPoint(x + width, y)
|
|
9881
|
+
// const p3 = camera.applyToPoint(x + width, y + height)
|
|
9882
|
+
// const p4 = camera.applyToPoint(x, y + height)
|
|
9883
|
+
// const pts = [p1, p2, p3, p4]
|
|
9884
|
+
// const xs = pts.map(p => p[0])
|
|
9885
|
+
// const ys = pts.map(p => p[1])
|
|
9886
|
+
// const minX = Math.min(...xs)
|
|
9887
|
+
// const maxX = Math.max(...xs)
|
|
9888
|
+
// const minY = Math.min(...ys)
|
|
9889
|
+
// const maxY = Math.max(...ys)
|
|
9890
|
+
// const rect2 = {
|
|
9891
|
+
// x: minX,
|
|
9892
|
+
// y: minY,
|
|
9893
|
+
// width: maxX - minX,
|
|
9894
|
+
// height: maxY - minY,
|
|
9895
|
+
// }
|
|
9896
|
+
// if (!this._rectsOverlap(rect2, this.getRect())) {
|
|
9897
|
+
// return false
|
|
9898
|
+
// }
|
|
9899
|
+
// }
|
|
9900
|
+
// return super.isVisibleInTree()
|
|
9901
|
+
// }
|
|
9737
9902
|
_updateOverflow() {
|
|
9738
9903
|
if (this.style.overflow === "hidden") {
|
|
9739
|
-
|
|
9740
|
-
this.mask = {
|
|
9741
|
-
x: rect.x,
|
|
9742
|
-
y: rect.y,
|
|
9743
|
-
width: rect.width,
|
|
9744
|
-
height: rect.height
|
|
9745
|
-
};
|
|
9904
|
+
this.mask = this.getRect().toJSON();
|
|
9746
9905
|
} else {
|
|
9747
9906
|
this.mask = void 0;
|
|
9748
9907
|
}
|
|
@@ -9845,7 +10004,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
9845
10004
|
});
|
|
9846
10005
|
}
|
|
9847
10006
|
};
|
|
9848
|
-
BaseElement2D = __decorateClass$
|
|
10007
|
+
BaseElement2D = __decorateClass$l([
|
|
9849
10008
|
customNode("BaseElement2D")
|
|
9850
10009
|
], BaseElement2D);
|
|
9851
10010
|
|
|
@@ -9865,9 +10024,16 @@ for (const key in defaultStyles) {
|
|
|
9865
10024
|
defineProperty(Element2DStyle, key, { fallback: defaultStyles[key] });
|
|
9866
10025
|
}
|
|
9867
10026
|
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
10027
|
+
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
10028
|
+
constructor(properties) {
|
|
10029
|
+
super();
|
|
10030
|
+
this.setProperties(properties);
|
|
10031
|
+
}
|
|
10032
|
+
}
|
|
10033
|
+
|
|
10034
|
+
var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
|
|
10035
|
+
var __decorateClass$k = (decorators, target, key, kind) => {
|
|
10036
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
|
|
9871
10037
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9872
10038
|
if (decorator = decorators[i])
|
|
9873
10039
|
result = (decorator(result)) || result;
|
|
@@ -9918,17 +10084,10 @@ let Element2D = class extends BaseElement2D {
|
|
|
9918
10084
|
}
|
|
9919
10085
|
}
|
|
9920
10086
|
};
|
|
9921
|
-
Element2D = __decorateClass$
|
|
10087
|
+
Element2D = __decorateClass$k([
|
|
9922
10088
|
customNode("Element2D")
|
|
9923
10089
|
], Element2D);
|
|
9924
10090
|
|
|
9925
|
-
class FlexElement2DStyle extends BaseElement2DStyle {
|
|
9926
|
-
constructor(properties) {
|
|
9927
|
-
super();
|
|
9928
|
-
this.setProperties(properties);
|
|
9929
|
-
}
|
|
9930
|
-
}
|
|
9931
|
-
|
|
9932
10091
|
const alignMap = {
|
|
9933
10092
|
"auto": Align.Auto,
|
|
9934
10093
|
"flex-start": Align.FlexStart,
|
|
@@ -10170,9 +10329,9 @@ class FlexLayout {
|
|
|
10170
10329
|
}
|
|
10171
10330
|
}
|
|
10172
10331
|
|
|
10173
|
-
var __getOwnPropDesc$
|
|
10174
|
-
var __decorateClass$
|
|
10175
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10332
|
+
var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
|
|
10333
|
+
var __decorateClass$j = (decorators, target, key, kind) => {
|
|
10334
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
|
|
10176
10335
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10177
10336
|
if (decorator = decorators[i])
|
|
10178
10337
|
result = (decorator(result)) || result;
|
|
@@ -10249,18 +10408,18 @@ let FlexElement2D = class extends BaseElement2D {
|
|
|
10249
10408
|
}
|
|
10250
10409
|
}
|
|
10251
10410
|
};
|
|
10252
|
-
FlexElement2D = __decorateClass$
|
|
10411
|
+
FlexElement2D = __decorateClass$j([
|
|
10253
10412
|
customNode("FlexElement2D")
|
|
10254
10413
|
], FlexElement2D);
|
|
10255
10414
|
|
|
10256
|
-
var __defProp$
|
|
10257
|
-
var __getOwnPropDesc$
|
|
10258
|
-
var __decorateClass$
|
|
10259
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10415
|
+
var __defProp$e = Object.defineProperty;
|
|
10416
|
+
var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
|
|
10417
|
+
var __decorateClass$i = (decorators, target, key, kind) => {
|
|
10418
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
|
|
10260
10419
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10261
10420
|
if (decorator = decorators[i])
|
|
10262
10421
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10263
|
-
if (kind && result) __defProp$
|
|
10422
|
+
if (kind && result) __defProp$e(target, key, result);
|
|
10264
10423
|
return result;
|
|
10265
10424
|
};
|
|
10266
10425
|
let Image2D = class extends Element2D {
|
|
@@ -10396,19 +10555,19 @@ let Image2D = class extends Element2D {
|
|
|
10396
10555
|
});
|
|
10397
10556
|
}
|
|
10398
10557
|
};
|
|
10399
|
-
__decorateClass$
|
|
10558
|
+
__decorateClass$i([
|
|
10400
10559
|
property({ protected: true })
|
|
10401
10560
|
], Image2D.prototype, "texture", 2);
|
|
10402
|
-
__decorateClass$
|
|
10561
|
+
__decorateClass$i([
|
|
10403
10562
|
property({ fallback: "" })
|
|
10404
10563
|
], Image2D.prototype, "src", 2);
|
|
10405
|
-
__decorateClass$
|
|
10564
|
+
__decorateClass$i([
|
|
10406
10565
|
property()
|
|
10407
10566
|
], Image2D.prototype, "srcRect", 2);
|
|
10408
|
-
__decorateClass$
|
|
10567
|
+
__decorateClass$i([
|
|
10409
10568
|
property({ fallback: false })
|
|
10410
10569
|
], Image2D.prototype, "gif", 2);
|
|
10411
|
-
Image2D = __decorateClass$
|
|
10570
|
+
Image2D = __decorateClass$i([
|
|
10412
10571
|
customNode("Image2D")
|
|
10413
10572
|
], Image2D);
|
|
10414
10573
|
|
|
@@ -10432,14 +10591,14 @@ class TextureRect2D extends Element2D {
|
|
|
10432
10591
|
}
|
|
10433
10592
|
}
|
|
10434
10593
|
|
|
10435
|
-
var __defProp$
|
|
10436
|
-
var __getOwnPropDesc$
|
|
10437
|
-
var __decorateClass$
|
|
10438
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
10594
|
+
var __defProp$d = Object.defineProperty;
|
|
10595
|
+
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10596
|
+
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10597
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10439
10598
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10440
10599
|
if (decorator = decorators[i])
|
|
10441
10600
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10442
|
-
if (kind && result) __defProp$
|
|
10601
|
+
if (kind && result) __defProp$d(target, key, result);
|
|
10443
10602
|
return result;
|
|
10444
10603
|
};
|
|
10445
10604
|
let Lottie2D = class extends TextureRect2D {
|
|
@@ -10482,189 +10641,13 @@ let Lottie2D = class extends TextureRect2D {
|
|
|
10482
10641
|
super._process(delta);
|
|
10483
10642
|
}
|
|
10484
10643
|
};
|
|
10485
|
-
__decorateClass$
|
|
10644
|
+
__decorateClass$h([
|
|
10486
10645
|
property({ fallback: "" })
|
|
10487
10646
|
], Lottie2D.prototype, "src", 2);
|
|
10488
|
-
Lottie2D = __decorateClass$
|
|
10647
|
+
Lottie2D = __decorateClass$h([
|
|
10489
10648
|
customNode("Lottie2D")
|
|
10490
10649
|
], Lottie2D);
|
|
10491
10650
|
|
|
10492
|
-
var __defProp$d = Object.defineProperty;
|
|
10493
|
-
var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
|
|
10494
|
-
var __decorateClass$h = (decorators, target, key, kind) => {
|
|
10495
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
|
|
10496
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10497
|
-
if (decorator = decorators[i])
|
|
10498
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
10499
|
-
if (kind && result) __defProp$d(target, key, result);
|
|
10500
|
-
return result;
|
|
10501
|
-
};
|
|
10502
|
-
const textStyles = new Set(Object.keys(textDefaultStyle));
|
|
10503
|
-
let Text2D = class extends TextureRect2D {
|
|
10504
|
-
texture = new CanvasTexture();
|
|
10505
|
-
base = new Text();
|
|
10506
|
-
measureResult;
|
|
10507
|
-
_subTextsCount = 0;
|
|
10508
|
-
constructor(properties, children = []) {
|
|
10509
|
-
super();
|
|
10510
|
-
this.setProperties(properties);
|
|
10511
|
-
this.append(children);
|
|
10512
|
-
if (properties?.plugins) {
|
|
10513
|
-
properties.plugins.forEach((plugin) => {
|
|
10514
|
-
this.base.use(plugin);
|
|
10515
|
-
});
|
|
10516
|
-
}
|
|
10517
|
-
}
|
|
10518
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
10519
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
10520
|
-
switch (key) {
|
|
10521
|
-
case "content":
|
|
10522
|
-
case "effects":
|
|
10523
|
-
case "measureDOM":
|
|
10524
|
-
case "fonts":
|
|
10525
|
-
case "split":
|
|
10526
|
-
this._updateSplit();
|
|
10527
|
-
this.requestRedraw();
|
|
10528
|
-
break;
|
|
10529
|
-
}
|
|
10530
|
-
if (this._subTextsCount && key === "effects") {
|
|
10531
|
-
this._getSubTexts().forEach((child) => {
|
|
10532
|
-
child.setProperties({ [key]: value });
|
|
10533
|
-
});
|
|
10534
|
-
}
|
|
10535
|
-
}
|
|
10536
|
-
_updateBase() {
|
|
10537
|
-
this.base.style = this.style.toJSON();
|
|
10538
|
-
this.emit("updateBase", this.base);
|
|
10539
|
-
this.base.requestUpdate();
|
|
10540
|
-
}
|
|
10541
|
-
_updateStyleProperty(key, value, oldValue) {
|
|
10542
|
-
switch (key) {
|
|
10543
|
-
case "left":
|
|
10544
|
-
case "top":
|
|
10545
|
-
case "width":
|
|
10546
|
-
case "height":
|
|
10547
|
-
this.requestRedraw();
|
|
10548
|
-
break;
|
|
10549
|
-
default:
|
|
10550
|
-
super._updateStyleProperty(key, value, oldValue);
|
|
10551
|
-
break;
|
|
10552
|
-
}
|
|
10553
|
-
switch (key) {
|
|
10554
|
-
case "width":
|
|
10555
|
-
if (this.split) {
|
|
10556
|
-
this._updateSubTexts();
|
|
10557
|
-
}
|
|
10558
|
-
break;
|
|
10559
|
-
}
|
|
10560
|
-
if (typeof key === "string" && textStyles.has(key)) {
|
|
10561
|
-
if (this._subTextsCount && key !== "width" && key !== "height") {
|
|
10562
|
-
this._getSubTexts().forEach((child) => {
|
|
10563
|
-
child.style.setProperties({ [key]: value });
|
|
10564
|
-
});
|
|
10565
|
-
}
|
|
10566
|
-
this.requestRedraw();
|
|
10567
|
-
}
|
|
10568
|
-
}
|
|
10569
|
-
_getSubTexts() {
|
|
10570
|
-
return this.children.front.filter((node) => node instanceof Text2D);
|
|
10571
|
-
}
|
|
10572
|
-
_updateSubTexts() {
|
|
10573
|
-
const subTexts = this._getSubTexts();
|
|
10574
|
-
let i = 0;
|
|
10575
|
-
if (this.split) {
|
|
10576
|
-
this.updateMeasure().measureResult?.paragraphs.forEach((p) => {
|
|
10577
|
-
p.fragments.forEach((f) => {
|
|
10578
|
-
f.characters.forEach((c) => {
|
|
10579
|
-
const child = subTexts[i];
|
|
10580
|
-
if (child) {
|
|
10581
|
-
child.style.left = c.inlineBox.left;
|
|
10582
|
-
child.style.top = c.inlineBox.top;
|
|
10583
|
-
}
|
|
10584
|
-
i++;
|
|
10585
|
-
});
|
|
10586
|
-
});
|
|
10587
|
-
});
|
|
10588
|
-
}
|
|
10589
|
-
}
|
|
10590
|
-
measure() {
|
|
10591
|
-
this._updateBase();
|
|
10592
|
-
return this.base.measure();
|
|
10593
|
-
}
|
|
10594
|
-
updateMeasure() {
|
|
10595
|
-
this.measureResult = this.measure();
|
|
10596
|
-
const { boundingBox } = this.measureResult;
|
|
10597
|
-
const { left, top } = this.style;
|
|
10598
|
-
this.position.x = left + Math.min(0, boundingBox.left);
|
|
10599
|
-
this.position.y = top + Math.min(0, boundingBox.top);
|
|
10600
|
-
this.size.width = boundingBox.width;
|
|
10601
|
-
this.size.height = boundingBox.height;
|
|
10602
|
-
return this;
|
|
10603
|
-
}
|
|
10604
|
-
_updateSplit() {
|
|
10605
|
-
if (this._subTextsCount) {
|
|
10606
|
-
this.children.front.forEach((child) => this.removeChild(child));
|
|
10607
|
-
this._subTextsCount = 0;
|
|
10608
|
-
}
|
|
10609
|
-
if (this.split) {
|
|
10610
|
-
this.measure().paragraphs.forEach((p) => {
|
|
10611
|
-
p.fragments.forEach((f) => {
|
|
10612
|
-
f.characters.forEach((c) => {
|
|
10613
|
-
this.append(
|
|
10614
|
-
new Text2D({
|
|
10615
|
-
internalMode: "front",
|
|
10616
|
-
style: {
|
|
10617
|
-
...c.computedStyle,
|
|
10618
|
-
left: c.inlineBox.x,
|
|
10619
|
-
top: c.inlineBox.y,
|
|
10620
|
-
width: 0,
|
|
10621
|
-
height: 0
|
|
10622
|
-
},
|
|
10623
|
-
content: c.content,
|
|
10624
|
-
effects: this.effects,
|
|
10625
|
-
fonts: this.fonts
|
|
10626
|
-
})
|
|
10627
|
-
);
|
|
10628
|
-
this._subTextsCount++;
|
|
10629
|
-
});
|
|
10630
|
-
});
|
|
10631
|
-
});
|
|
10632
|
-
}
|
|
10633
|
-
}
|
|
10634
|
-
_redraw() {
|
|
10635
|
-
this.updateMeasure();
|
|
10636
|
-
return super._redraw();
|
|
10637
|
-
}
|
|
10638
|
-
_drawContent() {
|
|
10639
|
-
if (!this.split) {
|
|
10640
|
-
this.base.render({
|
|
10641
|
-
pixelRatio: this.texture.pixelRatio,
|
|
10642
|
-
view: this.texture.source
|
|
10643
|
-
});
|
|
10644
|
-
this.texture.requestUpload();
|
|
10645
|
-
super._drawContent();
|
|
10646
|
-
}
|
|
10647
|
-
}
|
|
10648
|
-
};
|
|
10649
|
-
__decorateClass$h([
|
|
10650
|
-
property({ fallback: false })
|
|
10651
|
-
], Text2D.prototype, "split", 2);
|
|
10652
|
-
__decorateClass$h([
|
|
10653
|
-
property({ alias: "base.content" })
|
|
10654
|
-
], Text2D.prototype, "content", 2);
|
|
10655
|
-
__decorateClass$h([
|
|
10656
|
-
property({ alias: "base.effects" })
|
|
10657
|
-
], Text2D.prototype, "effects", 2);
|
|
10658
|
-
__decorateClass$h([
|
|
10659
|
-
property({ protected: true, alias: "base.measureDOM" })
|
|
10660
|
-
], Text2D.prototype, "measureDOM", 2);
|
|
10661
|
-
__decorateClass$h([
|
|
10662
|
-
property({ protected: true, alias: "base.fonts" })
|
|
10663
|
-
], Text2D.prototype, "fonts", 2);
|
|
10664
|
-
Text2D = __decorateClass$h([
|
|
10665
|
-
customNode("Text2D")
|
|
10666
|
-
], Text2D);
|
|
10667
|
-
|
|
10668
10651
|
var __defProp$c = Object.defineProperty;
|
|
10669
10652
|
var __decorateClass$g = (decorators, target, key, kind) => {
|
|
10670
10653
|
var result = void 0 ;
|
|
@@ -13991,4 +13974,4 @@ async function render(options) {
|
|
|
13991
13974
|
});
|
|
13992
13975
|
}
|
|
13993
13976
|
|
|
13994
|
-
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,
|
|
13977
|
+
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 };
|