modern-canvas 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2204,13 +2204,13 @@ class Vector3 extends Vector {
2204
2204
  }
2205
2205
  }
2206
2206
 
2207
- var __defProp$L = Object.defineProperty;
2208
- var __decorateClass$L = (decorators, target, key, kind) => {
2207
+ var __defProp$M = Object.defineProperty;
2208
+ var __decorateClass$M = (decorators, target, key, kind) => {
2209
2209
  var result = undefined ;
2210
2210
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2211
2211
  if (decorator = decorators[i])
2212
2212
  result = (decorator(target, key, result) ) || result;
2213
- if (result) __defProp$L(target, key, result);
2213
+ if (result) __defProp$M(target, key, result);
2214
2214
  return result;
2215
2215
  };
2216
2216
  class MainLoop extends CoreObject {
@@ -2251,10 +2251,10 @@ class MainLoop extends CoreObject {
2251
2251
  }
2252
2252
  }
2253
2253
  }
2254
- __decorateClass$L([
2254
+ __decorateClass$M([
2255
2255
  property({ default: 24 })
2256
2256
  ], MainLoop.prototype, "fps");
2257
- __decorateClass$L([
2257
+ __decorateClass$M([
2258
2258
  property({ default: 1 })
2259
2259
  ], MainLoop.prototype, "speed");
2260
2260
 
@@ -4398,13 +4398,13 @@ class Geometry extends Resource {
4398
4398
  }
4399
4399
  }
4400
4400
 
4401
- var __defProp$K = Object.defineProperty;
4402
- var __decorateClass$K = (decorators, target, key, kind) => {
4401
+ var __defProp$L = Object.defineProperty;
4402
+ var __decorateClass$L = (decorators, target, key, kind) => {
4403
4403
  var result = undefined ;
4404
4404
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4405
4405
  if (decorator = decorators[i])
4406
4406
  result = (decorator(target, key, result) ) || result;
4407
- if (result) __defProp$K(target, key, result);
4407
+ if (result) __defProp$L(target, key, result);
4408
4408
  return result;
4409
4409
  };
4410
4410
  class IndexBuffer extends Resource {
@@ -4448,20 +4448,20 @@ class IndexBuffer extends Resource {
4448
4448
  return result;
4449
4449
  }
4450
4450
  }
4451
- __decorateClass$K([
4451
+ __decorateClass$L([
4452
4452
  protectedProperty({ default: null })
4453
4453
  ], IndexBuffer.prototype, "data");
4454
- __decorateClass$K([
4454
+ __decorateClass$L([
4455
4455
  protectedProperty({ default: false })
4456
4456
  ], IndexBuffer.prototype, "dynamic");
4457
4457
 
4458
- var __defProp$J = Object.defineProperty;
4459
- var __decorateClass$J = (decorators, target, key, kind) => {
4458
+ var __defProp$K = Object.defineProperty;
4459
+ var __decorateClass$K = (decorators, target, key, kind) => {
4460
4460
  var result = undefined ;
4461
4461
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4462
4462
  if (decorator = decorators[i])
4463
4463
  result = (decorator(target, key, result) ) || result;
4464
- if (result) __defProp$J(target, key, result);
4464
+ if (result) __defProp$K(target, key, result);
4465
4465
  return result;
4466
4466
  };
4467
4467
  class VertexBuffer extends Resource {
@@ -4505,20 +4505,20 @@ class VertexBuffer extends Resource {
4505
4505
  return result;
4506
4506
  }
4507
4507
  }
4508
- __decorateClass$J([
4508
+ __decorateClass$K([
4509
4509
  protectedProperty({ default: null })
4510
4510
  ], VertexBuffer.prototype, "data");
4511
- __decorateClass$J([
4511
+ __decorateClass$K([
4512
4512
  protectedProperty({ default: false })
4513
4513
  ], VertexBuffer.prototype, "dynamic");
4514
4514
 
4515
- var __defProp$I = Object.defineProperty;
4516
- var __decorateClass$I = (decorators, target, key, kind) => {
4515
+ var __defProp$J = Object.defineProperty;
4516
+ var __decorateClass$J = (decorators, target, key, kind) => {
4517
4517
  var result = undefined ;
4518
4518
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4519
4519
  if (decorator = decorators[i])
4520
4520
  result = (decorator(target, key, result) ) || result;
4521
- if (result) __defProp$I(target, key, result);
4521
+ if (result) __defProp$J(target, key, result);
4522
4522
  return result;
4523
4523
  };
4524
4524
  class VertexAttribute extends Resource {
@@ -4555,25 +4555,25 @@ class VertexAttribute extends Resource {
4555
4555
  return result;
4556
4556
  }
4557
4557
  }
4558
- __decorateClass$I([
4558
+ __decorateClass$J([
4559
4559
  protectedProperty()
4560
4560
  ], VertexAttribute.prototype, "buffer");
4561
- __decorateClass$I([
4561
+ __decorateClass$J([
4562
4562
  protectedProperty({ default: 0 })
4563
4563
  ], VertexAttribute.prototype, "size");
4564
- __decorateClass$I([
4564
+ __decorateClass$J([
4565
4565
  protectedProperty({ default: false })
4566
4566
  ], VertexAttribute.prototype, "normalized");
4567
- __decorateClass$I([
4567
+ __decorateClass$J([
4568
4568
  protectedProperty({ default: "float" })
4569
4569
  ], VertexAttribute.prototype, "type");
4570
- __decorateClass$I([
4570
+ __decorateClass$J([
4571
4571
  protectedProperty()
4572
4572
  ], VertexAttribute.prototype, "stride");
4573
- __decorateClass$I([
4573
+ __decorateClass$J([
4574
4574
  protectedProperty()
4575
4575
  ], VertexAttribute.prototype, "offset");
4576
- __decorateClass$I([
4576
+ __decorateClass$J([
4577
4577
  protectedProperty()
4578
4578
  ], VertexAttribute.prototype, "divisor");
4579
4579
 
@@ -4823,13 +4823,13 @@ class UvGeometry extends Geometry {
4823
4823
  }
4824
4824
  }
4825
4825
 
4826
- var __defProp$H = Object.defineProperty;
4827
- var __decorateClass$H = (decorators, target, key, kind) => {
4826
+ var __defProp$I = Object.defineProperty;
4827
+ var __decorateClass$I = (decorators, target, key, kind) => {
4828
4828
  var result = undefined ;
4829
4829
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4830
4830
  if (decorator = decorators[i])
4831
4831
  result = (decorator(target, key, result) ) || result;
4832
- if (result) __defProp$H(target, key, result);
4832
+ if (result) __defProp$I(target, key, result);
4833
4833
  return result;
4834
4834
  };
4835
4835
  const style2DFilterDefault = {
@@ -5046,58 +5046,58 @@ class CanvasItemStyle extends Resource {
5046
5046
  return m;
5047
5047
  }
5048
5048
  }
5049
- __decorateClass$H([
5049
+ __decorateClass$I([
5050
5050
  property({ default: "none" })
5051
5051
  ], CanvasItemStyle.prototype, "backgroundColor");
5052
- __decorateClass$H([
5052
+ __decorateClass$I([
5053
5053
  property({ default: "none" })
5054
5054
  ], CanvasItemStyle.prototype, "backgroundImage");
5055
- __decorateClass$H([
5055
+ __decorateClass$I([
5056
5056
  property({ default: "none" })
5057
5057
  ], CanvasItemStyle.prototype, "filter");
5058
- __decorateClass$H([
5058
+ __decorateClass$I([
5059
5059
  property({ default: "inherit" })
5060
5060
  ], CanvasItemStyle.prototype, "direction");
5061
- __decorateClass$H([
5061
+ __decorateClass$I([
5062
5062
  property({ default: "none" })
5063
5063
  ], CanvasItemStyle.prototype, "boxShadow");
5064
- __decorateClass$H([
5064
+ __decorateClass$I([
5065
5065
  property({ default: "none" })
5066
5066
  ], CanvasItemStyle.prototype, "maskImage");
5067
- __decorateClass$H([
5067
+ __decorateClass$I([
5068
5068
  property({ default: 1 })
5069
5069
  ], CanvasItemStyle.prototype, "opacity");
5070
- __decorateClass$H([
5070
+ __decorateClass$I([
5071
5071
  property({ default: 0 })
5072
5072
  ], CanvasItemStyle.prototype, "borderWidth");
5073
- __decorateClass$H([
5073
+ __decorateClass$I([
5074
5074
  property({ default: 0 })
5075
5075
  ], CanvasItemStyle.prototype, "borderRadius");
5076
- __decorateClass$H([
5076
+ __decorateClass$I([
5077
5077
  property({ default: "#000000" })
5078
5078
  ], CanvasItemStyle.prototype, "borderColor");
5079
- __decorateClass$H([
5079
+ __decorateClass$I([
5080
5080
  property({ default: "none" })
5081
5081
  ], CanvasItemStyle.prototype, "borderStyle");
5082
- __decorateClass$H([
5082
+ __decorateClass$I([
5083
5083
  property({ default: 0 })
5084
5084
  ], CanvasItemStyle.prototype, "outlineWidth");
5085
- __decorateClass$H([
5085
+ __decorateClass$I([
5086
5086
  property({ default: 0 })
5087
5087
  ], CanvasItemStyle.prototype, "outlineOffset");
5088
- __decorateClass$H([
5088
+ __decorateClass$I([
5089
5089
  property({ default: "#000000" })
5090
5090
  ], CanvasItemStyle.prototype, "outlineColor");
5091
- __decorateClass$H([
5091
+ __decorateClass$I([
5092
5092
  property({ default: "none" })
5093
5093
  ], CanvasItemStyle.prototype, "outlineStyle");
5094
- __decorateClass$H([
5094
+ __decorateClass$I([
5095
5095
  property({ default: "visible" })
5096
5096
  ], CanvasItemStyle.prototype, "visibility");
5097
- __decorateClass$H([
5097
+ __decorateClass$I([
5098
5098
  property({ default: "visible" })
5099
5099
  ], CanvasItemStyle.prototype, "overflow");
5100
- __decorateClass$H([
5100
+ __decorateClass$I([
5101
5101
  property({ default: "auto" })
5102
5102
  ], CanvasItemStyle.prototype, "pointerEvents");
5103
5103
  const transformStyle = modernIdoc.getDefaultTransformStyle();
@@ -5109,13 +5109,13 @@ for (const key in textStyle) {
5109
5109
  defineProperty(CanvasItemStyle, key, { default: textStyle[key] });
5110
5110
  }
5111
5111
 
5112
- var __defProp$G = Object.defineProperty;
5113
- var __decorateClass$G = (decorators, target, key, kind) => {
5112
+ var __defProp$H = Object.defineProperty;
5113
+ var __decorateClass$H = (decorators, target, key, kind) => {
5114
5114
  var result = undefined ;
5115
5115
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5116
5116
  if (decorator = decorators[i])
5117
5117
  result = (decorator(target, key, result) ) || result;
5118
- if (result) __defProp$G(target, key, result);
5118
+ if (result) __defProp$H(target, key, result);
5119
5119
  return result;
5120
5120
  };
5121
5121
  class Texture2D extends Resource {
@@ -5241,32 +5241,32 @@ class Texture2D extends Resource {
5241
5241
  }
5242
5242
  }
5243
5243
  }
5244
- __decorateClass$G([
5244
+ __decorateClass$H([
5245
5245
  protectedProperty()
5246
5246
  ], Texture2D.prototype, "source");
5247
- __decorateClass$G([
5247
+ __decorateClass$H([
5248
5248
  property({ default: 0 })
5249
5249
  ], Texture2D.prototype, "width");
5250
- __decorateClass$G([
5250
+ __decorateClass$H([
5251
5251
  property({ default: 0 })
5252
5252
  ], Texture2D.prototype, "height");
5253
- __decorateClass$G([
5253
+ __decorateClass$H([
5254
5254
  property({ default: "linear" })
5255
5255
  ], Texture2D.prototype, "filterMode");
5256
- __decorateClass$G([
5256
+ __decorateClass$H([
5257
5257
  property({ default: "clamp_to_edge" })
5258
5258
  ], Texture2D.prototype, "wrapMode");
5259
- __decorateClass$G([
5259
+ __decorateClass$H([
5260
5260
  property({ default: 1 })
5261
5261
  ], Texture2D.prototype, "pixelRatio");
5262
5262
 
5263
- var __defProp$F = Object.defineProperty;
5264
- var __decorateClass$F = (decorators, target, key, kind) => {
5263
+ var __defProp$G = Object.defineProperty;
5264
+ var __decorateClass$G = (decorators, target, key, kind) => {
5265
5265
  var result = undefined ;
5266
5266
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5267
5267
  if (decorator = decorators[i])
5268
5268
  result = (decorator(target, key, result) ) || result;
5269
- if (result) __defProp$F(target, key, result);
5269
+ if (result) __defProp$G(target, key, result);
5270
5270
  return result;
5271
5271
  };
5272
5272
  class CanvasTexture extends Texture2D {
@@ -5285,7 +5285,7 @@ class CanvasTexture extends Texture2D {
5285
5285
  super._updateProperty(key, value, oldValue, declaration);
5286
5286
  }
5287
5287
  }
5288
- __decorateClass$F([
5288
+ __decorateClass$G([
5289
5289
  property({ default: 2 })
5290
5290
  ], CanvasTexture.prototype, "pixelRatio");
5291
5291
 
@@ -5443,13 +5443,13 @@ class PixelsTexture extends Texture2D {
5443
5443
  }
5444
5444
  }
5445
5445
 
5446
- var __defProp$E = Object.defineProperty;
5447
- var __decorateClass$E = (decorators, target, key, kind) => {
5446
+ var __defProp$F = Object.defineProperty;
5447
+ var __decorateClass$F = (decorators, target, key, kind) => {
5448
5448
  var result = undefined ;
5449
5449
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5450
5450
  if (decorator = decorators[i])
5451
5451
  result = (decorator(target, key, result) ) || result;
5452
- if (result) __defProp$E(target, key, result);
5452
+ if (result) __defProp$F(target, key, result);
5453
5453
  return result;
5454
5454
  };
5455
5455
  function resolveOptions(options) {
@@ -5693,10 +5693,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5693
5693
  }
5694
5694
  }
5695
5695
  };
5696
- __decorateClass$E([
5696
+ __decorateClass$F([
5697
5697
  protectedProperty({ default: true })
5698
5698
  ], _VideoTexture.prototype, "autoUpdate");
5699
- __decorateClass$E([
5699
+ __decorateClass$F([
5700
5700
  protectedProperty({ default: 0 })
5701
5701
  ], _VideoTexture.prototype, "fps");
5702
5702
  let VideoTexture = _VideoTexture;
@@ -5866,14 +5866,14 @@ class CanvasContext extends modernPath2d.Path2D {
5866
5866
  }
5867
5867
  }
5868
5868
 
5869
- var __defProp$D = Object.defineProperty;
5870
- var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
5871
- var __decorateClass$D = (decorators, target, key, kind) => {
5872
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$C(target, key) : target;
5869
+ var __defProp$E = Object.defineProperty;
5870
+ var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
5871
+ var __decorateClass$E = (decorators, target, key, kind) => {
5872
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$D(target, key) : target;
5873
5873
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5874
5874
  if (decorator = decorators[i])
5875
5875
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5876
- if (kind && result) __defProp$D(target, key, result);
5876
+ if (kind && result) __defProp$E(target, key, result);
5877
5877
  return result;
5878
5878
  };
5879
5879
  exports.Node = class Node extends CoreObject {
@@ -6016,9 +6016,9 @@ exports.Node = class Node extends CoreObject {
6016
6016
  case "inherit":
6017
6017
  return this._parent?.canProcess() ?? true;
6018
6018
  case "pausable":
6019
- return this._tree.paused;
6020
- case "when_paused":
6021
6019
  return !this._tree.paused;
6020
+ case "when_paused":
6021
+ return this._tree.paused;
6022
6022
  case "always":
6023
6023
  return true;
6024
6024
  case "disabled":
@@ -6298,33 +6298,33 @@ exports.Node = class Node extends CoreObject {
6298
6298
  return node;
6299
6299
  }
6300
6300
  };
6301
- __decorateClass$D([
6301
+ __decorateClass$E([
6302
6302
  property()
6303
6303
  ], exports.Node.prototype, "name", 2);
6304
- __decorateClass$D([
6304
+ __decorateClass$E([
6305
6305
  property()
6306
6306
  ], exports.Node.prototype, "mask", 2);
6307
- __decorateClass$D([
6307
+ __decorateClass$E([
6308
6308
  property({ default: "inherit" })
6309
6309
  ], exports.Node.prototype, "processMode", 2);
6310
- __decorateClass$D([
6310
+ __decorateClass$E([
6311
6311
  property({ default: "inherit" })
6312
6312
  ], exports.Node.prototype, "renderMode", 2);
6313
- __decorateClass$D([
6313
+ __decorateClass$E([
6314
6314
  property({ default: "default" })
6315
6315
  ], exports.Node.prototype, "internalMode", 2);
6316
- exports.Node = __decorateClass$D([
6316
+ exports.Node = __decorateClass$E([
6317
6317
  customNode("Node")
6318
6318
  ], exports.Node);
6319
6319
 
6320
- var __defProp$C = Object.defineProperty;
6321
- var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6322
- var __decorateClass$C = (decorators, target, key, kind) => {
6323
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$B(target, key) : target;
6320
+ var __defProp$D = Object.defineProperty;
6321
+ var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
6322
+ var __decorateClass$D = (decorators, target, key, kind) => {
6323
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$C(target, key) : target;
6324
6324
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6325
6325
  if (decorator = decorators[i])
6326
6326
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6327
- if (kind && result) __defProp$C(target, key, result);
6327
+ if (kind && result) __defProp$D(target, key, result);
6328
6328
  return result;
6329
6329
  };
6330
6330
  exports.TimelineNode = class TimelineNode extends exports.Node {
@@ -6383,76 +6383,235 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
6383
6383
  super._process(delta);
6384
6384
  }
6385
6385
  };
6386
- __decorateClass$C([
6386
+ __decorateClass$D([
6387
6387
  property({ default: 0 })
6388
6388
  ], exports.TimelineNode.prototype, "delay", 2);
6389
- __decorateClass$C([
6389
+ __decorateClass$D([
6390
6390
  property({ default: 0 })
6391
6391
  ], exports.TimelineNode.prototype, "duration", 2);
6392
- __decorateClass$C([
6392
+ __decorateClass$D([
6393
6393
  property({ default: false })
6394
6394
  ], exports.TimelineNode.prototype, "paused", 2);
6395
- exports.TimelineNode = __decorateClass$C([
6395
+ exports.TimelineNode = __decorateClass$D([
6396
6396
  customNode("TimelineNode")
6397
6397
  ], exports.TimelineNode);
6398
6398
 
6399
- var __defProp$B = Object.defineProperty;
6400
- var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6401
- var __decorateClass$B = (decorators, target, key, kind) => {
6402
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$A(target, key) : target;
6399
+ var __defProp$C = Object.defineProperty;
6400
+ var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6401
+ var __decorateClass$C = (decorators, target, key, kind) => {
6402
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$B(target, key) : target;
6403
6403
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6404
6404
  if (decorator = decorators[i])
6405
6405
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6406
- if (kind && result) __defProp$B(target, key, result);
6406
+ if (kind && result) __defProp$C(target, key, result);
6407
6407
  return result;
6408
6408
  };
6409
- exports.Effect = class Effect extends exports.TimelineNode {
6410
- material;
6411
- mode;
6412
- get _mode() {
6413
- return this.mode ?? "parent";
6414
- }
6415
- /** Viewports */
6416
- viewport1 = new exports.Viewport();
6417
- viewport2 = new exports.Viewport();
6418
- /** Render call */
6419
- _renderId = 0;
6420
- _renderViewport;
6421
- /** Temporary nodes for transition */
6422
- _previousSibling;
6423
- _nextSibling;
6424
- constructor(properties, children = []) {
6409
+ exports.Viewport = class Viewport extends exports.Node {
6410
+ constructor(flipY = false) {
6425
6411
  super();
6426
- this._onProcessing = this._onProcessing.bind(this);
6427
- this._onNodeProcessed = this._onNodeProcessed.bind(this);
6428
- this.setProperties(properties).append(children);
6412
+ this.flipY = flipY;
6413
+ this._projection.flipY(flipY);
6414
+ }
6415
+ get valid() {
6416
+ return Boolean(this.width && this.height);
6417
+ }
6418
+ _projection = new Projection2D();
6419
+ _framebufferIndex = 0;
6420
+ _framebuffers = [
6421
+ { texture: new ViewportTexture(), needsUpload: false },
6422
+ { texture: new ViewportTexture(), needsUpload: false }
6423
+ ];
6424
+ get framebuffer() {
6425
+ return this._framebuffers[this._framebufferIndex];
6426
+ }
6427
+ get texture() {
6428
+ return this.framebuffer.texture;
6429
+ }
6430
+ /** @internal */
6431
+ _glFramebufferOptions(renderer) {
6432
+ const { width, height } = this;
6433
+ const { pixelRatio } = renderer;
6434
+ this._framebuffers.forEach((framebuffer) => {
6435
+ const texture = framebuffer.texture;
6436
+ texture.pixelRatio = pixelRatio;
6437
+ texture.width = width;
6438
+ texture.height = height;
6439
+ texture.upload(renderer);
6440
+ });
6441
+ return {
6442
+ width,
6443
+ height,
6444
+ colorTextures: [this.texture._glTexture(renderer)]
6445
+ };
6446
+ }
6447
+ /** @internal */
6448
+ _glFramebuffer(renderer) {
6449
+ return renderer.getRelated(this.framebuffer, () => {
6450
+ return renderer.framebuffer.create(
6451
+ this._glFramebufferOptions(renderer)
6452
+ );
6453
+ });
6429
6454
  }
6430
6455
  _updateProperty(key, value, oldValue, declaration) {
6431
6456
  super._updateProperty(key, value, oldValue, declaration);
6432
6457
  switch (key) {
6433
- case "glsl": {
6434
- const material = new EffectMaterial(value);
6435
- if (!this.mode && material.has.transition) {
6436
- this.mode = "transition";
6437
- }
6438
- this.material = material;
6458
+ case "x":
6459
+ case "y":
6460
+ this.requestUpload();
6461
+ this._projection.translate(this.x, this.y);
6462
+ this.emit("updateRect");
6439
6463
  break;
6440
- }
6441
- case "glslSrc": {
6442
- if (value) {
6443
- assets.text.load(value).then((glsl) => this.glsl = glsl);
6444
- } else {
6445
- this.glsl = "";
6446
- }
6464
+ case "width":
6465
+ case "height":
6466
+ this.requestUpload();
6467
+ this._projection.resize(this.width, this.height);
6468
+ this.emit("updateRect");
6447
6469
  break;
6448
- }
6449
6470
  }
6450
6471
  }
6451
- _treeEnter(tree) {
6452
- tree.on("processing", this._onProcessing);
6453
- tree.on("nodeProcessed", this._onNodeProcessed);
6454
- this.viewport1.setTree(tree);
6455
- this.viewport2.setTree(tree);
6472
+ requestUpload() {
6473
+ this._framebuffers.forEach((framebuffer) => framebuffer.needsUpload = true);
6474
+ }
6475
+ resize(width, height) {
6476
+ this.width = width;
6477
+ this.height = height;
6478
+ }
6479
+ upload(renderer) {
6480
+ const framebuffer = this.framebuffer;
6481
+ if (framebuffer.needsUpload && this.valid) {
6482
+ framebuffer.needsUpload = false;
6483
+ renderer.framebuffer.update(
6484
+ this._glFramebuffer(renderer),
6485
+ this._glFramebufferOptions(renderer)
6486
+ );
6487
+ return true;
6488
+ }
6489
+ return false;
6490
+ }
6491
+ activate(renderer) {
6492
+ if (this.valid) {
6493
+ renderer.flush();
6494
+ this._tree?.setCurrentViewport(this);
6495
+ renderer.framebuffer.bind(this._glFramebuffer(renderer));
6496
+ this.upload(renderer);
6497
+ return true;
6498
+ }
6499
+ return false;
6500
+ }
6501
+ redraw(renderer, cb) {
6502
+ if (this.valid) {
6503
+ renderer.flush();
6504
+ const texture = this.framebuffer.texture;
6505
+ this._framebufferIndex = (this._framebufferIndex + 1) % this._framebuffers.length;
6506
+ this.activate(renderer);
6507
+ renderer.clear();
6508
+ texture.activate(renderer, 0);
6509
+ cb();
6510
+ return true;
6511
+ }
6512
+ return false;
6513
+ }
6514
+ activateWithCopy(renderer, target) {
6515
+ this.resize(target.width, target.height);
6516
+ if (this.activate(renderer)) {
6517
+ renderer.clear();
6518
+ target.texture.activate(renderer, 0);
6519
+ QuadUvGeometry.draw(renderer, UvMaterial.instance, {
6520
+ sampler: 0
6521
+ });
6522
+ }
6523
+ }
6524
+ render(renderer, next) {
6525
+ const oldViewport = this._tree?.getCurrentViewport();
6526
+ this.activate(renderer);
6527
+ renderer.clear();
6528
+ super.render(renderer, next);
6529
+ renderer.flush();
6530
+ if (oldViewport) {
6531
+ oldViewport.activate(renderer);
6532
+ } else {
6533
+ renderer.framebuffer.bind(null);
6534
+ this._tree?.setCurrentViewport(undefined);
6535
+ }
6536
+ }
6537
+ getRect() {
6538
+ return new Rect2(this.x, this.y, this.width, this.height);
6539
+ }
6540
+ toProjectionArray(transpose = false) {
6541
+ return this._projection.toArray(transpose);
6542
+ }
6543
+ };
6544
+ __decorateClass$C([
6545
+ property({ default: 0 })
6546
+ ], exports.Viewport.prototype, "x", 2);
6547
+ __decorateClass$C([
6548
+ property({ default: 0 })
6549
+ ], exports.Viewport.prototype, "y", 2);
6550
+ __decorateClass$C([
6551
+ property({ default: 0 })
6552
+ ], exports.Viewport.prototype, "width", 2);
6553
+ __decorateClass$C([
6554
+ property({ default: 0 })
6555
+ ], exports.Viewport.prototype, "height", 2);
6556
+ exports.Viewport = __decorateClass$C([
6557
+ customNode("Viewport")
6558
+ ], exports.Viewport);
6559
+
6560
+ var __defProp$B = Object.defineProperty;
6561
+ var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6562
+ var __decorateClass$B = (decorators, target, key, kind) => {
6563
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$A(target, key) : target;
6564
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6565
+ if (decorator = decorators[i])
6566
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6567
+ if (kind && result) __defProp$B(target, key, result);
6568
+ return result;
6569
+ };
6570
+ exports.Effect = class Effect extends exports.TimelineNode {
6571
+ get _effectMode() {
6572
+ return this.effectMode ?? "parent";
6573
+ }
6574
+ /** Viewports */
6575
+ viewport1 = new exports.Viewport();
6576
+ viewport2 = new exports.Viewport();
6577
+ /** Render call */
6578
+ _renderId = 0;
6579
+ _renderViewport;
6580
+ /** Temporary nodes for transition */
6581
+ _previousSibling;
6582
+ _nextSibling;
6583
+ constructor(properties, children = []) {
6584
+ super();
6585
+ this._onProcessing = this._onProcessing.bind(this);
6586
+ this._onNodeProcessed = this._onNodeProcessed.bind(this);
6587
+ this.setProperties(properties).append(children);
6588
+ }
6589
+ _updateProperty(key, value, oldValue, declaration) {
6590
+ super._updateProperty(key, value, oldValue, declaration);
6591
+ switch (key) {
6592
+ case "glsl": {
6593
+ const material = new EffectMaterial(value);
6594
+ if (!this.effectMode && material.has.transition) {
6595
+ this.effectMode = "transition";
6596
+ }
6597
+ this.material = material;
6598
+ break;
6599
+ }
6600
+ case "glslSrc": {
6601
+ if (value) {
6602
+ assets.text.load(value).then((glsl) => this.glsl = glsl);
6603
+ } else {
6604
+ this.glsl = "";
6605
+ }
6606
+ break;
6607
+ }
6608
+ }
6609
+ }
6610
+ _treeEnter(tree) {
6611
+ tree.on("processing", this._onProcessing);
6612
+ tree.on("nodeProcessed", this._onNodeProcessed);
6613
+ this.viewport1.setTree(tree);
6614
+ this.viewport2.setTree(tree);
6456
6615
  }
6457
6616
  _treeExit(oldTree) {
6458
6617
  oldTree.off("processing", this._onProcessing);
@@ -6462,7 +6621,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6462
6621
  }
6463
6622
  _onProcessing() {
6464
6623
  this._updateCurrentTime();
6465
- switch (this._mode) {
6624
+ switch (this._effectMode) {
6466
6625
  case "transition":
6467
6626
  this._previousSibling = this.previousSibling;
6468
6627
  this._nextSibling = this.nextSibling;
@@ -6479,7 +6638,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6479
6638
  const renderStack = this._tree?.renderStack;
6480
6639
  if (!renderStack)
6481
6640
  return;
6482
- switch (this._mode) {
6641
+ switch (this._effectMode) {
6483
6642
  case "transition":
6484
6643
  if (node.is(this._previousSibling)) {
6485
6644
  this._previousSibling = undefined;
@@ -6519,8 +6678,10 @@ exports.Effect = class Effect extends exports.TimelineNode {
6519
6678
  }
6520
6679
  }
6521
6680
  _onProcess(delta = 0) {
6681
+ if (!this.canProcess())
6682
+ return;
6522
6683
  this._renderId = 0;
6523
- switch (this._mode) {
6684
+ switch (this._effectMode) {
6524
6685
  case "before":
6525
6686
  super._onProcess(delta);
6526
6687
  break;
@@ -6579,7 +6740,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6579
6740
  this.viewport1.activate(renderer);
6580
6741
  this.apply(renderer, this.viewport1, {
6581
6742
  redraw: true,
6582
- target: this._mode === "parent" ? this._parent ?? undefined : undefined,
6743
+ target: this._effectMode === "parent" ? this._parent ?? undefined : undefined,
6583
6744
  targetArea: this._parseTargetArea()
6584
6745
  });
6585
6746
  oldViewport.activate(renderer);
@@ -6589,7 +6750,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6589
6750
  }
6590
6751
  }
6591
6752
  _parseTargetArea() {
6592
- if (this._mode === "parent" && this._parent && "getRect" in this._parent) {
6753
+ if (this._effectMode === "parent" && this._parent && "getRect" in this._parent) {
6593
6754
  const rect = this._parent.getRect();
6594
6755
  if (rect) {
6595
6756
  return [
@@ -6602,7 +6763,7 @@ exports.Effect = class Effect extends exports.TimelineNode {
6602
6763
  }
6603
6764
  }
6604
6765
  _render(renderer) {
6605
- switch (this._mode) {
6766
+ switch (this._effectMode) {
6606
6767
  case "before":
6607
6768
  this._renderBefore(renderer);
6608
6769
  break;
@@ -6645,7 +6806,7 @@ __decorateClass$B([
6645
6806
  ], exports.Effect.prototype, "material", 2);
6646
6807
  __decorateClass$B([
6647
6808
  property()
6648
- ], exports.Effect.prototype, "mode", 2);
6809
+ ], exports.Effect.prototype, "effectMode", 2);
6649
6810
  __decorateClass$B([
6650
6811
  property({ default: "" })
6651
6812
  ], exports.Effect.prototype, "glsl", 2);
@@ -7732,249 +7893,98 @@ var __decorateClass$r = (decorators, target, key, kind) => {
7732
7893
  return result;
7733
7894
  };
7734
7895
  var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
7735
- exports.KawaseEffect = class KawaseEffect extends exports.Effect {
7736
- blur = 10;
7737
- quality = 10;
7738
- apply(renderer, target) {
7739
- const currentTimeProgress = this.currentTimeProgress;
7740
- let sampler;
7741
- let progress;
7742
- if (currentTimeProgress < 0.5) {
7743
- sampler = 0;
7744
- progress = (0.5 - currentTimeProgress) / 0.5;
7745
- } else {
7746
- sampler = 1;
7747
- progress = (currentTimeProgress - 0.5) / 0.5;
7896
+ exports.MaskEffect = class MaskEffect extends exports.Effect {
7897
+ texture;
7898
+ constructor(properties, children = []) {
7899
+ super();
7900
+ this.setProperties(properties).append(children);
7901
+ }
7902
+ async load() {
7903
+ this.texture = undefined;
7904
+ if (this.src) {
7905
+ this.texture = await assets.texture.load(this.src);
7748
7906
  }
7749
- const blur = this.blur;
7750
- const quality = this.quality;
7751
- const width = target.width;
7752
- const height = target.height;
7753
- const drawCalls = [];
7754
- const kernels = [blur];
7755
- if (blur > 0) {
7756
- let k = blur;
7757
- const step = blur / quality;
7758
- for (let i = 1; i < quality; i++) {
7759
- k -= step;
7760
- kernels.push(k);
7761
- }
7907
+ }
7908
+ _updateProperty(key, value, oldValue, declaration) {
7909
+ super._updateProperty(key, value, oldValue, declaration);
7910
+ switch (key) {
7911
+ case "src":
7912
+ this.load();
7913
+ break;
7914
+ case "texture":
7915
+ oldValue?.destroy?.();
7916
+ break;
7762
7917
  }
7763
- const uvX = 1 / width;
7764
- const uvY = 1 / height;
7765
- const uOffset = [];
7766
- let offset;
7767
- const last = quality - 1;
7768
- for (let i = 0; i < last; i++) {
7769
- offset = kernels[i] + 0.5;
7770
- uOffset[0] = offset * uvX;
7771
- uOffset[1] = offset * uvY;
7772
- drawCalls.push({
7773
- offset: uOffset
7918
+ }
7919
+ apply(renderer, source, context) {
7920
+ if (this.texture && context.targetArea) {
7921
+ source.redraw(renderer, () => {
7922
+ this.texture.activate(renderer, 1);
7923
+ QuadUvGeometry.draw(renderer, exports.MaskEffect.material, {
7924
+ sampler: 0,
7925
+ mask: 1,
7926
+ area: context.targetArea
7927
+ });
7928
+ renderer.texture.unbind(1);
7774
7929
  });
7775
7930
  }
7776
- offset = kernels[last] + 0.5;
7777
- uOffset[0] = offset * uvX;
7778
- uOffset[1] = offset * uvY;
7779
- drawCalls.push({
7780
- offset: uOffset
7781
- });
7782
- drawCalls.forEach((uniforms) => {
7783
- QuadUvGeometry.draw(renderer, exports.KawaseEffect.material, {
7784
- sampler,
7785
- progress,
7786
- ...uniforms
7787
- });
7788
- });
7789
7931
  }
7790
7932
  };
7791
- __publicField$8(exports.KawaseEffect, "material", new Material({
7792
- vert: `attribute vec2 position;
7933
+ __publicField$8(exports.MaskEffect, "material", new Material({
7934
+ vert: `precision mediump float;
7935
+ attribute vec2 position;
7793
7936
  attribute vec2 uv;
7794
7937
  varying vec2 vUv;
7795
7938
  void main() {
7796
7939
  gl_Position = vec4(position, 0.0, 1.0);
7797
7940
  vUv = uv;
7798
7941
  }`,
7799
- frag: `precision highp float;
7800
- varying vec2 vUv;
7942
+ frag: `varying vec2 vUv;
7801
7943
  uniform sampler2D sampler;
7802
- uniform vec2 offset;
7803
- uniform float progress;
7944
+ uniform sampler2D mask;
7945
+ uniform float area[4];
7804
7946
 
7805
7947
  void main(void) {
7806
- vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);
7807
- vec4 color = vec4(0.0);
7808
- color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));
7809
- color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));
7810
- color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y - offset1.y));
7811
- color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y - offset1.y));
7812
- color *= 0.25;
7813
- gl_FragColor = color;
7948
+ if (
7949
+ vUv.x > area[0]
7950
+ && vUv.x < (area[0] + area[2])
7951
+ && (1.0 - vUv.y) > area[1]
7952
+ && (1.0 - vUv.y) < (area[1] + area[3])
7953
+ ) {
7954
+ vec4 color = texture2D(sampler, vUv);
7955
+ vec2 uv = vec2(
7956
+ (vUv.x - area[0]) / area[2],
7957
+ ((1.0 - vUv.y) - area[1]) / area[3]
7958
+ );
7959
+ vec4 maskColor = texture2D(mask, uv);
7960
+ gl_FragColor = mix(vec4(0.), color, maskColor.a);
7961
+ } else {
7962
+ gl_FragColor = vec4(0.);
7963
+ }
7814
7964
  }`
7815
7965
  }));
7816
- exports.KawaseEffect = __decorateClass$r([
7817
- customNode("KawaseEffect")
7818
- ], exports.KawaseEffect);
7819
-
7820
- var __defProp$q = Object.defineProperty;
7821
- var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
7822
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7823
- var __decorateClass$q = (decorators, target, key, kind) => {
7824
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$p(target, key) : target;
7825
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
7826
- if (decorator = decorators[i])
7827
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7828
- if (kind && result) __defProp$q(target, key, result);
7829
- return result;
7830
- };
7831
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
7832
- exports.LeftEraseEffect = class LeftEraseEffect extends exports.Effect {
7833
- apply(renderer) {
7834
- QuadUvGeometry.draw(renderer, exports.LeftEraseEffect.material, {
7835
- previous: 0,
7836
- next: 1,
7837
- progress: this.currentTimeProgress
7838
- });
7839
- }
7840
- };
7841
- __publicField$7(exports.LeftEraseEffect, "material", new Material({
7842
- vert: `attribute vec2 position;
7843
- attribute vec2 uv;
7844
- varying vec2 vUv;
7845
- void main() {
7846
- gl_Position = vec4(position, 0.0, 1.0);
7847
- vUv = uv;
7848
- }`,
7849
- frag: `precision highp float;
7850
- varying vec2 vUv;
7851
- uniform float progress;
7852
- uniform sampler2D previous;
7853
- uniform sampler2D next;
7854
-
7855
- float easeInOutQuint(float t) {
7856
- return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;
7857
- }
7858
-
7859
- void main() {
7860
- vec4 src1Color = texture2D(previous, vUv);
7861
- vec4 src2Color = texture2D(next, vUv);
7862
- float mProgress = 1.0 - progress;
7863
- float mixPercent = 0.0;
7864
- if (vUv.x <= mProgress) {
7865
- mixPercent = 1.0;
7866
- }
7867
- gl_FragColor = mix(src2Color, src1Color, mixPercent);
7868
- }`
7869
- }));
7870
- exports.LeftEraseEffect = __decorateClass$q([
7871
- customNode("LeftEraseEffect")
7872
- ], exports.LeftEraseEffect);
7873
-
7874
- var __defProp$p = Object.defineProperty;
7875
- var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
7876
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7877
- var __decorateClass$p = (decorators, target, key, kind) => {
7878
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$o(target, key) : target;
7879
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
7880
- if (decorator = decorators[i])
7881
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7882
- if (kind && result) __defProp$p(target, key, result);
7883
- return result;
7884
- };
7885
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
7886
- exports.MaskEffect = class MaskEffect extends exports.Effect {
7887
- texture;
7888
- constructor(properties, children = []) {
7889
- super();
7890
- this.setProperties(properties).append(children);
7891
- }
7892
- async load() {
7893
- this.texture = undefined;
7894
- if (this.src) {
7895
- this.texture = await assets.texture.load(this.src);
7896
- }
7897
- }
7898
- _updateProperty(key, value, oldValue, declaration) {
7899
- super._updateProperty(key, value, oldValue, declaration);
7900
- switch (key) {
7901
- case "src":
7902
- this.load();
7903
- break;
7904
- case "texture":
7905
- oldValue?.destroy?.();
7906
- break;
7907
- }
7908
- }
7909
- apply(renderer, source, context) {
7910
- if (this.texture && context.targetArea) {
7911
- source.redraw(renderer, () => {
7912
- this.texture.activate(renderer, 1);
7913
- QuadUvGeometry.draw(renderer, exports.MaskEffect.material, {
7914
- sampler: 0,
7915
- mask: 1,
7916
- area: context.targetArea
7917
- });
7918
- renderer.texture.unbind(1);
7919
- });
7920
- }
7921
- }
7922
- };
7923
- __publicField$6(exports.MaskEffect, "material", new Material({
7924
- vert: `precision mediump float;
7925
- attribute vec2 position;
7926
- attribute vec2 uv;
7927
- varying vec2 vUv;
7928
- void main() {
7929
- gl_Position = vec4(position, 0.0, 1.0);
7930
- vUv = uv;
7931
- }`,
7932
- frag: `varying vec2 vUv;
7933
- uniform sampler2D sampler;
7934
- uniform sampler2D mask;
7935
- uniform float area[4];
7936
-
7937
- void main(void) {
7938
- if (
7939
- vUv.x > area[0]
7940
- && vUv.x < (area[0] + area[2])
7941
- && (1.0 - vUv.y) > area[1]
7942
- && (1.0 - vUv.y) < (area[1] + area[3])
7943
- ) {
7944
- vec4 color = texture2D(sampler, vUv);
7945
- vec2 uv = vec2(
7946
- (vUv.x - area[0]) / area[2],
7947
- ((1.0 - vUv.y) - area[1]) / area[3]
7948
- );
7949
- vec4 maskColor = texture2D(mask, uv);
7950
- gl_FragColor = mix(vec4(0.), color, maskColor.a);
7951
- } else {
7952
- gl_FragColor = vec4(0.);
7953
- }
7954
- }`
7955
- }));
7956
- __decorateClass$p([
7966
+ __decorateClass$r([
7957
7967
  protectedProperty()
7958
7968
  ], exports.MaskEffect.prototype, "texture", 2);
7959
- __decorateClass$p([
7969
+ __decorateClass$r([
7960
7970
  property({ default: "" })
7961
7971
  ], exports.MaskEffect.prototype, "src", 2);
7962
- exports.MaskEffect = __decorateClass$p([
7972
+ exports.MaskEffect = __decorateClass$r([
7963
7973
  customNode("MaskEffect")
7964
7974
  ], exports.MaskEffect);
7965
7975
 
7966
- var __defProp$o = Object.defineProperty;
7967
- var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
7968
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7969
- var __decorateClass$o = (decorators, target, key, kind) => {
7970
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$n(target, key) : target;
7976
+ var __defProp$q = Object.defineProperty;
7977
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
7978
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7979
+ var __decorateClass$q = (decorators, target, key, kind) => {
7980
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$p(target, key) : target;
7971
7981
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7972
7982
  if (decorator = decorators[i])
7973
7983
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7974
- if (kind && result) __defProp$o(target, key, result);
7984
+ if (kind && result) __defProp$q(target, key, result);
7975
7985
  return result;
7976
7986
  };
7977
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
7987
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
7978
7988
  exports.PixelateEffect = class PixelateEffect extends exports.Effect {
7979
7989
  size;
7980
7990
  constructor(size = 10) {
@@ -7991,7 +8001,7 @@ exports.PixelateEffect = class PixelateEffect extends exports.Effect {
7991
8001
  });
7992
8002
  }
7993
8003
  };
7994
- __publicField$5(exports.PixelateEffect, "material", new Material({
8004
+ __publicField$7(exports.PixelateEffect, "material", new Material({
7995
8005
  vert: `precision mediump float;
7996
8006
  attribute vec2 position;
7997
8007
  attribute vec2 uv;
@@ -8028,25 +8038,25 @@ void main(void) {
8028
8038
  gl_FragColor = texture2D(sampler, coord);
8029
8039
  }`
8030
8040
  }));
8031
- __decorateClass$o([
8041
+ __decorateClass$q([
8032
8042
  property()
8033
8043
  ], exports.PixelateEffect.prototype, "size", 2);
8034
- exports.PixelateEffect = __decorateClass$o([
8044
+ exports.PixelateEffect = __decorateClass$q([
8035
8045
  customNode("PixelateEffect")
8036
8046
  ], exports.PixelateEffect);
8037
8047
 
8038
- var __defProp$n = Object.defineProperty;
8039
- var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8040
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8041
- var __decorateClass$n = (decorators, target, key, kind) => {
8042
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$m(target, key) : target;
8048
+ var __defProp$p = Object.defineProperty;
8049
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8050
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8051
+ var __decorateClass$p = (decorators, target, key, kind) => {
8052
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$o(target, key) : target;
8043
8053
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8044
8054
  if (decorator = decorators[i])
8045
8055
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8046
- if (kind && result) __defProp$n(target, key, result);
8056
+ if (kind && result) __defProp$p(target, key, result);
8047
8057
  return result;
8048
8058
  };
8049
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
8059
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
8050
8060
  exports.ShadowEffect = class ShadowEffect extends exports.Effect {
8051
8061
  blur = new exports.BlurEffect();
8052
8062
  viewport3 = new exports.Viewport();
@@ -8073,7 +8083,7 @@ exports.ShadowEffect = class ShadowEffect extends exports.Effect {
8073
8083
  });
8074
8084
  }
8075
8085
  };
8076
- __publicField$4(exports.ShadowEffect, "material", new Material({
8086
+ __publicField$6(exports.ShadowEffect, "material", new Material({
8077
8087
  vert: `precision mediump float;
8078
8088
  attribute vec2 position;
8079
8089
  attribute vec2 uv;
@@ -8096,67 +8106,41 @@ void main(void) {
8096
8106
  gl_FragColor = sample;
8097
8107
  }`
8098
8108
  }));
8099
- exports.ShadowEffect = __decorateClass$n([
8109
+ exports.ShadowEffect = __decorateClass$p([
8100
8110
  customNode("ShadowEffect")
8101
8111
  ], exports.ShadowEffect);
8102
8112
 
8103
- var __defProp$m = Object.defineProperty;
8104
- var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8105
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8106
- var __decorateClass$m = (decorators, target, key, kind) => {
8107
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$l(target, key) : target;
8113
+ var __defProp$o = Object.defineProperty;
8114
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8115
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8116
+ var __decorateClass$o = (decorators, target, key, kind) => {
8117
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$n(target, key) : target;
8108
8118
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8109
8119
  if (decorator = decorators[i])
8110
8120
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8111
- if (kind && result) __defProp$m(target, key, result);
8121
+ if (kind && result) __defProp$o(target, key, result);
8112
8122
  return result;
8113
8123
  };
8114
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
8115
- exports.TiltShiftEffect = class TiltShiftEffect extends exports.Effect {
8116
- blur = 100;
8117
- gradientBlur = 600;
8118
- apply(renderer, target) {
8119
- const currentTimeProgress = this.currentTimeProgress;
8120
- let sampler;
8121
- let progress;
8122
- if (currentTimeProgress < 0.5) {
8123
- sampler = 0;
8124
- progress = (0.5 - currentTimeProgress) / 0.5;
8125
- } else {
8126
- sampler = 1;
8127
- progress = (currentTimeProgress - 0.5) / 0.5;
8128
- }
8129
- const width = target.width;
8130
- const height = target.height;
8131
- const start = [0, height / 2];
8132
- const end = [600, height / 2];
8133
- const texSize = [width, height];
8134
- const dx = end[0] - start[0];
8135
- const dy = end[1] - start[1];
8136
- const d = Math.sqrt(dx * dx + dy * dy);
8137
- QuadUvGeometry.draw(renderer, exports.TiltShiftEffect.material, {
8138
- sampler,
8139
- progress,
8140
- blur: this.blur,
8141
- gradientBlur: this.gradientBlur,
8142
- start,
8143
- end,
8144
- delta: [dx / d, dy / d],
8145
- texSize
8146
- });
8147
- QuadUvGeometry.draw(renderer, exports.TiltShiftEffect.material, {
8148
- sampler,
8149
- progress,
8150
- blur: this.blur,
8151
- gradientBlur: this.gradientBlur,
8152
- start,
8153
- end,
8154
- delta: [-dy / d, dx / d],
8155
- texSize
8124
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
8125
+ exports.ZoomBlurEffect = class ZoomBlurEffect extends exports.Effect {
8126
+ center;
8127
+ innerRadius = 20;
8128
+ radius = -1;
8129
+ strength = 0.1;
8130
+ apply(renderer, source) {
8131
+ source.redraw(renderer, () => {
8132
+ QuadUvGeometry.draw(renderer, exports.ZoomBlurEffect.material, {
8133
+ sampler: 0,
8134
+ center: this.center ?? [source.width / 2, source.height / 2],
8135
+ innerRadius: this.innerRadius,
8136
+ radius: this.radius,
8137
+ strength: this.strength,
8138
+ inputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
8139
+ });
8156
8140
  });
8157
8141
  }
8158
8142
  };
8159
- __publicField$3(exports.TiltShiftEffect, "material", new Material({
8143
+ __publicField$5(exports.ZoomBlurEffect, "material", new Material({
8160
8144
  vert: `attribute vec2 position;
8161
8145
  attribute vec2 uv;
8162
8146
  varying vec2 vUv;
@@ -8164,199 +8148,22 @@ void main() {
8164
8148
  gl_Position = vec4(position, 0.0, 1.0);
8165
8149
  vUv = uv;
8166
8150
  }`,
8167
- frag: `precision highp float;
8168
- varying vec2 vUv;
8151
+ frag: `varying vec2 vUv;
8169
8152
  uniform sampler2D sampler;
8170
- uniform float blur;
8171
- uniform float gradientBlur;
8172
- uniform vec2 start;
8173
- uniform vec2 end;
8174
- uniform vec2 delta;
8175
- uniform vec2 texSize;
8176
- uniform float progress;
8153
+ uniform vec4 inputSize;
8177
8154
 
8178
- float random(vec3 scale, float seed) {
8179
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
8180
- }
8155
+ uniform vec2 center;
8156
+ uniform float strength;
8157
+ uniform float innerRadius;
8158
+ uniform float radius;
8181
8159
 
8182
- void main(void) {
8183
- float blur1 = blur - progress * blur;
8184
- float gradientBlur1 = progress * gradientBlur;
8160
+ const float MAX_KERNEL_SIZE = 32.0;
8185
8161
 
8186
- vec4 color = vec4(0.0);
8187
- float total = 0.0;
8188
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
8189
- vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));
8190
- float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;
8191
-
8192
- for (float t = -30.0; t <= 30.0; t++) {
8193
- float percent = (t + offset - 0.5) / 30.0;
8194
- float weight = 1.0 - abs(percent);
8195
- vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);
8196
- sample1.rgb *= sample1.a;
8197
- color += sample1 * weight;
8198
- total += weight;
8199
- }
8200
-
8201
- color /= total;
8202
- color.rgb /= color.a + 0.00001;
8203
-
8204
- gl_FragColor = color;
8205
- }`
8206
- }));
8207
- exports.TiltShiftEffect = __decorateClass$m([
8208
- customNode("TiltShiftEffect")
8209
- ], exports.TiltShiftEffect);
8210
-
8211
- var __defProp$l = Object.defineProperty;
8212
- var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8213
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8214
- var __decorateClass$l = (decorators, target, key, kind) => {
8215
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$k(target, key) : target;
8216
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
8217
- if (decorator = decorators[i])
8218
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8219
- if (kind && result) __defProp$l(target, key, result);
8220
- return result;
8221
- };
8222
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
8223
- exports.TwistEffect = class TwistEffect extends exports.Effect {
8224
- radius;
8225
- angle = 4;
8226
- padding = 20;
8227
- offset;
8228
- apply(renderer, source) {
8229
- const currentTimeProgress = this.currentTimeProgress;
8230
- let sampler;
8231
- let progress;
8232
- if (currentTimeProgress < 0.5) {
8233
- sampler = 0;
8234
- progress = (0.5 - currentTimeProgress) / 0.5;
8235
- } else {
8236
- sampler = 1;
8237
- progress = (currentTimeProgress - 0.5) / 0.5;
8238
- }
8239
- const width = source.width;
8240
- const height = source.height;
8241
- QuadUvGeometry.draw(renderer, exports.TwistEffect.material, {
8242
- sampler,
8243
- progress,
8244
- filterArea: [width, height, 0, 0],
8245
- radius: this.radius ?? width,
8246
- angle: this.angle,
8247
- padding: this.padding,
8248
- offset: this.offset ?? [width / 2, height / 2]
8249
- });
8250
- }
8251
- };
8252
- __publicField$2(exports.TwistEffect, "material", new Material({
8253
- vert: `attribute vec2 position;
8254
- attribute vec2 uv;
8255
- varying vec2 vUv;
8256
- void main() {
8257
- gl_Position = vec4(position, 0.0, 1.0);
8258
- vUv = uv;
8259
- }`,
8260
- frag: `precision highp float;
8261
- varying vec2 vUv;
8262
- uniform sampler2D sampler;
8263
- uniform float radius;
8264
- uniform float angle;
8265
- uniform vec2 offset;
8266
- uniform vec4 filterArea;
8267
- uniform float progress;
8268
-
8269
- vec2 mapCoord(vec2 coord) {
8270
- coord -= filterArea.zw;
8271
- coord *= filterArea.xy;
8272
- return coord;
8273
- }
8274
-
8275
- vec2 unmapCoord(vec2 coord) {
8276
- coord -= filterArea.zw;
8277
- coord /= filterArea.xy;
8278
- return coord;
8279
- }
8280
-
8281
- vec2 twist(vec2 coord, float radius) {
8282
- coord -= offset;
8283
- float dist = length(coord);
8284
- if (dist < radius) {
8285
- float ratioDist = (radius - dist) / radius;
8286
- float angleMod = ratioDist * ratioDist * angle;
8287
- float s = sin(angleMod);
8288
- float c = cos(angleMod);
8289
- coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);
8290
- }
8291
- coord += offset;
8292
- return coord;
8293
- }
8294
-
8295
- void main(void) {
8296
- vec2 coord = mapCoord(vUv);
8297
- coord = twist(coord, radius - (progress * radius));
8298
- coord = unmapCoord(coord);
8299
- gl_FragColor = texture2D(sampler, coord);
8300
- }`
8301
- }));
8302
- exports.TwistEffect = __decorateClass$l([
8303
- customNode("TwistEffect")
8304
- ], exports.TwistEffect);
8305
-
8306
- var __defProp$k = Object.defineProperty;
8307
- var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8308
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8309
- var __decorateClass$k = (decorators, target, key, kind) => {
8310
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$j(target, key) : target;
8311
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
8312
- if (decorator = decorators[i])
8313
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8314
- if (kind && result) __defProp$k(target, key, result);
8315
- return result;
8316
- };
8317
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
8318
- exports.ZoomBlurEffect = class ZoomBlurEffect extends exports.Effect {
8319
- center;
8320
- innerRadius = 20;
8321
- radius = -1;
8322
- strength = 0.1;
8323
- apply(renderer, source) {
8324
- source.redraw(renderer, () => {
8325
- QuadUvGeometry.draw(renderer, exports.ZoomBlurEffect.material, {
8326
- sampler: 0,
8327
- center: this.center ?? [source.width / 2, source.height / 2],
8328
- innerRadius: this.innerRadius,
8329
- radius: this.radius,
8330
- strength: this.strength,
8331
- inputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
8332
- });
8333
- });
8334
- }
8335
- };
8336
- __publicField$1(exports.ZoomBlurEffect, "material", new Material({
8337
- vert: `attribute vec2 position;
8338
- attribute vec2 uv;
8339
- varying vec2 vUv;
8340
- void main() {
8341
- gl_Position = vec4(position, 0.0, 1.0);
8342
- vUv = uv;
8343
- }`,
8344
- frag: `varying vec2 vUv;
8345
- uniform sampler2D sampler;
8346
- uniform vec4 inputSize;
8347
-
8348
- uniform vec2 center;
8349
- uniform float strength;
8350
- uniform float innerRadius;
8351
- uniform float radius;
8352
-
8353
- const float MAX_KERNEL_SIZE = 32.0;
8354
-
8355
- highp float rand(vec2 co, float seed) {
8356
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
8357
- highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);
8358
- return fract(sin(sn) * c + seed);
8359
- }
8162
+ highp float rand(vec2 co, float seed) {
8163
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
8164
+ highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);
8165
+ return fract(sin(sn) * c + seed);
8166
+ }
8360
8167
 
8361
8168
  void main() {
8362
8169
  float minGradient = innerRadius * 0.3;
@@ -8417,30 +8224,30 @@ void main() {
8417
8224
  gl_FragColor = color;
8418
8225
  }`
8419
8226
  }));
8420
- __decorateClass$k([
8227
+ __decorateClass$o([
8421
8228
  property()
8422
8229
  ], exports.ZoomBlurEffect.prototype, "center", 2);
8423
- __decorateClass$k([
8230
+ __decorateClass$o([
8424
8231
  property()
8425
8232
  ], exports.ZoomBlurEffect.prototype, "innerRadius", 2);
8426
- __decorateClass$k([
8233
+ __decorateClass$o([
8427
8234
  property()
8428
8235
  ], exports.ZoomBlurEffect.prototype, "radius", 2);
8429
- __decorateClass$k([
8236
+ __decorateClass$o([
8430
8237
  property()
8431
8238
  ], exports.ZoomBlurEffect.prototype, "strength", 2);
8432
- exports.ZoomBlurEffect = __decorateClass$k([
8239
+ exports.ZoomBlurEffect = __decorateClass$o([
8433
8240
  customNode("ZoomBlurEffect")
8434
8241
  ], exports.ZoomBlurEffect);
8435
8242
 
8436
- var __defProp$j = Object.defineProperty;
8437
- var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8438
- var __decorateClass$j = (decorators, target, key, kind) => {
8439
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$i(target, key) : target;
8243
+ var __defProp$n = Object.defineProperty;
8244
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8245
+ var __decorateClass$n = (decorators, target, key, kind) => {
8246
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$m(target, key) : target;
8440
8247
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8441
8248
  if (decorator = decorators[i])
8442
8249
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8443
- if (kind && result) __defProp$j(target, key, result);
8250
+ if (kind && result) __defProp$n(target, key, result);
8444
8251
  return result;
8445
8252
  };
8446
8253
  exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
@@ -8735,13 +8542,13 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
8735
8542
  };
8736
8543
  }
8737
8544
  };
8738
- __decorateClass$j([
8545
+ __decorateClass$n([
8739
8546
  property()
8740
8547
  ], exports.CanvasItem.prototype, "modulate", 2);
8741
- __decorateClass$j([
8548
+ __decorateClass$n([
8742
8549
  property()
8743
8550
  ], exports.CanvasItem.prototype, "blendMode", 2);
8744
- exports.CanvasItem = __decorateClass$j([
8551
+ exports.CanvasItem = __decorateClass$n([
8745
8552
  customNode("CanvasItem")
8746
8553
  ], exports.CanvasItem);
8747
8554
 
@@ -8771,14 +8578,14 @@ class RenderStack extends exports.Node {
8771
8578
  }
8772
8579
  }
8773
8580
 
8774
- var __defProp$i = Object.defineProperty;
8775
- var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
8776
- var __decorateClass$i = (decorators, target, key, kind) => {
8777
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$h(target, key) : target;
8581
+ var __defProp$m = Object.defineProperty;
8582
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8583
+ var __decorateClass$m = (decorators, target, key, kind) => {
8584
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$l(target, key) : target;
8778
8585
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8779
8586
  if (decorator = decorators[i])
8780
8587
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8781
- if (kind && result) __defProp$i(target, key, result);
8588
+ if (kind && result) __defProp$m(target, key, result);
8782
8589
  return result;
8783
8590
  };
8784
8591
  exports.Timeline = class Timeline extends exports.Node {
@@ -8823,213 +8630,52 @@ exports.Timeline = class Timeline extends exports.Node {
8823
8630
  this.addTime(delta);
8824
8631
  }
8825
8632
  };
8826
- __decorateClass$i([
8633
+ __decorateClass$m([
8827
8634
  property({ default: 0 })
8828
8635
  ], exports.Timeline.prototype, "startTime", 2);
8829
- __decorateClass$i([
8636
+ __decorateClass$m([
8830
8637
  property({ default: 0 })
8831
8638
  ], exports.Timeline.prototype, "currentTime", 2);
8832
- __decorateClass$i([
8639
+ __decorateClass$m([
8833
8640
  property({ default: Number.MAX_SAFE_INTEGER })
8834
8641
  ], exports.Timeline.prototype, "endTime", 2);
8835
- __decorateClass$i([
8642
+ __decorateClass$m([
8836
8643
  property({ default: false })
8837
8644
  ], exports.Timeline.prototype, "loop", 2);
8838
- exports.Timeline = __decorateClass$i([
8645
+ exports.Timeline = __decorateClass$m([
8839
8646
  customNode("Timeline")
8840
8647
  ], exports.Timeline);
8841
8648
 
8842
- var __defProp$h = Object.defineProperty;
8843
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
8844
- var __decorateClass$h = (decorators, target, key, kind) => {
8845
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$g(target, key) : target;
8649
+ var __defProp$l = Object.defineProperty;
8650
+ var __decorateClass$l = (decorators, target, key, kind) => {
8651
+ var result = undefined ;
8846
8652
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8847
8653
  if (decorator = decorators[i])
8848
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8849
- if (kind && result) __defProp$h(target, key, result);
8654
+ result = (decorator(target, key, result) ) || result;
8655
+ if (result) __defProp$l(target, key, result);
8850
8656
  return result;
8851
8657
  };
8852
- exports.Viewport = class Viewport extends exports.Node {
8853
- constructor(flipY = false) {
8854
- super();
8855
- this.flipY = flipY;
8856
- this._projection.flipY(flipY);
8857
- }
8858
- get valid() {
8859
- return Boolean(this.width && this.height);
8860
- }
8861
- _projection = new Projection2D();
8862
- _framebufferIndex = 0;
8863
- _framebuffers = [
8864
- { texture: new ViewportTexture(), needsUpload: false },
8865
- { texture: new ViewportTexture(), needsUpload: false }
8866
- ];
8867
- get framebuffer() {
8868
- return this._framebuffers[this._framebufferIndex];
8869
- }
8870
- get texture() {
8871
- return this.framebuffer.texture;
8658
+ class SceneTree extends MainLoop {
8659
+ renderStack = new RenderStack();
8660
+ root = new exports.Viewport(true).setTree(this);
8661
+ timeline;
8662
+ _backgroundColor = new Color();
8663
+ _currentViewport;
8664
+ getCurrentViewport() {
8665
+ return this._currentViewport;
8872
8666
  }
8873
- /** @internal */
8874
- _glFramebufferOptions(renderer) {
8875
- const { width, height } = this;
8876
- const { pixelRatio } = renderer;
8877
- this._framebuffers.forEach((framebuffer) => {
8878
- const texture = framebuffer.texture;
8879
- texture.pixelRatio = pixelRatio;
8880
- texture.width = width;
8881
- texture.height = height;
8882
- texture.upload(renderer);
8883
- });
8884
- return {
8885
- width,
8886
- height,
8887
- colorTextures: [this.texture._glTexture(renderer)]
8888
- };
8667
+ setCurrentViewport(viewport) {
8668
+ this._currentViewport = viewport;
8889
8669
  }
8890
- /** @internal */
8891
- _glFramebuffer(renderer) {
8892
- return renderer.getRelated(this.framebuffer, () => {
8893
- return renderer.framebuffer.create(
8894
- this._glFramebufferOptions(renderer)
8895
- );
8896
- });
8670
+ constructor(timeline = new exports.Timeline()) {
8671
+ super();
8672
+ this.timeline = timeline.setTree(this);
8897
8673
  }
8898
8674
  _updateProperty(key, value, oldValue, declaration) {
8899
8675
  super._updateProperty(key, value, oldValue, declaration);
8900
8676
  switch (key) {
8901
- case "x":
8902
- case "y":
8903
- this.requestUpload();
8904
- this._projection.translate(this.x, this.y);
8905
- this.emit("updateRect");
8906
- break;
8907
- case "width":
8908
- case "height":
8909
- this.requestUpload();
8910
- this._projection.resize(this.width, this.height);
8911
- this.emit("updateRect");
8912
- break;
8913
- }
8914
- }
8915
- requestUpload() {
8916
- this._framebuffers.forEach((framebuffer) => framebuffer.needsUpload = true);
8917
- }
8918
- resize(width, height) {
8919
- this.width = width;
8920
- this.height = height;
8921
- }
8922
- upload(renderer) {
8923
- const framebuffer = this.framebuffer;
8924
- if (framebuffer.needsUpload && this.valid) {
8925
- framebuffer.needsUpload = false;
8926
- renderer.framebuffer.update(
8927
- this._glFramebuffer(renderer),
8928
- this._glFramebufferOptions(renderer)
8929
- );
8930
- return true;
8931
- }
8932
- return false;
8933
- }
8934
- activate(renderer) {
8935
- if (this.valid) {
8936
- renderer.flush();
8937
- this._tree?.setCurrentViewport(this);
8938
- renderer.framebuffer.bind(this._glFramebuffer(renderer));
8939
- this.upload(renderer);
8940
- return true;
8941
- }
8942
- return false;
8943
- }
8944
- redraw(renderer, cb) {
8945
- if (this.valid) {
8946
- renderer.flush();
8947
- const texture = this.framebuffer.texture;
8948
- this._framebufferIndex = (this._framebufferIndex + 1) % this._framebuffers.length;
8949
- this.activate(renderer);
8950
- renderer.clear();
8951
- texture.activate(renderer, 0);
8952
- cb();
8953
- return true;
8954
- }
8955
- return false;
8956
- }
8957
- activateWithCopy(renderer, target) {
8958
- this.resize(target.width, target.height);
8959
- if (this.activate(renderer)) {
8960
- renderer.clear();
8961
- target.texture.activate(renderer, 0);
8962
- QuadUvGeometry.draw(renderer, UvMaterial.instance, {
8963
- sampler: 0
8964
- });
8965
- }
8966
- }
8967
- render(renderer, next) {
8968
- const oldViewport = this._tree?.getCurrentViewport();
8969
- this.activate(renderer);
8970
- renderer.clear();
8971
- super.render(renderer, next);
8972
- renderer.flush();
8973
- if (oldViewport) {
8974
- oldViewport.activate(renderer);
8975
- } else {
8976
- renderer.framebuffer.bind(null);
8977
- this._tree?.setCurrentViewport(undefined);
8978
- }
8979
- }
8980
- getRect() {
8981
- return new Rect2(this.x, this.y, this.width, this.height);
8982
- }
8983
- toProjectionArray(transpose = false) {
8984
- return this._projection.toArray(transpose);
8985
- }
8986
- };
8987
- __decorateClass$h([
8988
- property({ default: 0 })
8989
- ], exports.Viewport.prototype, "x", 2);
8990
- __decorateClass$h([
8991
- property({ default: 0 })
8992
- ], exports.Viewport.prototype, "y", 2);
8993
- __decorateClass$h([
8994
- property({ default: 0 })
8995
- ], exports.Viewport.prototype, "width", 2);
8996
- __decorateClass$h([
8997
- property({ default: 0 })
8998
- ], exports.Viewport.prototype, "height", 2);
8999
- exports.Viewport = __decorateClass$h([
9000
- customNode("Viewport")
9001
- ], exports.Viewport);
9002
-
9003
- var __defProp$g = Object.defineProperty;
9004
- var __decorateClass$g = (decorators, target, key, kind) => {
9005
- var result = undefined ;
9006
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
9007
- if (decorator = decorators[i])
9008
- result = (decorator(target, key, result) ) || result;
9009
- if (result) __defProp$g(target, key, result);
9010
- return result;
9011
- };
9012
- class SceneTree extends MainLoop {
9013
- renderStack = new RenderStack();
9014
- root = new exports.Viewport(true).setTree(this);
9015
- timeline;
9016
- _backgroundColor = new Color();
9017
- _currentViewport;
9018
- getCurrentViewport() {
9019
- return this._currentViewport;
9020
- }
9021
- setCurrentViewport(viewport) {
9022
- this._currentViewport = viewport;
9023
- }
9024
- constructor(timeline = new exports.Timeline()) {
9025
- super();
9026
- this.timeline = timeline.setTree(this);
9027
- }
9028
- _updateProperty(key, value, oldValue, declaration) {
9029
- super._updateProperty(key, value, oldValue, declaration);
9030
- switch (key) {
9031
- case "backgroundColor":
9032
- this._backgroundColor.value = value;
8677
+ case "backgroundColor":
8678
+ this._backgroundColor.value = value;
9033
8679
  break;
9034
8680
  }
9035
8681
  }
@@ -9067,21 +8713,45 @@ class SceneTree extends MainLoop {
9067
8713
  renderer.texture.unbind(texture);
9068
8714
  }
9069
8715
  }
9070
- __decorateClass$g([
8716
+ __decorateClass$l([
9071
8717
  property({ default: false })
9072
8718
  ], SceneTree.prototype, "paused");
9073
- __decorateClass$g([
8719
+ __decorateClass$l([
9074
8720
  property()
9075
8721
  ], SceneTree.prototype, "backgroundColor");
9076
8722
 
9077
- var __defProp$f = Object.defineProperty;
9078
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9079
- var __decorateClass$f = (decorators, target, key, kind) => {
9080
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$f(target, key) : target;
8723
+ var __defProp$k = Object.defineProperty;
8724
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8725
+ var __decorateClass$k = (decorators, target, key, kind) => {
8726
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$k(target, key) : target;
9081
8727
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9082
8728
  if (decorator = decorators[i])
9083
8729
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9084
- if (kind && result) __defProp$f(target, key, result);
8730
+ if (kind && result) __defProp$k(target, key, result);
8731
+ return result;
8732
+ };
8733
+ exports.Transition = class Transition extends exports.Effect {
8734
+ constructor(properties, children = []) {
8735
+ super();
8736
+ this.setProperties(properties).append(children);
8737
+ }
8738
+ };
8739
+ exports.Transition = __decorateClass$k([
8740
+ customNode("Transition", {
8741
+ effectMode: "transition",
8742
+ processMode: "pausable",
8743
+ duration: 2e3
8744
+ })
8745
+ ], exports.Transition);
8746
+
8747
+ var __defProp$j = Object.defineProperty;
8748
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8749
+ var __decorateClass$j = (decorators, target, key, kind) => {
8750
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$j(target, key) : target;
8751
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8752
+ if (decorator = decorators[i])
8753
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8754
+ if (kind && result) __defProp$j(target, key, result);
9085
8755
  return result;
9086
8756
  };
9087
8757
  exports.Node2D = class Node2D extends exports.CanvasItem {
@@ -9222,18 +8892,18 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
9222
8892
  );
9223
8893
  }
9224
8894
  };
9225
- exports.Node2D = __decorateClass$f([
8895
+ exports.Node2D = __decorateClass$j([
9226
8896
  customNode("Node2D")
9227
8897
  ], exports.Node2D);
9228
8898
 
9229
- var __defProp$e = Object.defineProperty;
9230
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9231
- var __decorateClass$e = (decorators, target, key, kind) => {
9232
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$e(target, key) : target;
8899
+ var __defProp$i = Object.defineProperty;
8900
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8901
+ var __decorateClass$i = (decorators, target, key, kind) => {
8902
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$i(target, key) : target;
9233
8903
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9234
8904
  if (decorator = decorators[i])
9235
8905
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9236
- if (kind && result) __defProp$e(target, key, result);
8906
+ if (kind && result) __defProp$i(target, key, result);
9237
8907
  return result;
9238
8908
  };
9239
8909
  function proxy(options) {
@@ -9278,61 +8948,61 @@ exports.Graphics2D = class Graphics2D extends exports.Node2D {
9278
8948
  return this;
9279
8949
  }
9280
8950
  };
9281
- __decorateClass$e([
8951
+ __decorateClass$i([
9282
8952
  proxy()
9283
8953
  ], exports.Graphics2D.prototype, "lineCap", 2);
9284
- __decorateClass$e([
8954
+ __decorateClass$i([
9285
8955
  proxy()
9286
8956
  ], exports.Graphics2D.prototype, "lineJoin", 2);
9287
- __decorateClass$e([
8957
+ __decorateClass$i([
9288
8958
  proxy()
9289
8959
  ], exports.Graphics2D.prototype, "fillStyle", 2);
9290
- __decorateClass$e([
8960
+ __decorateClass$i([
9291
8961
  proxy()
9292
8962
  ], exports.Graphics2D.prototype, "strokeStyle", 2);
9293
- __decorateClass$e([
8963
+ __decorateClass$i([
9294
8964
  proxy()
9295
8965
  ], exports.Graphics2D.prototype, "lineWidth", 2);
9296
- __decorateClass$e([
8966
+ __decorateClass$i([
9297
8967
  proxy()
9298
8968
  ], exports.Graphics2D.prototype, "miterLimit", 2);
9299
- __decorateClass$e([
8969
+ __decorateClass$i([
9300
8970
  proxy({ method: true })
9301
8971
  ], exports.Graphics2D.prototype, "rect", 2);
9302
- __decorateClass$e([
8972
+ __decorateClass$i([
9303
8973
  proxy({ method: true, redraw: true })
9304
8974
  ], exports.Graphics2D.prototype, "fillRect", 2);
9305
- __decorateClass$e([
8975
+ __decorateClass$i([
9306
8976
  proxy({ method: true, redraw: true })
9307
8977
  ], exports.Graphics2D.prototype, "strokeRect", 2);
9308
- __decorateClass$e([
8978
+ __decorateClass$i([
9309
8979
  proxy({ method: true })
9310
8980
  ], exports.Graphics2D.prototype, "roundRect", 2);
9311
- __decorateClass$e([
8981
+ __decorateClass$i([
9312
8982
  proxy({ method: true })
9313
8983
  ], exports.Graphics2D.prototype, "ellipse", 2);
9314
- __decorateClass$e([
8984
+ __decorateClass$i([
9315
8985
  proxy({ method: true })
9316
8986
  ], exports.Graphics2D.prototype, "arc", 2);
9317
- __decorateClass$e([
8987
+ __decorateClass$i([
9318
8988
  proxy({ method: true })
9319
8989
  ], exports.Graphics2D.prototype, "beginPath", 2);
9320
- __decorateClass$e([
8990
+ __decorateClass$i([
9321
8991
  proxy({ method: true })
9322
8992
  ], exports.Graphics2D.prototype, "moveTo", 2);
9323
- __decorateClass$e([
8993
+ __decorateClass$i([
9324
8994
  proxy({ method: true })
9325
8995
  ], exports.Graphics2D.prototype, "lineTo", 2);
9326
- __decorateClass$e([
8996
+ __decorateClass$i([
9327
8997
  proxy({ method: true })
9328
8998
  ], exports.Graphics2D.prototype, "closePath", 2);
9329
- __decorateClass$e([
8999
+ __decorateClass$i([
9330
9000
  proxy({ method: true, redraw: true })
9331
9001
  ], exports.Graphics2D.prototype, "fill", 2);
9332
- __decorateClass$e([
9002
+ __decorateClass$i([
9333
9003
  proxy({ method: true, redraw: true })
9334
9004
  ], exports.Graphics2D.prototype, "stroke", 2);
9335
- exports.Graphics2D = __decorateClass$e([
9005
+ exports.Graphics2D = __decorateClass$i([
9336
9006
  customNode("Graphics2D")
9337
9007
  ], exports.Graphics2D);
9338
9008
 
@@ -9362,14 +9032,14 @@ class Image2DResource extends Resource {
9362
9032
  }
9363
9033
  }
9364
9034
 
9365
- var __defProp$d = Object.defineProperty;
9366
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9367
- var __decorateClass$d = (decorators, target, key, kind) => {
9368
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$d(target, key) : target;
9035
+ var __defProp$h = Object.defineProperty;
9036
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
9037
+ var __decorateClass$h = (decorators, target, key, kind) => {
9038
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$h(target, key) : target;
9369
9039
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9370
9040
  if (decorator = decorators[i])
9371
9041
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9372
- if (kind && result) __defProp$d(target, key, result);
9042
+ if (kind && result) __defProp$h(target, key, result);
9373
9043
  return result;
9374
9044
  };
9375
9045
  exports.Image2D = class Image2D extends exports.Node2D {
@@ -9489,16 +9159,16 @@ exports.Image2D = class Image2D extends exports.Node2D {
9489
9159
  }
9490
9160
  }
9491
9161
  };
9492
- __decorateClass$d([
9162
+ __decorateClass$h([
9493
9163
  protectedProperty()
9494
9164
  ], exports.Image2D.prototype, "resource", 2);
9495
- __decorateClass$d([
9165
+ __decorateClass$h([
9496
9166
  property({ default: false })
9497
9167
  ], exports.Image2D.prototype, "gif", 2);
9498
- __decorateClass$d([
9168
+ __decorateClass$h([
9499
9169
  property({ default: "" })
9500
9170
  ], exports.Image2D.prototype, "src", 2);
9501
- exports.Image2D = __decorateClass$d([
9171
+ exports.Image2D = __decorateClass$h([
9502
9172
  customNode("Image2D")
9503
9173
  ], exports.Image2D);
9504
9174
 
@@ -9516,14 +9186,14 @@ class TextureRect2D extends exports.Node2D {
9516
9186
  }
9517
9187
  }
9518
9188
 
9519
- var __defProp$c = Object.defineProperty;
9520
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
9521
- var __decorateClass$c = (decorators, target, key, kind) => {
9522
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$c(target, key) : target;
9189
+ var __defProp$g = Object.defineProperty;
9190
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
9191
+ var __decorateClass$g = (decorators, target, key, kind) => {
9192
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$g(target, key) : target;
9523
9193
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9524
9194
  if (decorator = decorators[i])
9525
9195
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9526
- if (kind && result) __defProp$c(target, key, result);
9196
+ if (kind && result) __defProp$g(target, key, result);
9527
9197
  return result;
9528
9198
  };
9529
9199
  exports.Lottie2D = class Lottie2D extends TextureRect2D {
@@ -9566,21 +9236,21 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
9566
9236
  super._process(delta);
9567
9237
  }
9568
9238
  };
9569
- __decorateClass$c([
9239
+ __decorateClass$g([
9570
9240
  property({ default: "" })
9571
9241
  ], exports.Lottie2D.prototype, "src", 2);
9572
- exports.Lottie2D = __decorateClass$c([
9242
+ exports.Lottie2D = __decorateClass$g([
9573
9243
  customNode("Lottie2D")
9574
9244
  ], exports.Lottie2D);
9575
9245
 
9576
- var __defProp$b = Object.defineProperty;
9577
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
9578
- var __decorateClass$b = (decorators, target, key, kind) => {
9579
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$b(target, key) : target;
9246
+ var __defProp$f = Object.defineProperty;
9247
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9248
+ var __decorateClass$f = (decorators, target, key, kind) => {
9249
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$f(target, key) : target;
9580
9250
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9581
9251
  if (decorator = decorators[i])
9582
9252
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9583
- if (kind && result) __defProp$b(target, key, result);
9253
+ if (kind && result) __defProp$f(target, key, result);
9584
9254
  return result;
9585
9255
  };
9586
9256
  const textStyles = new Set(Object.keys(modernText.textDefaultStyle));
@@ -9718,33 +9388,33 @@ exports.Text2D = class Text2D extends TextureRect2D {
9718
9388
  }
9719
9389
  }
9720
9390
  };
9721
- __decorateClass$b([
9391
+ __decorateClass$f([
9722
9392
  property({ default: false })
9723
9393
  ], exports.Text2D.prototype, "split", 2);
9724
- __decorateClass$b([
9394
+ __decorateClass$f([
9725
9395
  property({ default: "" })
9726
9396
  ], exports.Text2D.prototype, "content", 2);
9727
- __decorateClass$b([
9397
+ __decorateClass$f([
9728
9398
  property()
9729
9399
  ], exports.Text2D.prototype, "effects", 2);
9730
- __decorateClass$b([
9400
+ __decorateClass$f([
9731
9401
  protectedProperty()
9732
9402
  ], exports.Text2D.prototype, "measureDom", 2);
9733
- __decorateClass$b([
9403
+ __decorateClass$f([
9734
9404
  protectedProperty()
9735
9405
  ], exports.Text2D.prototype, "fonts", 2);
9736
- exports.Text2D = __decorateClass$b([
9406
+ exports.Text2D = __decorateClass$f([
9737
9407
  customNode("Text2D")
9738
9408
  ], exports.Text2D);
9739
9409
 
9740
- var __defProp$a = Object.defineProperty;
9741
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
9742
- var __decorateClass$a = (decorators, target, key, kind) => {
9743
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$a(target, key) : target;
9410
+ var __defProp$e = Object.defineProperty;
9411
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9412
+ var __decorateClass$e = (decorators, target, key, kind) => {
9413
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$e(target, key) : target;
9744
9414
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9745
9415
  if (decorator = decorators[i])
9746
9416
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9747
- if (kind && result) __defProp$a(target, key, result);
9417
+ if (kind && result) __defProp$e(target, key, result);
9748
9418
  return result;
9749
9419
  };
9750
9420
  exports.Video2D = class Video2D extends TextureRect2D {
@@ -9797,21 +9467,21 @@ exports.Video2D = class Video2D extends TextureRect2D {
9797
9467
  super._process(delta);
9798
9468
  }
9799
9469
  };
9800
- __decorateClass$a([
9470
+ __decorateClass$e([
9801
9471
  property({ default: "" })
9802
9472
  ], exports.Video2D.prototype, "src", 2);
9803
- exports.Video2D = __decorateClass$a([
9473
+ exports.Video2D = __decorateClass$e([
9804
9474
  customNode("Video2D")
9805
9475
  ], exports.Video2D);
9806
9476
 
9807
- var __defProp$9 = Object.defineProperty;
9808
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
9809
- var __decorateClass$9 = (decorators, target, key, kind) => {
9810
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$9(target, key) : target;
9811
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
9812
- if (decorator = decorators[i])
9477
+ var __defProp$d = Object.defineProperty;
9478
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9479
+ var __decorateClass$d = (decorators, target, key, kind) => {
9480
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$d(target, key) : target;
9481
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9482
+ if (decorator = decorators[i])
9813
9483
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9814
- if (kind && result) __defProp$9(target, key, result);
9484
+ if (kind && result) __defProp$d(target, key, result);
9815
9485
  return result;
9816
9486
  };
9817
9487
  const linear = (amount) => amount;
@@ -9879,21 +9549,28 @@ exports.Animation = class Animation extends exports.TimelineNode {
9879
9549
  _stoped = false;
9880
9550
  constructor(properties, children = []) {
9881
9551
  super();
9882
- this.commitStyles = this.commitStyles.bind(this);
9552
+ this._process = this._process.bind(this);
9883
9553
  this.setProperties(properties).append(children);
9884
9554
  }
9885
9555
  _treeEnter(tree) {
9886
- tree.timeline.on("updateCurrentTime", this.commitStyles);
9556
+ tree.timeline.on("updateCurrentTime", this._process);
9887
9557
  this._updateCachedProps();
9888
9558
  }
9889
9559
  _treeExit(oldTree) {
9890
- oldTree.timeline.on("updateCurrentTime", this.commitStyles);
9560
+ oldTree.timeline.on("updateCurrentTime", this._process);
9891
9561
  this.cancel();
9892
9562
  }
9563
+ _onProcess() {
9564
+ }
9565
+ _process() {
9566
+ if (this.canProcess()) {
9567
+ this.commitStyles();
9568
+ }
9569
+ }
9893
9570
  _updateProperty(key, value, oldValue, declaration) {
9894
9571
  super._updateProperty(key, value, oldValue, declaration);
9895
9572
  switch (key) {
9896
- case "animationMode":
9573
+ case "effectMode":
9897
9574
  case "keyframes":
9898
9575
  this._updateKeyframes();
9899
9576
  break;
@@ -9901,7 +9578,7 @@ exports.Animation = class Animation extends exports.TimelineNode {
9901
9578
  }
9902
9579
  _getTargets() {
9903
9580
  let targets;
9904
- switch (this.animationMode) {
9581
+ switch (this.effectMode) {
9905
9582
  case "sibling":
9906
9583
  targets = this.getParent()?.getChildren(true).filter((val) => val instanceof exports.CanvasItem) ?? [];
9907
9584
  break;
@@ -10123,22 +9800,22 @@ exports.Animation = class Animation extends exports.TimelineNode {
10123
9800
  });
10124
9801
  }
10125
9802
  };
10126
- __decorateClass$9([
9803
+ __decorateClass$d([
10127
9804
  property({ default: "parent" })
10128
- ], exports.Animation.prototype, "animationMode", 2);
10129
- __decorateClass$9([
9805
+ ], exports.Animation.prototype, "effectMode", 2);
9806
+ __decorateClass$d([
10130
9807
  property({ default: false })
10131
9808
  ], exports.Animation.prototype, "loop", 2);
10132
- __decorateClass$9([
9809
+ __decorateClass$d([
10133
9810
  property({ default: [] })
10134
9811
  ], exports.Animation.prototype, "keyframes", 2);
10135
- __decorateClass$9([
9812
+ __decorateClass$d([
10136
9813
  property()
10137
9814
  ], exports.Animation.prototype, "easing", 2);
10138
- exports.Animation = __decorateClass$9([
9815
+ exports.Animation = __decorateClass$d([
10139
9816
  customNode("Animation", {
10140
9817
  renderMode: "disabled",
10141
- processMode: "disabled",
9818
+ processMode: "pausable",
10142
9819
  duration: 2e3
10143
9820
  })
10144
9821
  ], exports.Animation);
@@ -11018,18 +10695,18 @@ class WebAudio extends AudioPipeline {
11018
10695
  }
11019
10696
  }
11020
10697
 
11021
- var __defProp$8 = Object.defineProperty;
11022
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11023
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11024
- var __decorateClass$8 = (decorators, target, key, kind) => {
11025
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$8(target, key) : target;
10698
+ var __defProp$c = Object.defineProperty;
10699
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
10700
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10701
+ var __decorateClass$c = (decorators, target, key, kind) => {
10702
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$c(target, key) : target;
11026
10703
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11027
10704
  if (decorator = decorators[i])
11028
10705
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11029
- if (kind && result) __defProp$8(target, key, result);
10706
+ if (kind && result) __defProp$c(target, key, result);
11030
10707
  return result;
11031
10708
  };
11032
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
10709
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
11033
10710
  exports.Audio = class Audio extends exports.TimelineNode {
11034
10711
  _sounds = [];
11035
10712
  /** PlatformAudio */
@@ -11233,8 +10910,8 @@ exports.Audio = class Audio extends exports.TimelineNode {
11233
10910
  }, 100);
11234
10911
  }
11235
10912
  };
11236
- __publicField(exports.Audio, "_soundPool", []);
11237
- exports.Audio = __decorateClass$8([
10913
+ __publicField$4(exports.Audio, "_soundPool", []);
10914
+ exports.Audio = __decorateClass$c([
11238
10915
  customNode("Audio")
11239
10916
  ], exports.Audio);
11240
10917
 
@@ -11242,14 +10919,14 @@ class AudioSpectrum extends exports.Node2D {
11242
10919
  //
11243
10920
  }
11244
10921
 
11245
- var __defProp$7 = Object.defineProperty;
11246
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11247
- var __decorateClass$7 = (decorators, target, key, kind) => {
11248
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$7(target, key) : target;
10922
+ var __defProp$b = Object.defineProperty;
10923
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
10924
+ var __decorateClass$b = (decorators, target, key, kind) => {
10925
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$b(target, key) : target;
11249
10926
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11250
10927
  if (decorator = decorators[i])
11251
10928
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11252
- if (kind && result) __defProp$7(target, key, result);
10929
+ if (kind && result) __defProp$b(target, key, result);
11253
10930
  return result;
11254
10931
  };
11255
10932
  exports.AudioWaveform = class AudioWaveform extends exports.Node2D {
@@ -11343,27 +11020,27 @@ exports.AudioWaveform = class AudioWaveform extends exports.Node2D {
11343
11020
  }
11344
11021
  }
11345
11022
  };
11346
- __decorateClass$7([
11023
+ __decorateClass$b([
11347
11024
  property()
11348
11025
  ], exports.AudioWaveform.prototype, "src", 2);
11349
- __decorateClass$7([
11026
+ __decorateClass$b([
11350
11027
  property()
11351
11028
  ], exports.AudioWaveform.prototype, "gap", 2);
11352
- __decorateClass$7([
11029
+ __decorateClass$b([
11353
11030
  property()
11354
11031
  ], exports.AudioWaveform.prototype, "color", 2);
11355
- exports.AudioWaveform = __decorateClass$7([
11032
+ exports.AudioWaveform = __decorateClass$b([
11356
11033
  customNode("AudioWaveform")
11357
11034
  ], exports.AudioWaveform);
11358
11035
 
11359
- var __defProp$6 = Object.defineProperty;
11360
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11361
- var __decorateClass$6 = (decorators, target, key, kind) => {
11362
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$6(target, key) : target;
11036
+ var __defProp$a = Object.defineProperty;
11037
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
11038
+ var __decorateClass$a = (decorators, target, key, kind) => {
11039
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$a(target, key) : target;
11363
11040
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11364
11041
  if (decorator = decorators[i])
11365
11042
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11366
- if (kind && result) __defProp$6(target, key, result);
11043
+ if (kind && result) __defProp$a(target, key, result);
11367
11044
  return result;
11368
11045
  };
11369
11046
  exports.Control = class Control extends exports.CanvasItem {
@@ -11423,18 +11100,18 @@ exports.Control = class Control extends exports.CanvasItem {
11423
11100
  return new Rect2(left, top, width, height);
11424
11101
  }
11425
11102
  };
11426
- exports.Control = __decorateClass$6([
11103
+ exports.Control = __decorateClass$a([
11427
11104
  customNode("Control")
11428
11105
  ], exports.Control);
11429
11106
 
11430
- var __defProp$5 = Object.defineProperty;
11431
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11432
- var __decorateClass$5 = (decorators, target, key, kind) => {
11433
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$5(target, key) : target;
11107
+ var __defProp$9 = Object.defineProperty;
11108
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
11109
+ var __decorateClass$9 = (decorators, target, key, kind) => {
11110
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$9(target, key) : target;
11434
11111
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11435
11112
  if (decorator = decorators[i])
11436
11113
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11437
- if (kind && result) __defProp$5(target, key, result);
11114
+ if (kind && result) __defProp$9(target, key, result);
11438
11115
  return result;
11439
11116
  };
11440
11117
  exports.Range = class Range extends exports.Control {
@@ -11457,39 +11134,39 @@ exports.Range = class Range extends exports.Control {
11457
11134
  }
11458
11135
  }
11459
11136
  };
11460
- __decorateClass$5([
11137
+ __decorateClass$9([
11461
11138
  property({ default: false })
11462
11139
  ], exports.Range.prototype, "allowGreater", 2);
11463
- __decorateClass$5([
11140
+ __decorateClass$9([
11464
11141
  property({ default: false })
11465
11142
  ], exports.Range.prototype, "allowLesser", 2);
11466
- __decorateClass$5([
11143
+ __decorateClass$9([
11467
11144
  property({ default: 1 })
11468
11145
  ], exports.Range.prototype, "page", 2);
11469
- __decorateClass$5([
11146
+ __decorateClass$9([
11470
11147
  property({ default: 0 })
11471
11148
  ], exports.Range.prototype, "minValue", 2);
11472
- __decorateClass$5([
11149
+ __decorateClass$9([
11473
11150
  property({ default: 100 })
11474
11151
  ], exports.Range.prototype, "maxValue", 2);
11475
- __decorateClass$5([
11152
+ __decorateClass$9([
11476
11153
  property({ default: 0.01 })
11477
11154
  ], exports.Range.prototype, "step", 2);
11478
- __decorateClass$5([
11155
+ __decorateClass$9([
11479
11156
  property({ default: 0 })
11480
11157
  ], exports.Range.prototype, "value", 2);
11481
- exports.Range = __decorateClass$5([
11158
+ exports.Range = __decorateClass$9([
11482
11159
  customNode("Range")
11483
11160
  ], exports.Range);
11484
11161
 
11485
- var __defProp$4 = Object.defineProperty;
11486
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11487
- var __decorateClass$4 = (decorators, target, key, kind) => {
11488
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$4(target, key) : target;
11162
+ var __defProp$8 = Object.defineProperty;
11163
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11164
+ var __decorateClass$8 = (decorators, target, key, kind) => {
11165
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$8(target, key) : target;
11489
11166
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11490
11167
  if (decorator = decorators[i])
11491
11168
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11492
- if (kind && result) __defProp$4(target, key, result);
11169
+ if (kind && result) __defProp$8(target, key, result);
11493
11170
  return result;
11494
11171
  };
11495
11172
  exports.Ruler = class Ruler extends exports.Control {
@@ -11640,45 +11317,45 @@ exports.Ruler = class Ruler extends exports.Control {
11640
11317
  }
11641
11318
  }
11642
11319
  };
11643
- __decorateClass$4([
11320
+ __decorateClass$8([
11644
11321
  property({ default: 0 })
11645
11322
  ], exports.Ruler.prototype, "offsetX", 2);
11646
- __decorateClass$4([
11323
+ __decorateClass$8([
11647
11324
  property({ default: 0 })
11648
11325
  ], exports.Ruler.prototype, "offsetY", 2);
11649
- __decorateClass$4([
11326
+ __decorateClass$8([
11650
11327
  property({ default: 20 })
11651
11328
  ], exports.Ruler.prototype, "thickness", 2);
11652
- __decorateClass$4([
11329
+ __decorateClass$8([
11653
11330
  property({ default: 3 })
11654
11331
  ], exports.Ruler.prototype, "markHeight", 2);
11655
- __decorateClass$4([
11332
+ __decorateClass$8([
11656
11333
  property({ default: "#b2b6bc" })
11657
11334
  ], exports.Ruler.prototype, "color", 2);
11658
- __decorateClass$4([
11335
+ __decorateClass$8([
11659
11336
  property({ default: "#f9f9fa" })
11660
11337
  ], exports.Ruler.prototype, "markBackgroundColor", 2);
11661
- __decorateClass$4([
11338
+ __decorateClass$8([
11662
11339
  property({ default: "#b2b6bc" })
11663
11340
  ], exports.Ruler.prototype, "markColor", 2);
11664
- __decorateClass$4([
11341
+ __decorateClass$8([
11665
11342
  property({ default: 300 })
11666
11343
  ], exports.Ruler.prototype, "gap", 2);
11667
- __decorateClass$4([
11344
+ __decorateClass$8([
11668
11345
  property({ default: 1 })
11669
11346
  ], exports.Ruler.prototype, "scale", 2);
11670
- exports.Ruler = __decorateClass$4([
11347
+ exports.Ruler = __decorateClass$8([
11671
11348
  customNode("Ruler")
11672
11349
  ], exports.Ruler);
11673
11350
 
11674
- var __defProp$3 = Object.defineProperty;
11675
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
11676
- var __decorateClass$3 = (decorators, target, key, kind) => {
11677
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$3(target, key) : target;
11351
+ var __defProp$7 = Object.defineProperty;
11352
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11353
+ var __decorateClass$7 = (decorators, target, key, kind) => {
11354
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$7(target, key) : target;
11678
11355
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11679
11356
  if (decorator = decorators[i])
11680
11357
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11681
- if (kind && result) __defProp$3(target, key, result);
11358
+ if (kind && result) __defProp$7(target, key, result);
11682
11359
  return result;
11683
11360
  };
11684
11361
  exports.ScrollBar = class ScrollBar extends exports.Range {
@@ -11720,21 +11397,21 @@ exports.ScrollBar = class ScrollBar extends exports.Range {
11720
11397
  this.context.fill();
11721
11398
  }
11722
11399
  };
11723
- __decorateClass$3([
11400
+ __decorateClass$7([
11724
11401
  property({ default: "vertical" })
11725
11402
  ], exports.ScrollBar.prototype, "direction", 2);
11726
- exports.ScrollBar = __decorateClass$3([
11403
+ exports.ScrollBar = __decorateClass$7([
11727
11404
  customNode("ScrollBar")
11728
11405
  ], exports.ScrollBar);
11729
11406
 
11730
- var __defProp$2 = Object.defineProperty;
11731
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
11732
- var __decorateClass$2 = (decorators, target, key, kind) => {
11733
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$2(target, key) : target;
11407
+ var __defProp$6 = Object.defineProperty;
11408
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11409
+ var __decorateClass$6 = (decorators, target, key, kind) => {
11410
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$6(target, key) : target;
11734
11411
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11735
11412
  if (decorator = decorators[i])
11736
11413
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11737
- if (kind && result) __defProp$2(target, key, result);
11414
+ if (kind && result) __defProp$6(target, key, result);
11738
11415
  return result;
11739
11416
  };
11740
11417
  exports.XScrollBar = class XScrollBar extends exports.ScrollBar {
@@ -11743,20 +11420,20 @@ exports.XScrollBar = class XScrollBar extends exports.ScrollBar {
11743
11420
  this.setProperties(properties).append(children);
11744
11421
  }
11745
11422
  };
11746
- exports.XScrollBar = __decorateClass$2([
11423
+ exports.XScrollBar = __decorateClass$6([
11747
11424
  customNode("XScrollBar", {
11748
11425
  direction: "horizontal"
11749
11426
  })
11750
11427
  ], exports.XScrollBar);
11751
11428
 
11752
- var __defProp$1 = Object.defineProperty;
11753
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11754
- var __decorateClass$1 = (decorators, target, key, kind) => {
11755
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$1(target, key) : target;
11429
+ var __defProp$5 = Object.defineProperty;
11430
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11431
+ var __decorateClass$5 = (decorators, target, key, kind) => {
11432
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$5(target, key) : target;
11756
11433
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11757
11434
  if (decorator = decorators[i])
11758
11435
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11759
- if (kind && result) __defProp$1(target, key, result);
11436
+ if (kind && result) __defProp$5(target, key, result);
11760
11437
  return result;
11761
11438
  };
11762
11439
  exports.YScrollBar = class YScrollBar extends exports.ScrollBar {
@@ -11765,20 +11442,20 @@ exports.YScrollBar = class YScrollBar extends exports.ScrollBar {
11765
11442
  this.setProperties(properties).append(children);
11766
11443
  }
11767
11444
  };
11768
- exports.YScrollBar = __decorateClass$1([
11445
+ exports.YScrollBar = __decorateClass$5([
11769
11446
  customNode("YScrollBar", {
11770
11447
  direction: "vertical"
11771
11448
  })
11772
11449
  ], exports.YScrollBar);
11773
11450
 
11774
- var __defProp = Object.defineProperty;
11775
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11776
- var __decorateClass = (decorators, target, key, kind) => {
11777
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc(target, key) : target;
11451
+ var __defProp$4 = Object.defineProperty;
11452
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11453
+ var __decorateClass$4 = (decorators, target, key, kind) => {
11454
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$4(target, key) : target;
11778
11455
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11779
11456
  if (decorator = decorators[i])
11780
11457
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11781
- if (kind && result) __defProp(target, key, result);
11458
+ if (kind && result) __defProp$4(target, key, result);
11782
11459
  return result;
11783
11460
  };
11784
11461
  exports.Scaler = class Scaler extends exports.Node {
@@ -11835,22 +11512,376 @@ exports.Scaler = class Scaler extends exports.Node {
11835
11512
  }
11836
11513
  }
11837
11514
  };
11838
- __decorateClass([
11515
+ __decorateClass$4([
11839
11516
  property({ default: 1 })
11840
11517
  ], exports.Scaler.prototype, "value", 2);
11841
- __decorateClass([
11518
+ __decorateClass$4([
11842
11519
  property({ default: 0.05 })
11843
11520
  ], exports.Scaler.prototype, "minValue", 2);
11844
- __decorateClass([
11521
+ __decorateClass$4([
11845
11522
  property({ default: 10 })
11846
11523
  ], exports.Scaler.prototype, "maxValue", 2);
11847
- exports.Scaler = __decorateClass([
11524
+ exports.Scaler = __decorateClass$4([
11848
11525
  customNode("Scaler", {
11849
11526
  processMode: "disabled",
11850
11527
  renderMode: "disabled"
11851
11528
  })
11852
11529
  ], exports.Scaler);
11853
11530
 
11531
+ var __defProp$3 = Object.defineProperty;
11532
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
11533
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11534
+ var __decorateClass$3 = (decorators, target, key, kind) => {
11535
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$3(target, key) : target;
11536
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11537
+ if (decorator = decorators[i])
11538
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11539
+ if (kind && result) __defProp$3(target, key, result);
11540
+ return result;
11541
+ };
11542
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
11543
+ exports.KawaseTransition = class KawaseTransition extends exports.Transition {
11544
+ blur = 10;
11545
+ quality = 10;
11546
+ apply(renderer, target) {
11547
+ const currentTimeProgress = this.currentTimeProgress;
11548
+ let sampler;
11549
+ let progress;
11550
+ if (currentTimeProgress < 0.5) {
11551
+ sampler = 0;
11552
+ progress = (0.5 - currentTimeProgress) / 0.5;
11553
+ } else {
11554
+ sampler = 1;
11555
+ progress = (currentTimeProgress - 0.5) / 0.5;
11556
+ }
11557
+ const blur = this.blur;
11558
+ const quality = this.quality;
11559
+ const width = target.width;
11560
+ const height = target.height;
11561
+ const drawCalls = [];
11562
+ const kernels = [blur];
11563
+ if (blur > 0) {
11564
+ let k = blur;
11565
+ const step = blur / quality;
11566
+ for (let i = 1; i < quality; i++) {
11567
+ k -= step;
11568
+ kernels.push(k);
11569
+ }
11570
+ }
11571
+ const uvX = 1 / width;
11572
+ const uvY = 1 / height;
11573
+ const uOffset = [];
11574
+ let offset;
11575
+ const last = quality - 1;
11576
+ for (let i = 0; i < last; i++) {
11577
+ offset = kernels[i] + 0.5;
11578
+ uOffset[0] = offset * uvX;
11579
+ uOffset[1] = offset * uvY;
11580
+ drawCalls.push({
11581
+ offset: uOffset
11582
+ });
11583
+ }
11584
+ offset = kernels[last] + 0.5;
11585
+ uOffset[0] = offset * uvX;
11586
+ uOffset[1] = offset * uvY;
11587
+ drawCalls.push({
11588
+ offset: uOffset
11589
+ });
11590
+ drawCalls.forEach((uniforms) => {
11591
+ QuadUvGeometry.draw(renderer, exports.KawaseTransition.material, {
11592
+ sampler,
11593
+ progress,
11594
+ ...uniforms
11595
+ });
11596
+ });
11597
+ }
11598
+ };
11599
+ __publicField$3(exports.KawaseTransition, "material", new Material({
11600
+ vert: `attribute vec2 position;
11601
+ attribute vec2 uv;
11602
+ varying vec2 vUv;
11603
+ void main() {
11604
+ gl_Position = vec4(position, 0.0, 1.0);
11605
+ vUv = uv;
11606
+ }`,
11607
+ frag: `precision highp float;
11608
+ varying vec2 vUv;
11609
+ uniform sampler2D sampler;
11610
+ uniform vec2 offset;
11611
+ uniform float progress;
11612
+
11613
+ void main(void) {
11614
+ vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);
11615
+ vec4 color = vec4(0.0);
11616
+ color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));
11617
+ color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));
11618
+ color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y - offset1.y));
11619
+ color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y - offset1.y));
11620
+ color *= 0.25;
11621
+ gl_FragColor = color;
11622
+ }`
11623
+ }));
11624
+ exports.KawaseTransition = __decorateClass$3([
11625
+ customNode("KawaseTransition")
11626
+ ], exports.KawaseTransition);
11627
+
11628
+ var __defProp$2 = Object.defineProperty;
11629
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
11630
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11631
+ var __decorateClass$2 = (decorators, target, key, kind) => {
11632
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$2(target, key) : target;
11633
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11634
+ if (decorator = decorators[i])
11635
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11636
+ if (kind && result) __defProp$2(target, key, result);
11637
+ return result;
11638
+ };
11639
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
11640
+ exports.LeftEraseTransition = class LeftEraseTransition extends exports.Transition {
11641
+ apply(renderer) {
11642
+ QuadUvGeometry.draw(renderer, exports.LeftEraseTransition.material, {
11643
+ previous: 0,
11644
+ next: 1,
11645
+ progress: this.currentTimeProgress
11646
+ });
11647
+ }
11648
+ };
11649
+ __publicField$2(exports.LeftEraseTransition, "material", new Material({
11650
+ vert: `attribute vec2 position;
11651
+ attribute vec2 uv;
11652
+ varying vec2 vUv;
11653
+ void main() {
11654
+ gl_Position = vec4(position, 0.0, 1.0);
11655
+ vUv = uv;
11656
+ }`,
11657
+ frag: `precision highp float;
11658
+ varying vec2 vUv;
11659
+ uniform float progress;
11660
+ uniform sampler2D previous;
11661
+ uniform sampler2D next;
11662
+
11663
+ float easeInOutQuint(float t) {
11664
+ return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;
11665
+ }
11666
+
11667
+ void main() {
11668
+ vec4 src1Color = texture2D(previous, vUv);
11669
+ vec4 src2Color = texture2D(next, vUv);
11670
+ float mProgress = 1.0 - progress;
11671
+ float mixPercent = 0.0;
11672
+ if (vUv.x <= mProgress) {
11673
+ mixPercent = 1.0;
11674
+ }
11675
+ gl_FragColor = mix(src2Color, src1Color, mixPercent);
11676
+ }`
11677
+ }));
11678
+ exports.LeftEraseTransition = __decorateClass$2([
11679
+ customNode("LeftEraseTransition")
11680
+ ], exports.LeftEraseTransition);
11681
+
11682
+ var __defProp$1 = Object.defineProperty;
11683
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11684
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11685
+ var __decorateClass$1 = (decorators, target, key, kind) => {
11686
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$1(target, key) : target;
11687
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11688
+ if (decorator = decorators[i])
11689
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11690
+ if (kind && result) __defProp$1(target, key, result);
11691
+ return result;
11692
+ };
11693
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
11694
+ exports.TiltShiftTransition = class TiltShiftTransition extends exports.Transition {
11695
+ blur = 100;
11696
+ gradientBlur = 600;
11697
+ apply(renderer, target) {
11698
+ const currentTimeProgress = this.currentTimeProgress;
11699
+ let sampler;
11700
+ let progress;
11701
+ if (currentTimeProgress < 0.5) {
11702
+ sampler = 0;
11703
+ progress = (0.5 - currentTimeProgress) / 0.5;
11704
+ } else {
11705
+ sampler = 1;
11706
+ progress = (currentTimeProgress - 0.5) / 0.5;
11707
+ }
11708
+ const width = target.width;
11709
+ const height = target.height;
11710
+ const start = [0, height / 2];
11711
+ const end = [600, height / 2];
11712
+ const texSize = [width, height];
11713
+ const dx = end[0] - start[0];
11714
+ const dy = end[1] - start[1];
11715
+ const d = Math.sqrt(dx * dx + dy * dy);
11716
+ QuadUvGeometry.draw(renderer, exports.TiltShiftTransition.material, {
11717
+ sampler,
11718
+ progress,
11719
+ blur: this.blur,
11720
+ gradientBlur: this.gradientBlur,
11721
+ start,
11722
+ end,
11723
+ delta: [dx / d, dy / d],
11724
+ texSize
11725
+ });
11726
+ QuadUvGeometry.draw(renderer, exports.TiltShiftTransition.material, {
11727
+ sampler,
11728
+ progress,
11729
+ blur: this.blur,
11730
+ gradientBlur: this.gradientBlur,
11731
+ start,
11732
+ end,
11733
+ delta: [-dy / d, dx / d],
11734
+ texSize
11735
+ });
11736
+ }
11737
+ };
11738
+ __publicField$1(exports.TiltShiftTransition, "material", new Material({
11739
+ vert: `attribute vec2 position;
11740
+ attribute vec2 uv;
11741
+ varying vec2 vUv;
11742
+ void main() {
11743
+ gl_Position = vec4(position, 0.0, 1.0);
11744
+ vUv = uv;
11745
+ }`,
11746
+ frag: `precision highp float;
11747
+ varying vec2 vUv;
11748
+ uniform sampler2D sampler;
11749
+ uniform float blur;
11750
+ uniform float gradientBlur;
11751
+ uniform vec2 start;
11752
+ uniform vec2 end;
11753
+ uniform vec2 delta;
11754
+ uniform vec2 texSize;
11755
+ uniform float progress;
11756
+
11757
+ float random(vec3 scale, float seed) {
11758
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
11759
+ }
11760
+
11761
+ void main(void) {
11762
+ float blur1 = blur - progress * blur;
11763
+ float gradientBlur1 = progress * gradientBlur;
11764
+
11765
+ vec4 color = vec4(0.0);
11766
+ float total = 0.0;
11767
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
11768
+ vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));
11769
+ float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;
11770
+
11771
+ for (float t = -30.0; t <= 30.0; t++) {
11772
+ float percent = (t + offset - 0.5) / 30.0;
11773
+ float weight = 1.0 - abs(percent);
11774
+ vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);
11775
+ sample1.rgb *= sample1.a;
11776
+ color += sample1 * weight;
11777
+ total += weight;
11778
+ }
11779
+
11780
+ color /= total;
11781
+ color.rgb /= color.a + 0.00001;
11782
+
11783
+ gl_FragColor = color;
11784
+ }`
11785
+ }));
11786
+ exports.TiltShiftTransition = __decorateClass$1([
11787
+ customNode("TiltShiftTransition")
11788
+ ], exports.TiltShiftTransition);
11789
+
11790
+ var __defProp = Object.defineProperty;
11791
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11792
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11793
+ var __decorateClass = (decorators, target, key, kind) => {
11794
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc(target, key) : target;
11795
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11796
+ if (decorator = decorators[i])
11797
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11798
+ if (kind && result) __defProp(target, key, result);
11799
+ return result;
11800
+ };
11801
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
11802
+ exports.TwistTransition = class TwistTransition extends exports.Transition {
11803
+ radius;
11804
+ angle = 4;
11805
+ padding = 20;
11806
+ offset;
11807
+ apply(renderer, source) {
11808
+ const currentTimeProgress = this.currentTimeProgress;
11809
+ let sampler;
11810
+ let progress;
11811
+ if (currentTimeProgress < 0.5) {
11812
+ sampler = 0;
11813
+ progress = (0.5 - currentTimeProgress) / 0.5;
11814
+ } else {
11815
+ sampler = 1;
11816
+ progress = (currentTimeProgress - 0.5) / 0.5;
11817
+ }
11818
+ const width = source.width;
11819
+ const height = source.height;
11820
+ QuadUvGeometry.draw(renderer, exports.TwistTransition.material, {
11821
+ sampler,
11822
+ progress,
11823
+ filterArea: [width, height, 0, 0],
11824
+ radius: this.radius ?? width,
11825
+ angle: this.angle,
11826
+ padding: this.padding,
11827
+ offset: this.offset ?? [width / 2, height / 2]
11828
+ });
11829
+ }
11830
+ };
11831
+ __publicField(exports.TwistTransition, "material", new Material({
11832
+ vert: `attribute vec2 position;
11833
+ attribute vec2 uv;
11834
+ varying vec2 vUv;
11835
+ void main() {
11836
+ gl_Position = vec4(position, 0.0, 1.0);
11837
+ vUv = uv;
11838
+ }`,
11839
+ frag: `precision highp float;
11840
+ varying vec2 vUv;
11841
+ uniform sampler2D sampler;
11842
+ uniform float radius;
11843
+ uniform float angle;
11844
+ uniform vec2 offset;
11845
+ uniform vec4 filterArea;
11846
+ uniform float progress;
11847
+
11848
+ vec2 mapCoord(vec2 coord) {
11849
+ coord -= filterArea.zw;
11850
+ coord *= filterArea.xy;
11851
+ return coord;
11852
+ }
11853
+
11854
+ vec2 unmapCoord(vec2 coord) {
11855
+ coord -= filterArea.zw;
11856
+ coord /= filterArea.xy;
11857
+ return coord;
11858
+ }
11859
+
11860
+ vec2 twist(vec2 coord, float radius) {
11861
+ coord -= offset;
11862
+ float dist = length(coord);
11863
+ if (dist < radius) {
11864
+ float ratioDist = (radius - dist) / radius;
11865
+ float angleMod = ratioDist * ratioDist * angle;
11866
+ float s = sin(angleMod);
11867
+ float c = cos(angleMod);
11868
+ coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);
11869
+ }
11870
+ coord += offset;
11871
+ return coord;
11872
+ }
11873
+
11874
+ void main(void) {
11875
+ vec2 coord = mapCoord(vUv);
11876
+ coord = twist(coord, radius - (progress * radius));
11877
+ coord = unmapCoord(coord);
11878
+ gl_FragColor = texture2D(sampler, coord);
11879
+ }`
11880
+ }));
11881
+ exports.TwistTransition = __decorateClass([
11882
+ customNode("TwistTransition")
11883
+ ], exports.TwistTransition);
11884
+
11854
11885
  class GifLoader extends Loader {
11855
11886
  install(assets) {
11856
11887
  const handler = async (url) => {