modern-canvas 0.2.3 → 0.2.4

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.mjs CHANGED
@@ -2198,13 +2198,13 @@ class Vector3 extends Vector {
2198
2198
  }
2199
2199
  }
2200
2200
 
2201
- var __defProp$L = Object.defineProperty;
2202
- var __decorateClass$L = (decorators, target, key, kind) => {
2201
+ var __defProp$M = Object.defineProperty;
2202
+ var __decorateClass$M = (decorators, target, key, kind) => {
2203
2203
  var result = undefined ;
2204
2204
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2205
2205
  if (decorator = decorators[i])
2206
2206
  result = (decorator(target, key, result) ) || result;
2207
- if (result) __defProp$L(target, key, result);
2207
+ if (result) __defProp$M(target, key, result);
2208
2208
  return result;
2209
2209
  };
2210
2210
  class MainLoop extends CoreObject {
@@ -2245,10 +2245,10 @@ class MainLoop extends CoreObject {
2245
2245
  }
2246
2246
  }
2247
2247
  }
2248
- __decorateClass$L([
2248
+ __decorateClass$M([
2249
2249
  property({ default: 24 })
2250
2250
  ], MainLoop.prototype, "fps");
2251
- __decorateClass$L([
2251
+ __decorateClass$M([
2252
2252
  property({ default: 1 })
2253
2253
  ], MainLoop.prototype, "speed");
2254
2254
 
@@ -4392,13 +4392,13 @@ class Geometry extends Resource {
4392
4392
  }
4393
4393
  }
4394
4394
 
4395
- var __defProp$K = Object.defineProperty;
4396
- var __decorateClass$K = (decorators, target, key, kind) => {
4395
+ var __defProp$L = Object.defineProperty;
4396
+ var __decorateClass$L = (decorators, target, key, kind) => {
4397
4397
  var result = undefined ;
4398
4398
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4399
4399
  if (decorator = decorators[i])
4400
4400
  result = (decorator(target, key, result) ) || result;
4401
- if (result) __defProp$K(target, key, result);
4401
+ if (result) __defProp$L(target, key, result);
4402
4402
  return result;
4403
4403
  };
4404
4404
  class IndexBuffer extends Resource {
@@ -4442,20 +4442,20 @@ class IndexBuffer extends Resource {
4442
4442
  return result;
4443
4443
  }
4444
4444
  }
4445
- __decorateClass$K([
4445
+ __decorateClass$L([
4446
4446
  protectedProperty({ default: null })
4447
4447
  ], IndexBuffer.prototype, "data");
4448
- __decorateClass$K([
4448
+ __decorateClass$L([
4449
4449
  protectedProperty({ default: false })
4450
4450
  ], IndexBuffer.prototype, "dynamic");
4451
4451
 
4452
- var __defProp$J = Object.defineProperty;
4453
- var __decorateClass$J = (decorators, target, key, kind) => {
4452
+ var __defProp$K = Object.defineProperty;
4453
+ var __decorateClass$K = (decorators, target, key, kind) => {
4454
4454
  var result = undefined ;
4455
4455
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4456
4456
  if (decorator = decorators[i])
4457
4457
  result = (decorator(target, key, result) ) || result;
4458
- if (result) __defProp$J(target, key, result);
4458
+ if (result) __defProp$K(target, key, result);
4459
4459
  return result;
4460
4460
  };
4461
4461
  class VertexBuffer extends Resource {
@@ -4499,20 +4499,20 @@ class VertexBuffer extends Resource {
4499
4499
  return result;
4500
4500
  }
4501
4501
  }
4502
- __decorateClass$J([
4502
+ __decorateClass$K([
4503
4503
  protectedProperty({ default: null })
4504
4504
  ], VertexBuffer.prototype, "data");
4505
- __decorateClass$J([
4505
+ __decorateClass$K([
4506
4506
  protectedProperty({ default: false })
4507
4507
  ], VertexBuffer.prototype, "dynamic");
4508
4508
 
4509
- var __defProp$I = Object.defineProperty;
4510
- var __decorateClass$I = (decorators, target, key, kind) => {
4509
+ var __defProp$J = Object.defineProperty;
4510
+ var __decorateClass$J = (decorators, target, key, kind) => {
4511
4511
  var result = undefined ;
4512
4512
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4513
4513
  if (decorator = decorators[i])
4514
4514
  result = (decorator(target, key, result) ) || result;
4515
- if (result) __defProp$I(target, key, result);
4515
+ if (result) __defProp$J(target, key, result);
4516
4516
  return result;
4517
4517
  };
4518
4518
  class VertexAttribute extends Resource {
@@ -4549,25 +4549,25 @@ class VertexAttribute extends Resource {
4549
4549
  return result;
4550
4550
  }
4551
4551
  }
4552
- __decorateClass$I([
4552
+ __decorateClass$J([
4553
4553
  protectedProperty()
4554
4554
  ], VertexAttribute.prototype, "buffer");
4555
- __decorateClass$I([
4555
+ __decorateClass$J([
4556
4556
  protectedProperty({ default: 0 })
4557
4557
  ], VertexAttribute.prototype, "size");
4558
- __decorateClass$I([
4558
+ __decorateClass$J([
4559
4559
  protectedProperty({ default: false })
4560
4560
  ], VertexAttribute.prototype, "normalized");
4561
- __decorateClass$I([
4561
+ __decorateClass$J([
4562
4562
  protectedProperty({ default: "float" })
4563
4563
  ], VertexAttribute.prototype, "type");
4564
- __decorateClass$I([
4564
+ __decorateClass$J([
4565
4565
  protectedProperty()
4566
4566
  ], VertexAttribute.prototype, "stride");
4567
- __decorateClass$I([
4567
+ __decorateClass$J([
4568
4568
  protectedProperty()
4569
4569
  ], VertexAttribute.prototype, "offset");
4570
- __decorateClass$I([
4570
+ __decorateClass$J([
4571
4571
  protectedProperty()
4572
4572
  ], VertexAttribute.prototype, "divisor");
4573
4573
 
@@ -4817,13 +4817,13 @@ class UvGeometry extends Geometry {
4817
4817
  }
4818
4818
  }
4819
4819
 
4820
- var __defProp$H = Object.defineProperty;
4821
- var __decorateClass$H = (decorators, target, key, kind) => {
4820
+ var __defProp$I = Object.defineProperty;
4821
+ var __decorateClass$I = (decorators, target, key, kind) => {
4822
4822
  var result = undefined ;
4823
4823
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4824
4824
  if (decorator = decorators[i])
4825
4825
  result = (decorator(target, key, result) ) || result;
4826
- if (result) __defProp$H(target, key, result);
4826
+ if (result) __defProp$I(target, key, result);
4827
4827
  return result;
4828
4828
  };
4829
4829
  const style2DFilterDefault = {
@@ -5040,58 +5040,58 @@ class CanvasItemStyle extends Resource {
5040
5040
  return m;
5041
5041
  }
5042
5042
  }
5043
- __decorateClass$H([
5043
+ __decorateClass$I([
5044
5044
  property({ default: "none" })
5045
5045
  ], CanvasItemStyle.prototype, "backgroundColor");
5046
- __decorateClass$H([
5046
+ __decorateClass$I([
5047
5047
  property({ default: "none" })
5048
5048
  ], CanvasItemStyle.prototype, "backgroundImage");
5049
- __decorateClass$H([
5049
+ __decorateClass$I([
5050
5050
  property({ default: "none" })
5051
5051
  ], CanvasItemStyle.prototype, "filter");
5052
- __decorateClass$H([
5052
+ __decorateClass$I([
5053
5053
  property({ default: "inherit" })
5054
5054
  ], CanvasItemStyle.prototype, "direction");
5055
- __decorateClass$H([
5055
+ __decorateClass$I([
5056
5056
  property({ default: "none" })
5057
5057
  ], CanvasItemStyle.prototype, "boxShadow");
5058
- __decorateClass$H([
5058
+ __decorateClass$I([
5059
5059
  property({ default: "none" })
5060
5060
  ], CanvasItemStyle.prototype, "maskImage");
5061
- __decorateClass$H([
5061
+ __decorateClass$I([
5062
5062
  property({ default: 1 })
5063
5063
  ], CanvasItemStyle.prototype, "opacity");
5064
- __decorateClass$H([
5064
+ __decorateClass$I([
5065
5065
  property({ default: 0 })
5066
5066
  ], CanvasItemStyle.prototype, "borderWidth");
5067
- __decorateClass$H([
5067
+ __decorateClass$I([
5068
5068
  property({ default: 0 })
5069
5069
  ], CanvasItemStyle.prototype, "borderRadius");
5070
- __decorateClass$H([
5070
+ __decorateClass$I([
5071
5071
  property({ default: "#000000" })
5072
5072
  ], CanvasItemStyle.prototype, "borderColor");
5073
- __decorateClass$H([
5073
+ __decorateClass$I([
5074
5074
  property({ default: "none" })
5075
5075
  ], CanvasItemStyle.prototype, "borderStyle");
5076
- __decorateClass$H([
5076
+ __decorateClass$I([
5077
5077
  property({ default: 0 })
5078
5078
  ], CanvasItemStyle.prototype, "outlineWidth");
5079
- __decorateClass$H([
5079
+ __decorateClass$I([
5080
5080
  property({ default: 0 })
5081
5081
  ], CanvasItemStyle.prototype, "outlineOffset");
5082
- __decorateClass$H([
5082
+ __decorateClass$I([
5083
5083
  property({ default: "#000000" })
5084
5084
  ], CanvasItemStyle.prototype, "outlineColor");
5085
- __decorateClass$H([
5085
+ __decorateClass$I([
5086
5086
  property({ default: "none" })
5087
5087
  ], CanvasItemStyle.prototype, "outlineStyle");
5088
- __decorateClass$H([
5088
+ __decorateClass$I([
5089
5089
  property({ default: "visible" })
5090
5090
  ], CanvasItemStyle.prototype, "visibility");
5091
- __decorateClass$H([
5091
+ __decorateClass$I([
5092
5092
  property({ default: "visible" })
5093
5093
  ], CanvasItemStyle.prototype, "overflow");
5094
- __decorateClass$H([
5094
+ __decorateClass$I([
5095
5095
  property({ default: "auto" })
5096
5096
  ], CanvasItemStyle.prototype, "pointerEvents");
5097
5097
  const transformStyle = getDefaultTransformStyle();
@@ -5103,13 +5103,13 @@ for (const key in textStyle) {
5103
5103
  defineProperty(CanvasItemStyle, key, { default: textStyle[key] });
5104
5104
  }
5105
5105
 
5106
- var __defProp$G = Object.defineProperty;
5107
- var __decorateClass$G = (decorators, target, key, kind) => {
5106
+ var __defProp$H = Object.defineProperty;
5107
+ var __decorateClass$H = (decorators, target, key, kind) => {
5108
5108
  var result = undefined ;
5109
5109
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5110
5110
  if (decorator = decorators[i])
5111
5111
  result = (decorator(target, key, result) ) || result;
5112
- if (result) __defProp$G(target, key, result);
5112
+ if (result) __defProp$H(target, key, result);
5113
5113
  return result;
5114
5114
  };
5115
5115
  class Texture2D extends Resource {
@@ -5235,32 +5235,32 @@ class Texture2D extends Resource {
5235
5235
  }
5236
5236
  }
5237
5237
  }
5238
- __decorateClass$G([
5238
+ __decorateClass$H([
5239
5239
  protectedProperty()
5240
5240
  ], Texture2D.prototype, "source");
5241
- __decorateClass$G([
5241
+ __decorateClass$H([
5242
5242
  property({ default: 0 })
5243
5243
  ], Texture2D.prototype, "width");
5244
- __decorateClass$G([
5244
+ __decorateClass$H([
5245
5245
  property({ default: 0 })
5246
5246
  ], Texture2D.prototype, "height");
5247
- __decorateClass$G([
5247
+ __decorateClass$H([
5248
5248
  property({ default: "linear" })
5249
5249
  ], Texture2D.prototype, "filterMode");
5250
- __decorateClass$G([
5250
+ __decorateClass$H([
5251
5251
  property({ default: "clamp_to_edge" })
5252
5252
  ], Texture2D.prototype, "wrapMode");
5253
- __decorateClass$G([
5253
+ __decorateClass$H([
5254
5254
  property({ default: 1 })
5255
5255
  ], Texture2D.prototype, "pixelRatio");
5256
5256
 
5257
- var __defProp$F = Object.defineProperty;
5258
- var __decorateClass$F = (decorators, target, key, kind) => {
5257
+ var __defProp$G = Object.defineProperty;
5258
+ var __decorateClass$G = (decorators, target, key, kind) => {
5259
5259
  var result = undefined ;
5260
5260
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5261
5261
  if (decorator = decorators[i])
5262
5262
  result = (decorator(target, key, result) ) || result;
5263
- if (result) __defProp$F(target, key, result);
5263
+ if (result) __defProp$G(target, key, result);
5264
5264
  return result;
5265
5265
  };
5266
5266
  class CanvasTexture extends Texture2D {
@@ -5279,7 +5279,7 @@ class CanvasTexture extends Texture2D {
5279
5279
  super._updateProperty(key, value, oldValue, declaration);
5280
5280
  }
5281
5281
  }
5282
- __decorateClass$F([
5282
+ __decorateClass$G([
5283
5283
  property({ default: 2 })
5284
5284
  ], CanvasTexture.prototype, "pixelRatio");
5285
5285
 
@@ -5437,13 +5437,13 @@ class PixelsTexture extends Texture2D {
5437
5437
  }
5438
5438
  }
5439
5439
 
5440
- var __defProp$E = Object.defineProperty;
5441
- var __decorateClass$E = (decorators, target, key, kind) => {
5440
+ var __defProp$F = Object.defineProperty;
5441
+ var __decorateClass$F = (decorators, target, key, kind) => {
5442
5442
  var result = undefined ;
5443
5443
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5444
5444
  if (decorator = decorators[i])
5445
5445
  result = (decorator(target, key, result) ) || result;
5446
- if (result) __defProp$E(target, key, result);
5446
+ if (result) __defProp$F(target, key, result);
5447
5447
  return result;
5448
5448
  };
5449
5449
  function resolveOptions(options) {
@@ -5687,10 +5687,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5687
5687
  }
5688
5688
  }
5689
5689
  };
5690
- __decorateClass$E([
5690
+ __decorateClass$F([
5691
5691
  protectedProperty({ default: true })
5692
5692
  ], _VideoTexture.prototype, "autoUpdate");
5693
- __decorateClass$E([
5693
+ __decorateClass$F([
5694
5694
  protectedProperty({ default: 0 })
5695
5695
  ], _VideoTexture.prototype, "fps");
5696
5696
  let VideoTexture = _VideoTexture;
@@ -5860,14 +5860,14 @@ class CanvasContext extends Path2D {
5860
5860
  }
5861
5861
  }
5862
5862
 
5863
- var __defProp$D = Object.defineProperty;
5864
- var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
5865
- var __decorateClass$D = (decorators, target, key, kind) => {
5866
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$C(target, key) : target;
5863
+ var __defProp$E = Object.defineProperty;
5864
+ var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
5865
+ var __decorateClass$E = (decorators, target, key, kind) => {
5866
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$D(target, key) : target;
5867
5867
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5868
5868
  if (decorator = decorators[i])
5869
5869
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5870
- if (kind && result) __defProp$D(target, key, result);
5870
+ if (kind && result) __defProp$E(target, key, result);
5871
5871
  return result;
5872
5872
  };
5873
5873
  let Node = class extends CoreObject {
@@ -6010,9 +6010,9 @@ let Node = class extends CoreObject {
6010
6010
  case "inherit":
6011
6011
  return this._parent?.canProcess() ?? true;
6012
6012
  case "pausable":
6013
- return this._tree.paused;
6014
- case "when_paused":
6015
6013
  return !this._tree.paused;
6014
+ case "when_paused":
6015
+ return this._tree.paused;
6016
6016
  case "always":
6017
6017
  return true;
6018
6018
  case "disabled":
@@ -6292,33 +6292,33 @@ let Node = class extends CoreObject {
6292
6292
  return node;
6293
6293
  }
6294
6294
  };
6295
- __decorateClass$D([
6295
+ __decorateClass$E([
6296
6296
  property()
6297
6297
  ], Node.prototype, "name", 2);
6298
- __decorateClass$D([
6298
+ __decorateClass$E([
6299
6299
  property()
6300
6300
  ], Node.prototype, "mask", 2);
6301
- __decorateClass$D([
6301
+ __decorateClass$E([
6302
6302
  property({ default: "inherit" })
6303
6303
  ], Node.prototype, "processMode", 2);
6304
- __decorateClass$D([
6304
+ __decorateClass$E([
6305
6305
  property({ default: "inherit" })
6306
6306
  ], Node.prototype, "renderMode", 2);
6307
- __decorateClass$D([
6307
+ __decorateClass$E([
6308
6308
  property({ default: "default" })
6309
6309
  ], Node.prototype, "internalMode", 2);
6310
- Node = __decorateClass$D([
6310
+ Node = __decorateClass$E([
6311
6311
  customNode("Node")
6312
6312
  ], Node);
6313
6313
 
6314
- var __defProp$C = Object.defineProperty;
6315
- var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6316
- var __decorateClass$C = (decorators, target, key, kind) => {
6317
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$B(target, key) : target;
6314
+ var __defProp$D = Object.defineProperty;
6315
+ var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
6316
+ var __decorateClass$D = (decorators, target, key, kind) => {
6317
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$C(target, key) : target;
6318
6318
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6319
6319
  if (decorator = decorators[i])
6320
6320
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6321
- if (kind && result) __defProp$C(target, key, result);
6321
+ if (kind && result) __defProp$D(target, key, result);
6322
6322
  return result;
6323
6323
  };
6324
6324
  let TimelineNode = class extends Node {
@@ -6377,75 +6377,236 @@ let TimelineNode = class extends Node {
6377
6377
  super._process(delta);
6378
6378
  }
6379
6379
  };
6380
- __decorateClass$C([
6380
+ __decorateClass$D([
6381
6381
  property({ default: 0 })
6382
6382
  ], TimelineNode.prototype, "delay", 2);
6383
- __decorateClass$C([
6383
+ __decorateClass$D([
6384
6384
  property({ default: 0 })
6385
6385
  ], TimelineNode.prototype, "duration", 2);
6386
- __decorateClass$C([
6386
+ __decorateClass$D([
6387
6387
  property({ default: false })
6388
6388
  ], TimelineNode.prototype, "paused", 2);
6389
- TimelineNode = __decorateClass$C([
6389
+ TimelineNode = __decorateClass$D([
6390
6390
  customNode("TimelineNode")
6391
6391
  ], TimelineNode);
6392
6392
 
6393
- var __defProp$B = Object.defineProperty;
6394
- var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6395
- var __decorateClass$B = (decorators, target, key, kind) => {
6396
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$A(target, key) : target;
6393
+ var __defProp$C = Object.defineProperty;
6394
+ var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6395
+ var __decorateClass$C = (decorators, target, key, kind) => {
6396
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$B(target, key) : target;
6397
6397
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6398
6398
  if (decorator = decorators[i])
6399
6399
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6400
- if (kind && result) __defProp$B(target, key, result);
6400
+ if (kind && result) __defProp$C(target, key, result);
6401
6401
  return result;
6402
6402
  };
6403
- let Effect = class extends TimelineNode {
6404
- material;
6405
- mode;
6406
- get _mode() {
6407
- return this.mode ?? "parent";
6408
- }
6409
- /** Viewports */
6410
- viewport1 = new Viewport();
6411
- viewport2 = new Viewport();
6412
- /** Render call */
6413
- _renderId = 0;
6414
- _renderViewport;
6415
- /** Temporary nodes for transition */
6416
- _previousSibling;
6417
- _nextSibling;
6418
- constructor(properties, children = []) {
6403
+ let Viewport = class extends Node {
6404
+ constructor(flipY = false) {
6419
6405
  super();
6420
- this._onProcessing = this._onProcessing.bind(this);
6421
- this._onNodeProcessed = this._onNodeProcessed.bind(this);
6422
- this.setProperties(properties).append(children);
6406
+ this.flipY = flipY;
6407
+ this._projection.flipY(flipY);
6408
+ }
6409
+ get valid() {
6410
+ return Boolean(this.width && this.height);
6411
+ }
6412
+ _projection = new Projection2D();
6413
+ _framebufferIndex = 0;
6414
+ _framebuffers = [
6415
+ { texture: new ViewportTexture(), needsUpload: false },
6416
+ { texture: new ViewportTexture(), needsUpload: false }
6417
+ ];
6418
+ get framebuffer() {
6419
+ return this._framebuffers[this._framebufferIndex];
6420
+ }
6421
+ get texture() {
6422
+ return this.framebuffer.texture;
6423
+ }
6424
+ /** @internal */
6425
+ _glFramebufferOptions(renderer) {
6426
+ const { width, height } = this;
6427
+ const { pixelRatio } = renderer;
6428
+ this._framebuffers.forEach((framebuffer) => {
6429
+ const texture = framebuffer.texture;
6430
+ texture.pixelRatio = pixelRatio;
6431
+ texture.width = width;
6432
+ texture.height = height;
6433
+ texture.upload(renderer);
6434
+ });
6435
+ return {
6436
+ width,
6437
+ height,
6438
+ colorTextures: [this.texture._glTexture(renderer)]
6439
+ };
6440
+ }
6441
+ /** @internal */
6442
+ _glFramebuffer(renderer) {
6443
+ return renderer.getRelated(this.framebuffer, () => {
6444
+ return renderer.framebuffer.create(
6445
+ this._glFramebufferOptions(renderer)
6446
+ );
6447
+ });
6423
6448
  }
6424
6449
  _updateProperty(key, value, oldValue, declaration) {
6425
6450
  super._updateProperty(key, value, oldValue, declaration);
6426
6451
  switch (key) {
6427
- case "glsl": {
6428
- const material = new EffectMaterial(value);
6429
- if (!this.mode && material.has.transition) {
6430
- this.mode = "transition";
6431
- }
6432
- this.material = material;
6452
+ case "x":
6453
+ case "y":
6454
+ this.requestUpload();
6455
+ this._projection.translate(this.x, this.y);
6456
+ this.emit("updateRect");
6433
6457
  break;
6434
- }
6435
- case "glslSrc": {
6436
- if (value) {
6437
- assets.text.load(value).then((glsl) => this.glsl = glsl);
6438
- } else {
6439
- this.glsl = "";
6440
- }
6458
+ case "width":
6459
+ case "height":
6460
+ this.requestUpload();
6461
+ this._projection.resize(this.width, this.height);
6462
+ this.emit("updateRect");
6441
6463
  break;
6442
- }
6443
6464
  }
6444
6465
  }
6445
- _treeEnter(tree) {
6446
- tree.on("processing", this._onProcessing);
6447
- tree.on("nodeProcessed", this._onNodeProcessed);
6448
- this.viewport1.setTree(tree);
6466
+ requestUpload() {
6467
+ this._framebuffers.forEach((framebuffer) => framebuffer.needsUpload = true);
6468
+ }
6469
+ resize(width, height) {
6470
+ this.width = width;
6471
+ this.height = height;
6472
+ }
6473
+ upload(renderer) {
6474
+ const framebuffer = this.framebuffer;
6475
+ if (framebuffer.needsUpload && this.valid) {
6476
+ framebuffer.needsUpload = false;
6477
+ renderer.framebuffer.update(
6478
+ this._glFramebuffer(renderer),
6479
+ this._glFramebufferOptions(renderer)
6480
+ );
6481
+ return true;
6482
+ }
6483
+ return false;
6484
+ }
6485
+ activate(renderer) {
6486
+ if (this.valid) {
6487
+ renderer.flush();
6488
+ this._tree?.setCurrentViewport(this);
6489
+ renderer.framebuffer.bind(this._glFramebuffer(renderer));
6490
+ this.upload(renderer);
6491
+ return true;
6492
+ }
6493
+ return false;
6494
+ }
6495
+ redraw(renderer, cb) {
6496
+ if (this.valid) {
6497
+ renderer.flush();
6498
+ const texture = this.framebuffer.texture;
6499
+ this._framebufferIndex = (this._framebufferIndex + 1) % this._framebuffers.length;
6500
+ this.activate(renderer);
6501
+ renderer.clear();
6502
+ texture.activate(renderer, 0);
6503
+ cb();
6504
+ return true;
6505
+ }
6506
+ return false;
6507
+ }
6508
+ activateWithCopy(renderer, target) {
6509
+ this.resize(target.width, target.height);
6510
+ if (this.activate(renderer)) {
6511
+ renderer.clear();
6512
+ target.texture.activate(renderer, 0);
6513
+ QuadUvGeometry.draw(renderer, UvMaterial.instance, {
6514
+ sampler: 0
6515
+ });
6516
+ }
6517
+ }
6518
+ render(renderer, next) {
6519
+ const oldViewport = this._tree?.getCurrentViewport();
6520
+ this.activate(renderer);
6521
+ renderer.clear();
6522
+ super.render(renderer, next);
6523
+ renderer.flush();
6524
+ if (oldViewport) {
6525
+ oldViewport.activate(renderer);
6526
+ } else {
6527
+ renderer.framebuffer.bind(null);
6528
+ this._tree?.setCurrentViewport(undefined);
6529
+ }
6530
+ }
6531
+ getRect() {
6532
+ return new Rect2(this.x, this.y, this.width, this.height);
6533
+ }
6534
+ toProjectionArray(transpose = false) {
6535
+ return this._projection.toArray(transpose);
6536
+ }
6537
+ };
6538
+ __decorateClass$C([
6539
+ property({ default: 0 })
6540
+ ], Viewport.prototype, "x", 2);
6541
+ __decorateClass$C([
6542
+ property({ default: 0 })
6543
+ ], Viewport.prototype, "y", 2);
6544
+ __decorateClass$C([
6545
+ property({ default: 0 })
6546
+ ], Viewport.prototype, "width", 2);
6547
+ __decorateClass$C([
6548
+ property({ default: 0 })
6549
+ ], Viewport.prototype, "height", 2);
6550
+ Viewport = __decorateClass$C([
6551
+ customNode("Viewport")
6552
+ ], Viewport);
6553
+
6554
+ var __defProp$B = Object.defineProperty;
6555
+ var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6556
+ var __decorateClass$B = (decorators, target, key, kind) => {
6557
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$A(target, key) : target;
6558
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6559
+ if (decorator = decorators[i])
6560
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6561
+ if (kind && result) __defProp$B(target, key, result);
6562
+ return result;
6563
+ };
6564
+ let Effect = class extends TimelineNode {
6565
+ material;
6566
+ effectMode;
6567
+ get _effectMode() {
6568
+ return this.effectMode ?? "parent";
6569
+ }
6570
+ /** Viewports */
6571
+ viewport1 = new Viewport();
6572
+ viewport2 = new Viewport();
6573
+ /** Render call */
6574
+ _renderId = 0;
6575
+ _renderViewport;
6576
+ /** Temporary nodes for transition */
6577
+ _previousSibling;
6578
+ _nextSibling;
6579
+ constructor(properties, children = []) {
6580
+ super();
6581
+ this._onProcessing = this._onProcessing.bind(this);
6582
+ this._onNodeProcessed = this._onNodeProcessed.bind(this);
6583
+ this.setProperties(properties).append(children);
6584
+ }
6585
+ _updateProperty(key, value, oldValue, declaration) {
6586
+ super._updateProperty(key, value, oldValue, declaration);
6587
+ switch (key) {
6588
+ case "glsl": {
6589
+ const material = new EffectMaterial(value);
6590
+ if (!this.effectMode && material.has.transition) {
6591
+ this.effectMode = "transition";
6592
+ }
6593
+ this.material = material;
6594
+ break;
6595
+ }
6596
+ case "glslSrc": {
6597
+ if (value) {
6598
+ assets.text.load(value).then((glsl) => this.glsl = glsl);
6599
+ } else {
6600
+ this.glsl = "";
6601
+ }
6602
+ break;
6603
+ }
6604
+ }
6605
+ }
6606
+ _treeEnter(tree) {
6607
+ tree.on("processing", this._onProcessing);
6608
+ tree.on("nodeProcessed", this._onNodeProcessed);
6609
+ this.viewport1.setTree(tree);
6449
6610
  this.viewport2.setTree(tree);
6450
6611
  }
6451
6612
  _treeExit(oldTree) {
@@ -6456,7 +6617,7 @@ let Effect = class extends TimelineNode {
6456
6617
  }
6457
6618
  _onProcessing() {
6458
6619
  this._updateCurrentTime();
6459
- switch (this._mode) {
6620
+ switch (this._effectMode) {
6460
6621
  case "transition":
6461
6622
  this._previousSibling = this.previousSibling;
6462
6623
  this._nextSibling = this.nextSibling;
@@ -6473,7 +6634,7 @@ let Effect = class extends TimelineNode {
6473
6634
  const renderStack = this._tree?.renderStack;
6474
6635
  if (!renderStack)
6475
6636
  return;
6476
- switch (this._mode) {
6637
+ switch (this._effectMode) {
6477
6638
  case "transition":
6478
6639
  if (node.is(this._previousSibling)) {
6479
6640
  this._previousSibling = undefined;
@@ -6513,8 +6674,10 @@ let Effect = class extends TimelineNode {
6513
6674
  }
6514
6675
  }
6515
6676
  _onProcess(delta = 0) {
6677
+ if (!this.canProcess())
6678
+ return;
6516
6679
  this._renderId = 0;
6517
- switch (this._mode) {
6680
+ switch (this._effectMode) {
6518
6681
  case "before":
6519
6682
  super._onProcess(delta);
6520
6683
  break;
@@ -6573,7 +6736,7 @@ let Effect = class extends TimelineNode {
6573
6736
  this.viewport1.activate(renderer);
6574
6737
  this.apply(renderer, this.viewport1, {
6575
6738
  redraw: true,
6576
- target: this._mode === "parent" ? this._parent ?? undefined : undefined,
6739
+ target: this._effectMode === "parent" ? this._parent ?? undefined : undefined,
6577
6740
  targetArea: this._parseTargetArea()
6578
6741
  });
6579
6742
  oldViewport.activate(renderer);
@@ -6583,7 +6746,7 @@ let Effect = class extends TimelineNode {
6583
6746
  }
6584
6747
  }
6585
6748
  _parseTargetArea() {
6586
- if (this._mode === "parent" && this._parent && "getRect" in this._parent) {
6749
+ if (this._effectMode === "parent" && this._parent && "getRect" in this._parent) {
6587
6750
  const rect = this._parent.getRect();
6588
6751
  if (rect) {
6589
6752
  return [
@@ -6596,7 +6759,7 @@ let Effect = class extends TimelineNode {
6596
6759
  }
6597
6760
  }
6598
6761
  _render(renderer) {
6599
- switch (this._mode) {
6762
+ switch (this._effectMode) {
6600
6763
  case "before":
6601
6764
  this._renderBefore(renderer);
6602
6765
  break;
@@ -6639,7 +6802,7 @@ __decorateClass$B([
6639
6802
  ], Effect.prototype, "material", 2);
6640
6803
  __decorateClass$B([
6641
6804
  property()
6642
- ], Effect.prototype, "mode", 2);
6805
+ ], Effect.prototype, "effectMode", 2);
6643
6806
  __decorateClass$B([
6644
6807
  property({ default: "" })
6645
6808
  ], Effect.prototype, "glsl", 2);
@@ -7726,249 +7889,98 @@ var __decorateClass$r = (decorators, target, key, kind) => {
7726
7889
  return result;
7727
7890
  };
7728
7891
  var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
7729
- let KawaseEffect = class extends Effect {
7730
- blur = 10;
7731
- quality = 10;
7732
- apply(renderer, target) {
7733
- const currentTimeProgress = this.currentTimeProgress;
7734
- let sampler;
7735
- let progress;
7736
- if (currentTimeProgress < 0.5) {
7737
- sampler = 0;
7738
- progress = (0.5 - currentTimeProgress) / 0.5;
7739
- } else {
7740
- sampler = 1;
7741
- progress = (currentTimeProgress - 0.5) / 0.5;
7892
+ let MaskEffect = class extends Effect {
7893
+ texture;
7894
+ constructor(properties, children = []) {
7895
+ super();
7896
+ this.setProperties(properties).append(children);
7897
+ }
7898
+ async load() {
7899
+ this.texture = undefined;
7900
+ if (this.src) {
7901
+ this.texture = await assets.texture.load(this.src);
7742
7902
  }
7743
- const blur = this.blur;
7744
- const quality = this.quality;
7745
- const width = target.width;
7746
- const height = target.height;
7747
- const drawCalls = [];
7748
- const kernels = [blur];
7749
- if (blur > 0) {
7750
- let k = blur;
7751
- const step = blur / quality;
7752
- for (let i = 1; i < quality; i++) {
7753
- k -= step;
7754
- kernels.push(k);
7755
- }
7903
+ }
7904
+ _updateProperty(key, value, oldValue, declaration) {
7905
+ super._updateProperty(key, value, oldValue, declaration);
7906
+ switch (key) {
7907
+ case "src":
7908
+ this.load();
7909
+ break;
7910
+ case "texture":
7911
+ oldValue?.destroy?.();
7912
+ break;
7756
7913
  }
7757
- const uvX = 1 / width;
7758
- const uvY = 1 / height;
7759
- const uOffset = [];
7760
- let offset;
7761
- const last = quality - 1;
7762
- for (let i = 0; i < last; i++) {
7763
- offset = kernels[i] + 0.5;
7764
- uOffset[0] = offset * uvX;
7765
- uOffset[1] = offset * uvY;
7766
- drawCalls.push({
7767
- offset: uOffset
7914
+ }
7915
+ apply(renderer, source, context) {
7916
+ if (this.texture && context.targetArea) {
7917
+ source.redraw(renderer, () => {
7918
+ this.texture.activate(renderer, 1);
7919
+ QuadUvGeometry.draw(renderer, MaskEffect.material, {
7920
+ sampler: 0,
7921
+ mask: 1,
7922
+ area: context.targetArea
7923
+ });
7924
+ renderer.texture.unbind(1);
7768
7925
  });
7769
7926
  }
7770
- offset = kernels[last] + 0.5;
7771
- uOffset[0] = offset * uvX;
7772
- uOffset[1] = offset * uvY;
7773
- drawCalls.push({
7774
- offset: uOffset
7775
- });
7776
- drawCalls.forEach((uniforms) => {
7777
- QuadUvGeometry.draw(renderer, KawaseEffect.material, {
7778
- sampler,
7779
- progress,
7780
- ...uniforms
7781
- });
7782
- });
7783
7927
  }
7784
7928
  };
7785
- __publicField$8(KawaseEffect, "material", new Material({
7786
- vert: `attribute vec2 position;
7929
+ __publicField$8(MaskEffect, "material", new Material({
7930
+ vert: `precision mediump float;
7931
+ attribute vec2 position;
7787
7932
  attribute vec2 uv;
7788
7933
  varying vec2 vUv;
7789
7934
  void main() {
7790
7935
  gl_Position = vec4(position, 0.0, 1.0);
7791
7936
  vUv = uv;
7792
7937
  }`,
7793
- frag: `precision highp float;
7794
- varying vec2 vUv;
7938
+ frag: `varying vec2 vUv;
7795
7939
  uniform sampler2D sampler;
7796
- uniform vec2 offset;
7797
- uniform float progress;
7940
+ uniform sampler2D mask;
7941
+ uniform float area[4];
7798
7942
 
7799
7943
  void main(void) {
7800
- vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);
7801
- vec4 color = vec4(0.0);
7802
- color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));
7803
- color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));
7804
- color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y - offset1.y));
7805
- color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y - offset1.y));
7806
- color *= 0.25;
7807
- gl_FragColor = color;
7944
+ if (
7945
+ vUv.x > area[0]
7946
+ && vUv.x < (area[0] + area[2])
7947
+ && (1.0 - vUv.y) > area[1]
7948
+ && (1.0 - vUv.y) < (area[1] + area[3])
7949
+ ) {
7950
+ vec4 color = texture2D(sampler, vUv);
7951
+ vec2 uv = vec2(
7952
+ (vUv.x - area[0]) / area[2],
7953
+ ((1.0 - vUv.y) - area[1]) / area[3]
7954
+ );
7955
+ vec4 maskColor = texture2D(mask, uv);
7956
+ gl_FragColor = mix(vec4(0.), color, maskColor.a);
7957
+ } else {
7958
+ gl_FragColor = vec4(0.);
7959
+ }
7808
7960
  }`
7809
7961
  }));
7810
- KawaseEffect = __decorateClass$r([
7811
- customNode("KawaseEffect")
7812
- ], KawaseEffect);
7813
-
7814
- var __defProp$q = Object.defineProperty;
7815
- var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
7816
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7817
- var __decorateClass$q = (decorators, target, key, kind) => {
7818
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$p(target, key) : target;
7819
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
7820
- if (decorator = decorators[i])
7821
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7822
- if (kind && result) __defProp$q(target, key, result);
7823
- return result;
7824
- };
7825
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
7826
- let LeftEraseEffect = class extends Effect {
7827
- apply(renderer) {
7828
- QuadUvGeometry.draw(renderer, LeftEraseEffect.material, {
7829
- previous: 0,
7830
- next: 1,
7831
- progress: this.currentTimeProgress
7832
- });
7833
- }
7834
- };
7835
- __publicField$7(LeftEraseEffect, "material", new Material({
7836
- vert: `attribute vec2 position;
7837
- attribute vec2 uv;
7838
- varying vec2 vUv;
7839
- void main() {
7840
- gl_Position = vec4(position, 0.0, 1.0);
7841
- vUv = uv;
7842
- }`,
7843
- frag: `precision highp float;
7844
- varying vec2 vUv;
7845
- uniform float progress;
7846
- uniform sampler2D previous;
7847
- uniform sampler2D next;
7848
-
7849
- float easeInOutQuint(float t) {
7850
- return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;
7851
- }
7852
-
7853
- void main() {
7854
- vec4 src1Color = texture2D(previous, vUv);
7855
- vec4 src2Color = texture2D(next, vUv);
7856
- float mProgress = 1.0 - progress;
7857
- float mixPercent = 0.0;
7858
- if (vUv.x <= mProgress) {
7859
- mixPercent = 1.0;
7860
- }
7861
- gl_FragColor = mix(src2Color, src1Color, mixPercent);
7862
- }`
7863
- }));
7864
- LeftEraseEffect = __decorateClass$q([
7865
- customNode("LeftEraseEffect")
7866
- ], LeftEraseEffect);
7867
-
7868
- var __defProp$p = Object.defineProperty;
7869
- var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
7870
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7871
- var __decorateClass$p = (decorators, target, key, kind) => {
7872
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$o(target, key) : target;
7873
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
7874
- if (decorator = decorators[i])
7875
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7876
- if (kind && result) __defProp$p(target, key, result);
7877
- return result;
7878
- };
7879
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
7880
- let MaskEffect = class extends Effect {
7881
- texture;
7882
- constructor(properties, children = []) {
7883
- super();
7884
- this.setProperties(properties).append(children);
7885
- }
7886
- async load() {
7887
- this.texture = undefined;
7888
- if (this.src) {
7889
- this.texture = await assets.texture.load(this.src);
7890
- }
7891
- }
7892
- _updateProperty(key, value, oldValue, declaration) {
7893
- super._updateProperty(key, value, oldValue, declaration);
7894
- switch (key) {
7895
- case "src":
7896
- this.load();
7897
- break;
7898
- case "texture":
7899
- oldValue?.destroy?.();
7900
- break;
7901
- }
7902
- }
7903
- apply(renderer, source, context) {
7904
- if (this.texture && context.targetArea) {
7905
- source.redraw(renderer, () => {
7906
- this.texture.activate(renderer, 1);
7907
- QuadUvGeometry.draw(renderer, MaskEffect.material, {
7908
- sampler: 0,
7909
- mask: 1,
7910
- area: context.targetArea
7911
- });
7912
- renderer.texture.unbind(1);
7913
- });
7914
- }
7915
- }
7916
- };
7917
- __publicField$6(MaskEffect, "material", new Material({
7918
- vert: `precision mediump float;
7919
- attribute vec2 position;
7920
- attribute vec2 uv;
7921
- varying vec2 vUv;
7922
- void main() {
7923
- gl_Position = vec4(position, 0.0, 1.0);
7924
- vUv = uv;
7925
- }`,
7926
- frag: `varying vec2 vUv;
7927
- uniform sampler2D sampler;
7928
- uniform sampler2D mask;
7929
- uniform float area[4];
7930
-
7931
- void main(void) {
7932
- if (
7933
- vUv.x > area[0]
7934
- && vUv.x < (area[0] + area[2])
7935
- && (1.0 - vUv.y) > area[1]
7936
- && (1.0 - vUv.y) < (area[1] + area[3])
7937
- ) {
7938
- vec4 color = texture2D(sampler, vUv);
7939
- vec2 uv = vec2(
7940
- (vUv.x - area[0]) / area[2],
7941
- ((1.0 - vUv.y) - area[1]) / area[3]
7942
- );
7943
- vec4 maskColor = texture2D(mask, uv);
7944
- gl_FragColor = mix(vec4(0.), color, maskColor.a);
7945
- } else {
7946
- gl_FragColor = vec4(0.);
7947
- }
7948
- }`
7949
- }));
7950
- __decorateClass$p([
7962
+ __decorateClass$r([
7951
7963
  protectedProperty()
7952
7964
  ], MaskEffect.prototype, "texture", 2);
7953
- __decorateClass$p([
7965
+ __decorateClass$r([
7954
7966
  property({ default: "" })
7955
7967
  ], MaskEffect.prototype, "src", 2);
7956
- MaskEffect = __decorateClass$p([
7968
+ MaskEffect = __decorateClass$r([
7957
7969
  customNode("MaskEffect")
7958
7970
  ], MaskEffect);
7959
7971
 
7960
- var __defProp$o = Object.defineProperty;
7961
- var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
7962
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7963
- var __decorateClass$o = (decorators, target, key, kind) => {
7964
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$n(target, key) : target;
7972
+ var __defProp$q = Object.defineProperty;
7973
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
7974
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7975
+ var __decorateClass$q = (decorators, target, key, kind) => {
7976
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$p(target, key) : target;
7965
7977
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7966
7978
  if (decorator = decorators[i])
7967
7979
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7968
- if (kind && result) __defProp$o(target, key, result);
7980
+ if (kind && result) __defProp$q(target, key, result);
7969
7981
  return result;
7970
7982
  };
7971
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
7983
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
7972
7984
  let PixelateEffect = class extends Effect {
7973
7985
  size;
7974
7986
  constructor(size = 10) {
@@ -7985,7 +7997,7 @@ let PixelateEffect = class extends Effect {
7985
7997
  });
7986
7998
  }
7987
7999
  };
7988
- __publicField$5(PixelateEffect, "material", new Material({
8000
+ __publicField$7(PixelateEffect, "material", new Material({
7989
8001
  vert: `precision mediump float;
7990
8002
  attribute vec2 position;
7991
8003
  attribute vec2 uv;
@@ -8022,25 +8034,25 @@ void main(void) {
8022
8034
  gl_FragColor = texture2D(sampler, coord);
8023
8035
  }`
8024
8036
  }));
8025
- __decorateClass$o([
8037
+ __decorateClass$q([
8026
8038
  property()
8027
8039
  ], PixelateEffect.prototype, "size", 2);
8028
- PixelateEffect = __decorateClass$o([
8040
+ PixelateEffect = __decorateClass$q([
8029
8041
  customNode("PixelateEffect")
8030
8042
  ], PixelateEffect);
8031
8043
 
8032
- var __defProp$n = Object.defineProperty;
8033
- var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8034
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8035
- var __decorateClass$n = (decorators, target, key, kind) => {
8036
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$m(target, key) : target;
8044
+ var __defProp$p = Object.defineProperty;
8045
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8046
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8047
+ var __decorateClass$p = (decorators, target, key, kind) => {
8048
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$o(target, key) : target;
8037
8049
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8038
8050
  if (decorator = decorators[i])
8039
8051
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8040
- if (kind && result) __defProp$n(target, key, result);
8052
+ if (kind && result) __defProp$p(target, key, result);
8041
8053
  return result;
8042
8054
  };
8043
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
8055
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
8044
8056
  let ShadowEffect = class extends Effect {
8045
8057
  blur = new BlurEffect();
8046
8058
  viewport3 = new Viewport();
@@ -8067,7 +8079,7 @@ let ShadowEffect = class extends Effect {
8067
8079
  });
8068
8080
  }
8069
8081
  };
8070
- __publicField$4(ShadowEffect, "material", new Material({
8082
+ __publicField$6(ShadowEffect, "material", new Material({
8071
8083
  vert: `precision mediump float;
8072
8084
  attribute vec2 position;
8073
8085
  attribute vec2 uv;
@@ -8090,67 +8102,41 @@ void main(void) {
8090
8102
  gl_FragColor = sample;
8091
8103
  }`
8092
8104
  }));
8093
- ShadowEffect = __decorateClass$n([
8105
+ ShadowEffect = __decorateClass$p([
8094
8106
  customNode("ShadowEffect")
8095
8107
  ], ShadowEffect);
8096
8108
 
8097
- var __defProp$m = Object.defineProperty;
8098
- var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8099
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8100
- var __decorateClass$m = (decorators, target, key, kind) => {
8101
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$l(target, key) : target;
8109
+ var __defProp$o = Object.defineProperty;
8110
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8111
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8112
+ var __decorateClass$o = (decorators, target, key, kind) => {
8113
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$n(target, key) : target;
8102
8114
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8103
8115
  if (decorator = decorators[i])
8104
8116
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8105
- if (kind && result) __defProp$m(target, key, result);
8117
+ if (kind && result) __defProp$o(target, key, result);
8106
8118
  return result;
8107
8119
  };
8108
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
8109
- let TiltShiftEffect = class extends Effect {
8110
- blur = 100;
8111
- gradientBlur = 600;
8112
- apply(renderer, target) {
8113
- const currentTimeProgress = this.currentTimeProgress;
8114
- let sampler;
8115
- let progress;
8116
- if (currentTimeProgress < 0.5) {
8117
- sampler = 0;
8118
- progress = (0.5 - currentTimeProgress) / 0.5;
8119
- } else {
8120
- sampler = 1;
8121
- progress = (currentTimeProgress - 0.5) / 0.5;
8122
- }
8123
- const width = target.width;
8124
- const height = target.height;
8125
- const start = [0, height / 2];
8126
- const end = [600, height / 2];
8127
- const texSize = [width, height];
8128
- const dx = end[0] - start[0];
8129
- const dy = end[1] - start[1];
8130
- const d = Math.sqrt(dx * dx + dy * dy);
8131
- QuadUvGeometry.draw(renderer, TiltShiftEffect.material, {
8132
- sampler,
8133
- progress,
8134
- blur: this.blur,
8135
- gradientBlur: this.gradientBlur,
8136
- start,
8137
- end,
8138
- delta: [dx / d, dy / d],
8139
- texSize
8140
- });
8141
- QuadUvGeometry.draw(renderer, TiltShiftEffect.material, {
8142
- sampler,
8143
- progress,
8144
- blur: this.blur,
8145
- gradientBlur: this.gradientBlur,
8146
- start,
8147
- end,
8148
- delta: [-dy / d, dx / d],
8149
- texSize
8120
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
8121
+ let ZoomBlurEffect = class extends Effect {
8122
+ center;
8123
+ innerRadius = 20;
8124
+ radius = -1;
8125
+ strength = 0.1;
8126
+ apply(renderer, source) {
8127
+ source.redraw(renderer, () => {
8128
+ QuadUvGeometry.draw(renderer, ZoomBlurEffect.material, {
8129
+ sampler: 0,
8130
+ center: this.center ?? [source.width / 2, source.height / 2],
8131
+ innerRadius: this.innerRadius,
8132
+ radius: this.radius,
8133
+ strength: this.strength,
8134
+ inputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
8135
+ });
8150
8136
  });
8151
8137
  }
8152
8138
  };
8153
- __publicField$3(TiltShiftEffect, "material", new Material({
8139
+ __publicField$5(ZoomBlurEffect, "material", new Material({
8154
8140
  vert: `attribute vec2 position;
8155
8141
  attribute vec2 uv;
8156
8142
  varying vec2 vUv;
@@ -8158,199 +8144,22 @@ void main() {
8158
8144
  gl_Position = vec4(position, 0.0, 1.0);
8159
8145
  vUv = uv;
8160
8146
  }`,
8161
- frag: `precision highp float;
8162
- varying vec2 vUv;
8147
+ frag: `varying vec2 vUv;
8163
8148
  uniform sampler2D sampler;
8164
- uniform float blur;
8165
- uniform float gradientBlur;
8166
- uniform vec2 start;
8167
- uniform vec2 end;
8168
- uniform vec2 delta;
8169
- uniform vec2 texSize;
8170
- uniform float progress;
8149
+ uniform vec4 inputSize;
8171
8150
 
8172
- float random(vec3 scale, float seed) {
8173
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
8174
- }
8151
+ uniform vec2 center;
8152
+ uniform float strength;
8153
+ uniform float innerRadius;
8154
+ uniform float radius;
8175
8155
 
8176
- void main(void) {
8177
- float blur1 = blur - progress * blur;
8178
- float gradientBlur1 = progress * gradientBlur;
8156
+ const float MAX_KERNEL_SIZE = 32.0;
8179
8157
 
8180
- vec4 color = vec4(0.0);
8181
- float total = 0.0;
8182
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
8183
- vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));
8184
- float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;
8185
-
8186
- for (float t = -30.0; t <= 30.0; t++) {
8187
- float percent = (t + offset - 0.5) / 30.0;
8188
- float weight = 1.0 - abs(percent);
8189
- vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);
8190
- sample1.rgb *= sample1.a;
8191
- color += sample1 * weight;
8192
- total += weight;
8193
- }
8194
-
8195
- color /= total;
8196
- color.rgb /= color.a + 0.00001;
8197
-
8198
- gl_FragColor = color;
8199
- }`
8200
- }));
8201
- TiltShiftEffect = __decorateClass$m([
8202
- customNode("TiltShiftEffect")
8203
- ], TiltShiftEffect);
8204
-
8205
- var __defProp$l = Object.defineProperty;
8206
- var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8207
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8208
- var __decorateClass$l = (decorators, target, key, kind) => {
8209
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$k(target, key) : target;
8210
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
8211
- if (decorator = decorators[i])
8212
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8213
- if (kind && result) __defProp$l(target, key, result);
8214
- return result;
8215
- };
8216
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
8217
- let TwistEffect = class extends Effect {
8218
- radius;
8219
- angle = 4;
8220
- padding = 20;
8221
- offset;
8222
- apply(renderer, source) {
8223
- const currentTimeProgress = this.currentTimeProgress;
8224
- let sampler;
8225
- let progress;
8226
- if (currentTimeProgress < 0.5) {
8227
- sampler = 0;
8228
- progress = (0.5 - currentTimeProgress) / 0.5;
8229
- } else {
8230
- sampler = 1;
8231
- progress = (currentTimeProgress - 0.5) / 0.5;
8232
- }
8233
- const width = source.width;
8234
- const height = source.height;
8235
- QuadUvGeometry.draw(renderer, TwistEffect.material, {
8236
- sampler,
8237
- progress,
8238
- filterArea: [width, height, 0, 0],
8239
- radius: this.radius ?? width,
8240
- angle: this.angle,
8241
- padding: this.padding,
8242
- offset: this.offset ?? [width / 2, height / 2]
8243
- });
8244
- }
8245
- };
8246
- __publicField$2(TwistEffect, "material", new Material({
8247
- vert: `attribute vec2 position;
8248
- attribute vec2 uv;
8249
- varying vec2 vUv;
8250
- void main() {
8251
- gl_Position = vec4(position, 0.0, 1.0);
8252
- vUv = uv;
8253
- }`,
8254
- frag: `precision highp float;
8255
- varying vec2 vUv;
8256
- uniform sampler2D sampler;
8257
- uniform float radius;
8258
- uniform float angle;
8259
- uniform vec2 offset;
8260
- uniform vec4 filterArea;
8261
- uniform float progress;
8262
-
8263
- vec2 mapCoord(vec2 coord) {
8264
- coord -= filterArea.zw;
8265
- coord *= filterArea.xy;
8266
- return coord;
8267
- }
8268
-
8269
- vec2 unmapCoord(vec2 coord) {
8270
- coord -= filterArea.zw;
8271
- coord /= filterArea.xy;
8272
- return coord;
8273
- }
8274
-
8275
- vec2 twist(vec2 coord, float radius) {
8276
- coord -= offset;
8277
- float dist = length(coord);
8278
- if (dist < radius) {
8279
- float ratioDist = (radius - dist) / radius;
8280
- float angleMod = ratioDist * ratioDist * angle;
8281
- float s = sin(angleMod);
8282
- float c = cos(angleMod);
8283
- coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);
8284
- }
8285
- coord += offset;
8286
- return coord;
8287
- }
8288
-
8289
- void main(void) {
8290
- vec2 coord = mapCoord(vUv);
8291
- coord = twist(coord, radius - (progress * radius));
8292
- coord = unmapCoord(coord);
8293
- gl_FragColor = texture2D(sampler, coord);
8294
- }`
8295
- }));
8296
- TwistEffect = __decorateClass$l([
8297
- customNode("TwistEffect")
8298
- ], TwistEffect);
8299
-
8300
- var __defProp$k = Object.defineProperty;
8301
- var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8302
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8303
- var __decorateClass$k = (decorators, target, key, kind) => {
8304
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$j(target, key) : target;
8305
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
8306
- if (decorator = decorators[i])
8307
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8308
- if (kind && result) __defProp$k(target, key, result);
8309
- return result;
8310
- };
8311
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
8312
- let ZoomBlurEffect = class extends Effect {
8313
- center;
8314
- innerRadius = 20;
8315
- radius = -1;
8316
- strength = 0.1;
8317
- apply(renderer, source) {
8318
- source.redraw(renderer, () => {
8319
- QuadUvGeometry.draw(renderer, ZoomBlurEffect.material, {
8320
- sampler: 0,
8321
- center: this.center ?? [source.width / 2, source.height / 2],
8322
- innerRadius: this.innerRadius,
8323
- radius: this.radius,
8324
- strength: this.strength,
8325
- inputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
8326
- });
8327
- });
8328
- }
8329
- };
8330
- __publicField$1(ZoomBlurEffect, "material", new Material({
8331
- vert: `attribute vec2 position;
8332
- attribute vec2 uv;
8333
- varying vec2 vUv;
8334
- void main() {
8335
- gl_Position = vec4(position, 0.0, 1.0);
8336
- vUv = uv;
8337
- }`,
8338
- frag: `varying vec2 vUv;
8339
- uniform sampler2D sampler;
8340
- uniform vec4 inputSize;
8341
-
8342
- uniform vec2 center;
8343
- uniform float strength;
8344
- uniform float innerRadius;
8345
- uniform float radius;
8346
-
8347
- const float MAX_KERNEL_SIZE = 32.0;
8348
-
8349
- highp float rand(vec2 co, float seed) {
8350
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
8351
- highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);
8352
- return fract(sin(sn) * c + seed);
8353
- }
8158
+ highp float rand(vec2 co, float seed) {
8159
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
8160
+ highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);
8161
+ return fract(sin(sn) * c + seed);
8162
+ }
8354
8163
 
8355
8164
  void main() {
8356
8165
  float minGradient = innerRadius * 0.3;
@@ -8411,30 +8220,30 @@ void main() {
8411
8220
  gl_FragColor = color;
8412
8221
  }`
8413
8222
  }));
8414
- __decorateClass$k([
8223
+ __decorateClass$o([
8415
8224
  property()
8416
8225
  ], ZoomBlurEffect.prototype, "center", 2);
8417
- __decorateClass$k([
8226
+ __decorateClass$o([
8418
8227
  property()
8419
8228
  ], ZoomBlurEffect.prototype, "innerRadius", 2);
8420
- __decorateClass$k([
8229
+ __decorateClass$o([
8421
8230
  property()
8422
8231
  ], ZoomBlurEffect.prototype, "radius", 2);
8423
- __decorateClass$k([
8232
+ __decorateClass$o([
8424
8233
  property()
8425
8234
  ], ZoomBlurEffect.prototype, "strength", 2);
8426
- ZoomBlurEffect = __decorateClass$k([
8235
+ ZoomBlurEffect = __decorateClass$o([
8427
8236
  customNode("ZoomBlurEffect")
8428
8237
  ], ZoomBlurEffect);
8429
8238
 
8430
- var __defProp$j = Object.defineProperty;
8431
- var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8432
- var __decorateClass$j = (decorators, target, key, kind) => {
8433
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$i(target, key) : target;
8239
+ var __defProp$n = Object.defineProperty;
8240
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8241
+ var __decorateClass$n = (decorators, target, key, kind) => {
8242
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$m(target, key) : target;
8434
8243
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8435
8244
  if (decorator = decorators[i])
8436
8245
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8437
- if (kind && result) __defProp$j(target, key, result);
8246
+ if (kind && result) __defProp$n(target, key, result);
8438
8247
  return result;
8439
8248
  };
8440
8249
  let CanvasItem = class extends TimelineNode {
@@ -8729,13 +8538,13 @@ let CanvasItem = class extends TimelineNode {
8729
8538
  };
8730
8539
  }
8731
8540
  };
8732
- __decorateClass$j([
8541
+ __decorateClass$n([
8733
8542
  property()
8734
8543
  ], CanvasItem.prototype, "modulate", 2);
8735
- __decorateClass$j([
8544
+ __decorateClass$n([
8736
8545
  property()
8737
8546
  ], CanvasItem.prototype, "blendMode", 2);
8738
- CanvasItem = __decorateClass$j([
8547
+ CanvasItem = __decorateClass$n([
8739
8548
  customNode("CanvasItem")
8740
8549
  ], CanvasItem);
8741
8550
 
@@ -8765,14 +8574,14 @@ class RenderStack extends Node {
8765
8574
  }
8766
8575
  }
8767
8576
 
8768
- var __defProp$i = Object.defineProperty;
8769
- var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
8770
- var __decorateClass$i = (decorators, target, key, kind) => {
8771
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$h(target, key) : target;
8577
+ var __defProp$m = Object.defineProperty;
8578
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8579
+ var __decorateClass$m = (decorators, target, key, kind) => {
8580
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$l(target, key) : target;
8772
8581
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8773
8582
  if (decorator = decorators[i])
8774
8583
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8775
- if (kind && result) __defProp$i(target, key, result);
8584
+ if (kind && result) __defProp$m(target, key, result);
8776
8585
  return result;
8777
8586
  };
8778
8587
  let Timeline = class extends Node {
@@ -8817,213 +8626,52 @@ let Timeline = class extends Node {
8817
8626
  this.addTime(delta);
8818
8627
  }
8819
8628
  };
8820
- __decorateClass$i([
8629
+ __decorateClass$m([
8821
8630
  property({ default: 0 })
8822
8631
  ], Timeline.prototype, "startTime", 2);
8823
- __decorateClass$i([
8632
+ __decorateClass$m([
8824
8633
  property({ default: 0 })
8825
8634
  ], Timeline.prototype, "currentTime", 2);
8826
- __decorateClass$i([
8635
+ __decorateClass$m([
8827
8636
  property({ default: Number.MAX_SAFE_INTEGER })
8828
8637
  ], Timeline.prototype, "endTime", 2);
8829
- __decorateClass$i([
8638
+ __decorateClass$m([
8830
8639
  property({ default: false })
8831
8640
  ], Timeline.prototype, "loop", 2);
8832
- Timeline = __decorateClass$i([
8641
+ Timeline = __decorateClass$m([
8833
8642
  customNode("Timeline")
8834
8643
  ], Timeline);
8835
8644
 
8836
- var __defProp$h = Object.defineProperty;
8837
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
8838
- var __decorateClass$h = (decorators, target, key, kind) => {
8839
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$g(target, key) : target;
8645
+ var __defProp$l = Object.defineProperty;
8646
+ var __decorateClass$l = (decorators, target, key, kind) => {
8647
+ var result = undefined ;
8840
8648
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8841
8649
  if (decorator = decorators[i])
8842
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8843
- if (kind && result) __defProp$h(target, key, result);
8650
+ result = (decorator(target, key, result) ) || result;
8651
+ if (result) __defProp$l(target, key, result);
8844
8652
  return result;
8845
8653
  };
8846
- let Viewport = class extends Node {
8847
- constructor(flipY = false) {
8848
- super();
8849
- this.flipY = flipY;
8850
- this._projection.flipY(flipY);
8851
- }
8852
- get valid() {
8853
- return Boolean(this.width && this.height);
8854
- }
8855
- _projection = new Projection2D();
8856
- _framebufferIndex = 0;
8857
- _framebuffers = [
8858
- { texture: new ViewportTexture(), needsUpload: false },
8859
- { texture: new ViewportTexture(), needsUpload: false }
8860
- ];
8861
- get framebuffer() {
8862
- return this._framebuffers[this._framebufferIndex];
8863
- }
8864
- get texture() {
8865
- return this.framebuffer.texture;
8654
+ class SceneTree extends MainLoop {
8655
+ renderStack = new RenderStack();
8656
+ root = new Viewport(true).setTree(this);
8657
+ timeline;
8658
+ _backgroundColor = new Color();
8659
+ _currentViewport;
8660
+ getCurrentViewport() {
8661
+ return this._currentViewport;
8866
8662
  }
8867
- /** @internal */
8868
- _glFramebufferOptions(renderer) {
8869
- const { width, height } = this;
8870
- const { pixelRatio } = renderer;
8871
- this._framebuffers.forEach((framebuffer) => {
8872
- const texture = framebuffer.texture;
8873
- texture.pixelRatio = pixelRatio;
8874
- texture.width = width;
8875
- texture.height = height;
8876
- texture.upload(renderer);
8877
- });
8878
- return {
8879
- width,
8880
- height,
8881
- colorTextures: [this.texture._glTexture(renderer)]
8882
- };
8663
+ setCurrentViewport(viewport) {
8664
+ this._currentViewport = viewport;
8883
8665
  }
8884
- /** @internal */
8885
- _glFramebuffer(renderer) {
8886
- return renderer.getRelated(this.framebuffer, () => {
8887
- return renderer.framebuffer.create(
8888
- this._glFramebufferOptions(renderer)
8889
- );
8890
- });
8666
+ constructor(timeline = new Timeline()) {
8667
+ super();
8668
+ this.timeline = timeline.setTree(this);
8891
8669
  }
8892
8670
  _updateProperty(key, value, oldValue, declaration) {
8893
8671
  super._updateProperty(key, value, oldValue, declaration);
8894
8672
  switch (key) {
8895
- case "x":
8896
- case "y":
8897
- this.requestUpload();
8898
- this._projection.translate(this.x, this.y);
8899
- this.emit("updateRect");
8900
- break;
8901
- case "width":
8902
- case "height":
8903
- this.requestUpload();
8904
- this._projection.resize(this.width, this.height);
8905
- this.emit("updateRect");
8906
- break;
8907
- }
8908
- }
8909
- requestUpload() {
8910
- this._framebuffers.forEach((framebuffer) => framebuffer.needsUpload = true);
8911
- }
8912
- resize(width, height) {
8913
- this.width = width;
8914
- this.height = height;
8915
- }
8916
- upload(renderer) {
8917
- const framebuffer = this.framebuffer;
8918
- if (framebuffer.needsUpload && this.valid) {
8919
- framebuffer.needsUpload = false;
8920
- renderer.framebuffer.update(
8921
- this._glFramebuffer(renderer),
8922
- this._glFramebufferOptions(renderer)
8923
- );
8924
- return true;
8925
- }
8926
- return false;
8927
- }
8928
- activate(renderer) {
8929
- if (this.valid) {
8930
- renderer.flush();
8931
- this._tree?.setCurrentViewport(this);
8932
- renderer.framebuffer.bind(this._glFramebuffer(renderer));
8933
- this.upload(renderer);
8934
- return true;
8935
- }
8936
- return false;
8937
- }
8938
- redraw(renderer, cb) {
8939
- if (this.valid) {
8940
- renderer.flush();
8941
- const texture = this.framebuffer.texture;
8942
- this._framebufferIndex = (this._framebufferIndex + 1) % this._framebuffers.length;
8943
- this.activate(renderer);
8944
- renderer.clear();
8945
- texture.activate(renderer, 0);
8946
- cb();
8947
- return true;
8948
- }
8949
- return false;
8950
- }
8951
- activateWithCopy(renderer, target) {
8952
- this.resize(target.width, target.height);
8953
- if (this.activate(renderer)) {
8954
- renderer.clear();
8955
- target.texture.activate(renderer, 0);
8956
- QuadUvGeometry.draw(renderer, UvMaterial.instance, {
8957
- sampler: 0
8958
- });
8959
- }
8960
- }
8961
- render(renderer, next) {
8962
- const oldViewport = this._tree?.getCurrentViewport();
8963
- this.activate(renderer);
8964
- renderer.clear();
8965
- super.render(renderer, next);
8966
- renderer.flush();
8967
- if (oldViewport) {
8968
- oldViewport.activate(renderer);
8969
- } else {
8970
- renderer.framebuffer.bind(null);
8971
- this._tree?.setCurrentViewport(undefined);
8972
- }
8973
- }
8974
- getRect() {
8975
- return new Rect2(this.x, this.y, this.width, this.height);
8976
- }
8977
- toProjectionArray(transpose = false) {
8978
- return this._projection.toArray(transpose);
8979
- }
8980
- };
8981
- __decorateClass$h([
8982
- property({ default: 0 })
8983
- ], Viewport.prototype, "x", 2);
8984
- __decorateClass$h([
8985
- property({ default: 0 })
8986
- ], Viewport.prototype, "y", 2);
8987
- __decorateClass$h([
8988
- property({ default: 0 })
8989
- ], Viewport.prototype, "width", 2);
8990
- __decorateClass$h([
8991
- property({ default: 0 })
8992
- ], Viewport.prototype, "height", 2);
8993
- Viewport = __decorateClass$h([
8994
- customNode("Viewport")
8995
- ], Viewport);
8996
-
8997
- var __defProp$g = Object.defineProperty;
8998
- var __decorateClass$g = (decorators, target, key, kind) => {
8999
- var result = undefined ;
9000
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
9001
- if (decorator = decorators[i])
9002
- result = (decorator(target, key, result) ) || result;
9003
- if (result) __defProp$g(target, key, result);
9004
- return result;
9005
- };
9006
- class SceneTree extends MainLoop {
9007
- renderStack = new RenderStack();
9008
- root = new Viewport(true).setTree(this);
9009
- timeline;
9010
- _backgroundColor = new Color();
9011
- _currentViewport;
9012
- getCurrentViewport() {
9013
- return this._currentViewport;
9014
- }
9015
- setCurrentViewport(viewport) {
9016
- this._currentViewport = viewport;
9017
- }
9018
- constructor(timeline = new Timeline()) {
9019
- super();
9020
- this.timeline = timeline.setTree(this);
9021
- }
9022
- _updateProperty(key, value, oldValue, declaration) {
9023
- super._updateProperty(key, value, oldValue, declaration);
9024
- switch (key) {
9025
- case "backgroundColor":
9026
- this._backgroundColor.value = value;
8673
+ case "backgroundColor":
8674
+ this._backgroundColor.value = value;
9027
8675
  break;
9028
8676
  }
9029
8677
  }
@@ -9061,21 +8709,45 @@ class SceneTree extends MainLoop {
9061
8709
  renderer.texture.unbind(texture);
9062
8710
  }
9063
8711
  }
9064
- __decorateClass$g([
8712
+ __decorateClass$l([
9065
8713
  property({ default: false })
9066
8714
  ], SceneTree.prototype, "paused");
9067
- __decorateClass$g([
8715
+ __decorateClass$l([
9068
8716
  property()
9069
8717
  ], SceneTree.prototype, "backgroundColor");
9070
8718
 
9071
- var __defProp$f = Object.defineProperty;
9072
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9073
- var __decorateClass$f = (decorators, target, key, kind) => {
9074
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$f(target, key) : target;
8719
+ var __defProp$k = Object.defineProperty;
8720
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8721
+ var __decorateClass$k = (decorators, target, key, kind) => {
8722
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$k(target, key) : target;
9075
8723
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9076
8724
  if (decorator = decorators[i])
9077
8725
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9078
- if (kind && result) __defProp$f(target, key, result);
8726
+ if (kind && result) __defProp$k(target, key, result);
8727
+ return result;
8728
+ };
8729
+ let Transition = class extends Effect {
8730
+ constructor(properties, children = []) {
8731
+ super();
8732
+ this.setProperties(properties).append(children);
8733
+ }
8734
+ };
8735
+ Transition = __decorateClass$k([
8736
+ customNode("Transition", {
8737
+ effectMode: "transition",
8738
+ processMode: "pausable",
8739
+ duration: 2e3
8740
+ })
8741
+ ], Transition);
8742
+
8743
+ var __defProp$j = Object.defineProperty;
8744
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8745
+ var __decorateClass$j = (decorators, target, key, kind) => {
8746
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$j(target, key) : target;
8747
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8748
+ if (decorator = decorators[i])
8749
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8750
+ if (kind && result) __defProp$j(target, key, result);
9079
8751
  return result;
9080
8752
  };
9081
8753
  let Node2D = class extends CanvasItem {
@@ -9216,18 +8888,18 @@ let Node2D = class extends CanvasItem {
9216
8888
  );
9217
8889
  }
9218
8890
  };
9219
- Node2D = __decorateClass$f([
8891
+ Node2D = __decorateClass$j([
9220
8892
  customNode("Node2D")
9221
8893
  ], Node2D);
9222
8894
 
9223
- var __defProp$e = Object.defineProperty;
9224
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9225
- var __decorateClass$e = (decorators, target, key, kind) => {
9226
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$e(target, key) : target;
8895
+ var __defProp$i = Object.defineProperty;
8896
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8897
+ var __decorateClass$i = (decorators, target, key, kind) => {
8898
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$i(target, key) : target;
9227
8899
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9228
8900
  if (decorator = decorators[i])
9229
8901
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9230
- if (kind && result) __defProp$e(target, key, result);
8902
+ if (kind && result) __defProp$i(target, key, result);
9231
8903
  return result;
9232
8904
  };
9233
8905
  function proxy(options) {
@@ -9272,61 +8944,61 @@ let Graphics2D = class extends Node2D {
9272
8944
  return this;
9273
8945
  }
9274
8946
  };
9275
- __decorateClass$e([
8947
+ __decorateClass$i([
9276
8948
  proxy()
9277
8949
  ], Graphics2D.prototype, "lineCap", 2);
9278
- __decorateClass$e([
8950
+ __decorateClass$i([
9279
8951
  proxy()
9280
8952
  ], Graphics2D.prototype, "lineJoin", 2);
9281
- __decorateClass$e([
8953
+ __decorateClass$i([
9282
8954
  proxy()
9283
8955
  ], Graphics2D.prototype, "fillStyle", 2);
9284
- __decorateClass$e([
8956
+ __decorateClass$i([
9285
8957
  proxy()
9286
8958
  ], Graphics2D.prototype, "strokeStyle", 2);
9287
- __decorateClass$e([
8959
+ __decorateClass$i([
9288
8960
  proxy()
9289
8961
  ], Graphics2D.prototype, "lineWidth", 2);
9290
- __decorateClass$e([
8962
+ __decorateClass$i([
9291
8963
  proxy()
9292
8964
  ], Graphics2D.prototype, "miterLimit", 2);
9293
- __decorateClass$e([
8965
+ __decorateClass$i([
9294
8966
  proxy({ method: true })
9295
8967
  ], Graphics2D.prototype, "rect", 2);
9296
- __decorateClass$e([
8968
+ __decorateClass$i([
9297
8969
  proxy({ method: true, redraw: true })
9298
8970
  ], Graphics2D.prototype, "fillRect", 2);
9299
- __decorateClass$e([
8971
+ __decorateClass$i([
9300
8972
  proxy({ method: true, redraw: true })
9301
8973
  ], Graphics2D.prototype, "strokeRect", 2);
9302
- __decorateClass$e([
8974
+ __decorateClass$i([
9303
8975
  proxy({ method: true })
9304
8976
  ], Graphics2D.prototype, "roundRect", 2);
9305
- __decorateClass$e([
8977
+ __decorateClass$i([
9306
8978
  proxy({ method: true })
9307
8979
  ], Graphics2D.prototype, "ellipse", 2);
9308
- __decorateClass$e([
8980
+ __decorateClass$i([
9309
8981
  proxy({ method: true })
9310
8982
  ], Graphics2D.prototype, "arc", 2);
9311
- __decorateClass$e([
8983
+ __decorateClass$i([
9312
8984
  proxy({ method: true })
9313
8985
  ], Graphics2D.prototype, "beginPath", 2);
9314
- __decorateClass$e([
8986
+ __decorateClass$i([
9315
8987
  proxy({ method: true })
9316
8988
  ], Graphics2D.prototype, "moveTo", 2);
9317
- __decorateClass$e([
8989
+ __decorateClass$i([
9318
8990
  proxy({ method: true })
9319
8991
  ], Graphics2D.prototype, "lineTo", 2);
9320
- __decorateClass$e([
8992
+ __decorateClass$i([
9321
8993
  proxy({ method: true })
9322
8994
  ], Graphics2D.prototype, "closePath", 2);
9323
- __decorateClass$e([
8995
+ __decorateClass$i([
9324
8996
  proxy({ method: true, redraw: true })
9325
8997
  ], Graphics2D.prototype, "fill", 2);
9326
- __decorateClass$e([
8998
+ __decorateClass$i([
9327
8999
  proxy({ method: true, redraw: true })
9328
9000
  ], Graphics2D.prototype, "stroke", 2);
9329
- Graphics2D = __decorateClass$e([
9001
+ Graphics2D = __decorateClass$i([
9330
9002
  customNode("Graphics2D")
9331
9003
  ], Graphics2D);
9332
9004
 
@@ -9356,14 +9028,14 @@ class Image2DResource extends Resource {
9356
9028
  }
9357
9029
  }
9358
9030
 
9359
- var __defProp$d = Object.defineProperty;
9360
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9361
- var __decorateClass$d = (decorators, target, key, kind) => {
9362
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$d(target, key) : target;
9031
+ var __defProp$h = Object.defineProperty;
9032
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
9033
+ var __decorateClass$h = (decorators, target, key, kind) => {
9034
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$h(target, key) : target;
9363
9035
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9364
9036
  if (decorator = decorators[i])
9365
9037
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9366
- if (kind && result) __defProp$d(target, key, result);
9038
+ if (kind && result) __defProp$h(target, key, result);
9367
9039
  return result;
9368
9040
  };
9369
9041
  let Image2D = class extends Node2D {
@@ -9483,16 +9155,16 @@ let Image2D = class extends Node2D {
9483
9155
  }
9484
9156
  }
9485
9157
  };
9486
- __decorateClass$d([
9158
+ __decorateClass$h([
9487
9159
  protectedProperty()
9488
9160
  ], Image2D.prototype, "resource", 2);
9489
- __decorateClass$d([
9161
+ __decorateClass$h([
9490
9162
  property({ default: false })
9491
9163
  ], Image2D.prototype, "gif", 2);
9492
- __decorateClass$d([
9164
+ __decorateClass$h([
9493
9165
  property({ default: "" })
9494
9166
  ], Image2D.prototype, "src", 2);
9495
- Image2D = __decorateClass$d([
9167
+ Image2D = __decorateClass$h([
9496
9168
  customNode("Image2D")
9497
9169
  ], Image2D);
9498
9170
 
@@ -9510,14 +9182,14 @@ class TextureRect2D extends Node2D {
9510
9182
  }
9511
9183
  }
9512
9184
 
9513
- var __defProp$c = Object.defineProperty;
9514
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
9515
- var __decorateClass$c = (decorators, target, key, kind) => {
9516
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$c(target, key) : target;
9185
+ var __defProp$g = Object.defineProperty;
9186
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
9187
+ var __decorateClass$g = (decorators, target, key, kind) => {
9188
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$g(target, key) : target;
9517
9189
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9518
9190
  if (decorator = decorators[i])
9519
9191
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9520
- if (kind && result) __defProp$c(target, key, result);
9192
+ if (kind && result) __defProp$g(target, key, result);
9521
9193
  return result;
9522
9194
  };
9523
9195
  let Lottie2D = class extends TextureRect2D {
@@ -9560,21 +9232,21 @@ let Lottie2D = class extends TextureRect2D {
9560
9232
  super._process(delta);
9561
9233
  }
9562
9234
  };
9563
- __decorateClass$c([
9235
+ __decorateClass$g([
9564
9236
  property({ default: "" })
9565
9237
  ], Lottie2D.prototype, "src", 2);
9566
- Lottie2D = __decorateClass$c([
9238
+ Lottie2D = __decorateClass$g([
9567
9239
  customNode("Lottie2D")
9568
9240
  ], Lottie2D);
9569
9241
 
9570
- var __defProp$b = Object.defineProperty;
9571
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
9572
- var __decorateClass$b = (decorators, target, key, kind) => {
9573
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$b(target, key) : target;
9242
+ var __defProp$f = Object.defineProperty;
9243
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9244
+ var __decorateClass$f = (decorators, target, key, kind) => {
9245
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$f(target, key) : target;
9574
9246
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9575
9247
  if (decorator = decorators[i])
9576
9248
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9577
- if (kind && result) __defProp$b(target, key, result);
9249
+ if (kind && result) __defProp$f(target, key, result);
9578
9250
  return result;
9579
9251
  };
9580
9252
  const textStyles = new Set(Object.keys(textDefaultStyle));
@@ -9712,33 +9384,33 @@ let Text2D = class extends TextureRect2D {
9712
9384
  }
9713
9385
  }
9714
9386
  };
9715
- __decorateClass$b([
9387
+ __decorateClass$f([
9716
9388
  property({ default: false })
9717
9389
  ], Text2D.prototype, "split", 2);
9718
- __decorateClass$b([
9390
+ __decorateClass$f([
9719
9391
  property({ default: "" })
9720
9392
  ], Text2D.prototype, "content", 2);
9721
- __decorateClass$b([
9393
+ __decorateClass$f([
9722
9394
  property()
9723
9395
  ], Text2D.prototype, "effects", 2);
9724
- __decorateClass$b([
9396
+ __decorateClass$f([
9725
9397
  protectedProperty()
9726
9398
  ], Text2D.prototype, "measureDom", 2);
9727
- __decorateClass$b([
9399
+ __decorateClass$f([
9728
9400
  protectedProperty()
9729
9401
  ], Text2D.prototype, "fonts", 2);
9730
- Text2D = __decorateClass$b([
9402
+ Text2D = __decorateClass$f([
9731
9403
  customNode("Text2D")
9732
9404
  ], Text2D);
9733
9405
 
9734
- var __defProp$a = Object.defineProperty;
9735
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
9736
- var __decorateClass$a = (decorators, target, key, kind) => {
9737
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$a(target, key) : target;
9406
+ var __defProp$e = Object.defineProperty;
9407
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9408
+ var __decorateClass$e = (decorators, target, key, kind) => {
9409
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$e(target, key) : target;
9738
9410
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9739
9411
  if (decorator = decorators[i])
9740
9412
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9741
- if (kind && result) __defProp$a(target, key, result);
9413
+ if (kind && result) __defProp$e(target, key, result);
9742
9414
  return result;
9743
9415
  };
9744
9416
  let Video2D = class extends TextureRect2D {
@@ -9791,21 +9463,21 @@ let Video2D = class extends TextureRect2D {
9791
9463
  super._process(delta);
9792
9464
  }
9793
9465
  };
9794
- __decorateClass$a([
9466
+ __decorateClass$e([
9795
9467
  property({ default: "" })
9796
9468
  ], Video2D.prototype, "src", 2);
9797
- Video2D = __decorateClass$a([
9469
+ Video2D = __decorateClass$e([
9798
9470
  customNode("Video2D")
9799
9471
  ], Video2D);
9800
9472
 
9801
- var __defProp$9 = Object.defineProperty;
9802
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
9803
- var __decorateClass$9 = (decorators, target, key, kind) => {
9804
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$9(target, key) : target;
9805
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
9806
- if (decorator = decorators[i])
9473
+ var __defProp$d = Object.defineProperty;
9474
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9475
+ var __decorateClass$d = (decorators, target, key, kind) => {
9476
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$d(target, key) : target;
9477
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9478
+ if (decorator = decorators[i])
9807
9479
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9808
- if (kind && result) __defProp$9(target, key, result);
9480
+ if (kind && result) __defProp$d(target, key, result);
9809
9481
  return result;
9810
9482
  };
9811
9483
  const linear = (amount) => amount;
@@ -9873,21 +9545,28 @@ let Animation = class extends TimelineNode {
9873
9545
  _stoped = false;
9874
9546
  constructor(properties, children = []) {
9875
9547
  super();
9876
- this.commitStyles = this.commitStyles.bind(this);
9548
+ this._process = this._process.bind(this);
9877
9549
  this.setProperties(properties).append(children);
9878
9550
  }
9879
9551
  _treeEnter(tree) {
9880
- tree.timeline.on("updateCurrentTime", this.commitStyles);
9552
+ tree.timeline.on("updateCurrentTime", this._process);
9881
9553
  this._updateCachedProps();
9882
9554
  }
9883
9555
  _treeExit(oldTree) {
9884
- oldTree.timeline.on("updateCurrentTime", this.commitStyles);
9556
+ oldTree.timeline.on("updateCurrentTime", this._process);
9885
9557
  this.cancel();
9886
9558
  }
9559
+ _onProcess() {
9560
+ }
9561
+ _process() {
9562
+ if (this.canProcess()) {
9563
+ this.commitStyles();
9564
+ }
9565
+ }
9887
9566
  _updateProperty(key, value, oldValue, declaration) {
9888
9567
  super._updateProperty(key, value, oldValue, declaration);
9889
9568
  switch (key) {
9890
- case "animationMode":
9569
+ case "effectMode":
9891
9570
  case "keyframes":
9892
9571
  this._updateKeyframes();
9893
9572
  break;
@@ -9895,7 +9574,7 @@ let Animation = class extends TimelineNode {
9895
9574
  }
9896
9575
  _getTargets() {
9897
9576
  let targets;
9898
- switch (this.animationMode) {
9577
+ switch (this.effectMode) {
9899
9578
  case "sibling":
9900
9579
  targets = this.getParent()?.getChildren(true).filter((val) => val instanceof CanvasItem) ?? [];
9901
9580
  break;
@@ -10117,22 +9796,22 @@ let Animation = class extends TimelineNode {
10117
9796
  });
10118
9797
  }
10119
9798
  };
10120
- __decorateClass$9([
9799
+ __decorateClass$d([
10121
9800
  property({ default: "parent" })
10122
- ], Animation.prototype, "animationMode", 2);
10123
- __decorateClass$9([
9801
+ ], Animation.prototype, "effectMode", 2);
9802
+ __decorateClass$d([
10124
9803
  property({ default: false })
10125
9804
  ], Animation.prototype, "loop", 2);
10126
- __decorateClass$9([
9805
+ __decorateClass$d([
10127
9806
  property({ default: [] })
10128
9807
  ], Animation.prototype, "keyframes", 2);
10129
- __decorateClass$9([
9808
+ __decorateClass$d([
10130
9809
  property()
10131
9810
  ], Animation.prototype, "easing", 2);
10132
- Animation = __decorateClass$9([
9811
+ Animation = __decorateClass$d([
10133
9812
  customNode("Animation", {
10134
9813
  renderMode: "disabled",
10135
- processMode: "disabled",
9814
+ processMode: "pausable",
10136
9815
  duration: 2e3
10137
9816
  })
10138
9817
  ], Animation);
@@ -11012,18 +10691,18 @@ class WebAudio extends AudioPipeline {
11012
10691
  }
11013
10692
  }
11014
10693
 
11015
- var __defProp$8 = Object.defineProperty;
11016
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11017
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11018
- var __decorateClass$8 = (decorators, target, key, kind) => {
11019
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$8(target, key) : target;
10694
+ var __defProp$c = Object.defineProperty;
10695
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
10696
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10697
+ var __decorateClass$c = (decorators, target, key, kind) => {
10698
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$c(target, key) : target;
11020
10699
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11021
10700
  if (decorator = decorators[i])
11022
10701
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11023
- if (kind && result) __defProp$8(target, key, result);
10702
+ if (kind && result) __defProp$c(target, key, result);
11024
10703
  return result;
11025
10704
  };
11026
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
10705
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
11027
10706
  let Audio = class extends TimelineNode {
11028
10707
  _sounds = [];
11029
10708
  /** PlatformAudio */
@@ -11227,8 +10906,8 @@ let Audio = class extends TimelineNode {
11227
10906
  }, 100);
11228
10907
  }
11229
10908
  };
11230
- __publicField(Audio, "_soundPool", []);
11231
- Audio = __decorateClass$8([
10909
+ __publicField$4(Audio, "_soundPool", []);
10910
+ Audio = __decorateClass$c([
11232
10911
  customNode("Audio")
11233
10912
  ], Audio);
11234
10913
 
@@ -11236,14 +10915,14 @@ class AudioSpectrum extends Node2D {
11236
10915
  //
11237
10916
  }
11238
10917
 
11239
- var __defProp$7 = Object.defineProperty;
11240
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11241
- var __decorateClass$7 = (decorators, target, key, kind) => {
11242
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$7(target, key) : target;
10918
+ var __defProp$b = Object.defineProperty;
10919
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
10920
+ var __decorateClass$b = (decorators, target, key, kind) => {
10921
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$b(target, key) : target;
11243
10922
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11244
10923
  if (decorator = decorators[i])
11245
10924
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11246
- if (kind && result) __defProp$7(target, key, result);
10925
+ if (kind && result) __defProp$b(target, key, result);
11247
10926
  return result;
11248
10927
  };
11249
10928
  let AudioWaveform = class extends Node2D {
@@ -11337,27 +11016,27 @@ let AudioWaveform = class extends Node2D {
11337
11016
  }
11338
11017
  }
11339
11018
  };
11340
- __decorateClass$7([
11019
+ __decorateClass$b([
11341
11020
  property()
11342
11021
  ], AudioWaveform.prototype, "src", 2);
11343
- __decorateClass$7([
11022
+ __decorateClass$b([
11344
11023
  property()
11345
11024
  ], AudioWaveform.prototype, "gap", 2);
11346
- __decorateClass$7([
11025
+ __decorateClass$b([
11347
11026
  property()
11348
11027
  ], AudioWaveform.prototype, "color", 2);
11349
- AudioWaveform = __decorateClass$7([
11028
+ AudioWaveform = __decorateClass$b([
11350
11029
  customNode("AudioWaveform")
11351
11030
  ], AudioWaveform);
11352
11031
 
11353
- var __defProp$6 = Object.defineProperty;
11354
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11355
- var __decorateClass$6 = (decorators, target, key, kind) => {
11356
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$6(target, key) : target;
11032
+ var __defProp$a = Object.defineProperty;
11033
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
11034
+ var __decorateClass$a = (decorators, target, key, kind) => {
11035
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$a(target, key) : target;
11357
11036
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11358
11037
  if (decorator = decorators[i])
11359
11038
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11360
- if (kind && result) __defProp$6(target, key, result);
11039
+ if (kind && result) __defProp$a(target, key, result);
11361
11040
  return result;
11362
11041
  };
11363
11042
  let Control = class extends CanvasItem {
@@ -11417,18 +11096,18 @@ let Control = class extends CanvasItem {
11417
11096
  return new Rect2(left, top, width, height);
11418
11097
  }
11419
11098
  };
11420
- Control = __decorateClass$6([
11099
+ Control = __decorateClass$a([
11421
11100
  customNode("Control")
11422
11101
  ], Control);
11423
11102
 
11424
- var __defProp$5 = Object.defineProperty;
11425
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11426
- var __decorateClass$5 = (decorators, target, key, kind) => {
11427
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$5(target, key) : target;
11103
+ var __defProp$9 = Object.defineProperty;
11104
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
11105
+ var __decorateClass$9 = (decorators, target, key, kind) => {
11106
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$9(target, key) : target;
11428
11107
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11429
11108
  if (decorator = decorators[i])
11430
11109
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11431
- if (kind && result) __defProp$5(target, key, result);
11110
+ if (kind && result) __defProp$9(target, key, result);
11432
11111
  return result;
11433
11112
  };
11434
11113
  let Range = class extends Control {
@@ -11451,39 +11130,39 @@ let Range = class extends Control {
11451
11130
  }
11452
11131
  }
11453
11132
  };
11454
- __decorateClass$5([
11133
+ __decorateClass$9([
11455
11134
  property({ default: false })
11456
11135
  ], Range.prototype, "allowGreater", 2);
11457
- __decorateClass$5([
11136
+ __decorateClass$9([
11458
11137
  property({ default: false })
11459
11138
  ], Range.prototype, "allowLesser", 2);
11460
- __decorateClass$5([
11139
+ __decorateClass$9([
11461
11140
  property({ default: 1 })
11462
11141
  ], Range.prototype, "page", 2);
11463
- __decorateClass$5([
11142
+ __decorateClass$9([
11464
11143
  property({ default: 0 })
11465
11144
  ], Range.prototype, "minValue", 2);
11466
- __decorateClass$5([
11145
+ __decorateClass$9([
11467
11146
  property({ default: 100 })
11468
11147
  ], Range.prototype, "maxValue", 2);
11469
- __decorateClass$5([
11148
+ __decorateClass$9([
11470
11149
  property({ default: 0.01 })
11471
11150
  ], Range.prototype, "step", 2);
11472
- __decorateClass$5([
11151
+ __decorateClass$9([
11473
11152
  property({ default: 0 })
11474
11153
  ], Range.prototype, "value", 2);
11475
- Range = __decorateClass$5([
11154
+ Range = __decorateClass$9([
11476
11155
  customNode("Range")
11477
11156
  ], Range);
11478
11157
 
11479
- var __defProp$4 = Object.defineProperty;
11480
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11481
- var __decorateClass$4 = (decorators, target, key, kind) => {
11482
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$4(target, key) : target;
11158
+ var __defProp$8 = Object.defineProperty;
11159
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11160
+ var __decorateClass$8 = (decorators, target, key, kind) => {
11161
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$8(target, key) : target;
11483
11162
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11484
11163
  if (decorator = decorators[i])
11485
11164
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11486
- if (kind && result) __defProp$4(target, key, result);
11165
+ if (kind && result) __defProp$8(target, key, result);
11487
11166
  return result;
11488
11167
  };
11489
11168
  let Ruler = class extends Control {
@@ -11634,45 +11313,45 @@ let Ruler = class extends Control {
11634
11313
  }
11635
11314
  }
11636
11315
  };
11637
- __decorateClass$4([
11316
+ __decorateClass$8([
11638
11317
  property({ default: 0 })
11639
11318
  ], Ruler.prototype, "offsetX", 2);
11640
- __decorateClass$4([
11319
+ __decorateClass$8([
11641
11320
  property({ default: 0 })
11642
11321
  ], Ruler.prototype, "offsetY", 2);
11643
- __decorateClass$4([
11322
+ __decorateClass$8([
11644
11323
  property({ default: 20 })
11645
11324
  ], Ruler.prototype, "thickness", 2);
11646
- __decorateClass$4([
11325
+ __decorateClass$8([
11647
11326
  property({ default: 3 })
11648
11327
  ], Ruler.prototype, "markHeight", 2);
11649
- __decorateClass$4([
11328
+ __decorateClass$8([
11650
11329
  property({ default: "#b2b6bc" })
11651
11330
  ], Ruler.prototype, "color", 2);
11652
- __decorateClass$4([
11331
+ __decorateClass$8([
11653
11332
  property({ default: "#f9f9fa" })
11654
11333
  ], Ruler.prototype, "markBackgroundColor", 2);
11655
- __decorateClass$4([
11334
+ __decorateClass$8([
11656
11335
  property({ default: "#b2b6bc" })
11657
11336
  ], Ruler.prototype, "markColor", 2);
11658
- __decorateClass$4([
11337
+ __decorateClass$8([
11659
11338
  property({ default: 300 })
11660
11339
  ], Ruler.prototype, "gap", 2);
11661
- __decorateClass$4([
11340
+ __decorateClass$8([
11662
11341
  property({ default: 1 })
11663
11342
  ], Ruler.prototype, "scale", 2);
11664
- Ruler = __decorateClass$4([
11343
+ Ruler = __decorateClass$8([
11665
11344
  customNode("Ruler")
11666
11345
  ], Ruler);
11667
11346
 
11668
- var __defProp$3 = Object.defineProperty;
11669
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
11670
- var __decorateClass$3 = (decorators, target, key, kind) => {
11671
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$3(target, key) : target;
11347
+ var __defProp$7 = Object.defineProperty;
11348
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11349
+ var __decorateClass$7 = (decorators, target, key, kind) => {
11350
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$7(target, key) : target;
11672
11351
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11673
11352
  if (decorator = decorators[i])
11674
11353
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11675
- if (kind && result) __defProp$3(target, key, result);
11354
+ if (kind && result) __defProp$7(target, key, result);
11676
11355
  return result;
11677
11356
  };
11678
11357
  let ScrollBar = class extends Range {
@@ -11714,21 +11393,21 @@ let ScrollBar = class extends Range {
11714
11393
  this.context.fill();
11715
11394
  }
11716
11395
  };
11717
- __decorateClass$3([
11396
+ __decorateClass$7([
11718
11397
  property({ default: "vertical" })
11719
11398
  ], ScrollBar.prototype, "direction", 2);
11720
- ScrollBar = __decorateClass$3([
11399
+ ScrollBar = __decorateClass$7([
11721
11400
  customNode("ScrollBar")
11722
11401
  ], ScrollBar);
11723
11402
 
11724
- var __defProp$2 = Object.defineProperty;
11725
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
11726
- var __decorateClass$2 = (decorators, target, key, kind) => {
11727
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$2(target, key) : target;
11403
+ var __defProp$6 = Object.defineProperty;
11404
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11405
+ var __decorateClass$6 = (decorators, target, key, kind) => {
11406
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$6(target, key) : target;
11728
11407
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11729
11408
  if (decorator = decorators[i])
11730
11409
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11731
- if (kind && result) __defProp$2(target, key, result);
11410
+ if (kind && result) __defProp$6(target, key, result);
11732
11411
  return result;
11733
11412
  };
11734
11413
  let XScrollBar = class extends ScrollBar {
@@ -11737,20 +11416,20 @@ let XScrollBar = class extends ScrollBar {
11737
11416
  this.setProperties(properties).append(children);
11738
11417
  }
11739
11418
  };
11740
- XScrollBar = __decorateClass$2([
11419
+ XScrollBar = __decorateClass$6([
11741
11420
  customNode("XScrollBar", {
11742
11421
  direction: "horizontal"
11743
11422
  })
11744
11423
  ], XScrollBar);
11745
11424
 
11746
- var __defProp$1 = Object.defineProperty;
11747
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11748
- var __decorateClass$1 = (decorators, target, key, kind) => {
11749
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$1(target, key) : target;
11425
+ var __defProp$5 = Object.defineProperty;
11426
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11427
+ var __decorateClass$5 = (decorators, target, key, kind) => {
11428
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$5(target, key) : target;
11750
11429
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11751
11430
  if (decorator = decorators[i])
11752
11431
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11753
- if (kind && result) __defProp$1(target, key, result);
11432
+ if (kind && result) __defProp$5(target, key, result);
11754
11433
  return result;
11755
11434
  };
11756
11435
  let YScrollBar = class extends ScrollBar {
@@ -11759,20 +11438,20 @@ let YScrollBar = class extends ScrollBar {
11759
11438
  this.setProperties(properties).append(children);
11760
11439
  }
11761
11440
  };
11762
- YScrollBar = __decorateClass$1([
11441
+ YScrollBar = __decorateClass$5([
11763
11442
  customNode("YScrollBar", {
11764
11443
  direction: "vertical"
11765
11444
  })
11766
11445
  ], YScrollBar);
11767
11446
 
11768
- var __defProp = Object.defineProperty;
11769
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11770
- var __decorateClass = (decorators, target, key, kind) => {
11771
- var result = kind > 1 ? undefined : kind ? __getOwnPropDesc(target, key) : target;
11447
+ var __defProp$4 = Object.defineProperty;
11448
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11449
+ var __decorateClass$4 = (decorators, target, key, kind) => {
11450
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$4(target, key) : target;
11772
11451
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11773
11452
  if (decorator = decorators[i])
11774
11453
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11775
- if (kind && result) __defProp(target, key, result);
11454
+ if (kind && result) __defProp$4(target, key, result);
11776
11455
  return result;
11777
11456
  };
11778
11457
  let Scaler = class extends Node {
@@ -11829,22 +11508,376 @@ let Scaler = class extends Node {
11829
11508
  }
11830
11509
  }
11831
11510
  };
11832
- __decorateClass([
11511
+ __decorateClass$4([
11833
11512
  property({ default: 1 })
11834
11513
  ], Scaler.prototype, "value", 2);
11835
- __decorateClass([
11514
+ __decorateClass$4([
11836
11515
  property({ default: 0.05 })
11837
11516
  ], Scaler.prototype, "minValue", 2);
11838
- __decorateClass([
11517
+ __decorateClass$4([
11839
11518
  property({ default: 10 })
11840
11519
  ], Scaler.prototype, "maxValue", 2);
11841
- Scaler = __decorateClass([
11520
+ Scaler = __decorateClass$4([
11842
11521
  customNode("Scaler", {
11843
11522
  processMode: "disabled",
11844
11523
  renderMode: "disabled"
11845
11524
  })
11846
11525
  ], Scaler);
11847
11526
 
11527
+ var __defProp$3 = Object.defineProperty;
11528
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
11529
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11530
+ var __decorateClass$3 = (decorators, target, key, kind) => {
11531
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$3(target, key) : target;
11532
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11533
+ if (decorator = decorators[i])
11534
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11535
+ if (kind && result) __defProp$3(target, key, result);
11536
+ return result;
11537
+ };
11538
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
11539
+ let KawaseTransition = class extends Transition {
11540
+ blur = 10;
11541
+ quality = 10;
11542
+ apply(renderer, target) {
11543
+ const currentTimeProgress = this.currentTimeProgress;
11544
+ let sampler;
11545
+ let progress;
11546
+ if (currentTimeProgress < 0.5) {
11547
+ sampler = 0;
11548
+ progress = (0.5 - currentTimeProgress) / 0.5;
11549
+ } else {
11550
+ sampler = 1;
11551
+ progress = (currentTimeProgress - 0.5) / 0.5;
11552
+ }
11553
+ const blur = this.blur;
11554
+ const quality = this.quality;
11555
+ const width = target.width;
11556
+ const height = target.height;
11557
+ const drawCalls = [];
11558
+ const kernels = [blur];
11559
+ if (blur > 0) {
11560
+ let k = blur;
11561
+ const step = blur / quality;
11562
+ for (let i = 1; i < quality; i++) {
11563
+ k -= step;
11564
+ kernels.push(k);
11565
+ }
11566
+ }
11567
+ const uvX = 1 / width;
11568
+ const uvY = 1 / height;
11569
+ const uOffset = [];
11570
+ let offset;
11571
+ const last = quality - 1;
11572
+ for (let i = 0; i < last; i++) {
11573
+ offset = kernels[i] + 0.5;
11574
+ uOffset[0] = offset * uvX;
11575
+ uOffset[1] = offset * uvY;
11576
+ drawCalls.push({
11577
+ offset: uOffset
11578
+ });
11579
+ }
11580
+ offset = kernels[last] + 0.5;
11581
+ uOffset[0] = offset * uvX;
11582
+ uOffset[1] = offset * uvY;
11583
+ drawCalls.push({
11584
+ offset: uOffset
11585
+ });
11586
+ drawCalls.forEach((uniforms) => {
11587
+ QuadUvGeometry.draw(renderer, KawaseTransition.material, {
11588
+ sampler,
11589
+ progress,
11590
+ ...uniforms
11591
+ });
11592
+ });
11593
+ }
11594
+ };
11595
+ __publicField$3(KawaseTransition, "material", new Material({
11596
+ vert: `attribute vec2 position;
11597
+ attribute vec2 uv;
11598
+ varying vec2 vUv;
11599
+ void main() {
11600
+ gl_Position = vec4(position, 0.0, 1.0);
11601
+ vUv = uv;
11602
+ }`,
11603
+ frag: `precision highp float;
11604
+ varying vec2 vUv;
11605
+ uniform sampler2D sampler;
11606
+ uniform vec2 offset;
11607
+ uniform float progress;
11608
+
11609
+ void main(void) {
11610
+ vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);
11611
+ vec4 color = vec4(0.0);
11612
+ color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));
11613
+ color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));
11614
+ color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y - offset1.y));
11615
+ color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y - offset1.y));
11616
+ color *= 0.25;
11617
+ gl_FragColor = color;
11618
+ }`
11619
+ }));
11620
+ KawaseTransition = __decorateClass$3([
11621
+ customNode("KawaseTransition")
11622
+ ], KawaseTransition);
11623
+
11624
+ var __defProp$2 = Object.defineProperty;
11625
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
11626
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11627
+ var __decorateClass$2 = (decorators, target, key, kind) => {
11628
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$2(target, key) : target;
11629
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11630
+ if (decorator = decorators[i])
11631
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11632
+ if (kind && result) __defProp$2(target, key, result);
11633
+ return result;
11634
+ };
11635
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
11636
+ let LeftEraseTransition = class extends Transition {
11637
+ apply(renderer) {
11638
+ QuadUvGeometry.draw(renderer, LeftEraseTransition.material, {
11639
+ previous: 0,
11640
+ next: 1,
11641
+ progress: this.currentTimeProgress
11642
+ });
11643
+ }
11644
+ };
11645
+ __publicField$2(LeftEraseTransition, "material", new Material({
11646
+ vert: `attribute vec2 position;
11647
+ attribute vec2 uv;
11648
+ varying vec2 vUv;
11649
+ void main() {
11650
+ gl_Position = vec4(position, 0.0, 1.0);
11651
+ vUv = uv;
11652
+ }`,
11653
+ frag: `precision highp float;
11654
+ varying vec2 vUv;
11655
+ uniform float progress;
11656
+ uniform sampler2D previous;
11657
+ uniform sampler2D next;
11658
+
11659
+ float easeInOutQuint(float t) {
11660
+ return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;
11661
+ }
11662
+
11663
+ void main() {
11664
+ vec4 src1Color = texture2D(previous, vUv);
11665
+ vec4 src2Color = texture2D(next, vUv);
11666
+ float mProgress = 1.0 - progress;
11667
+ float mixPercent = 0.0;
11668
+ if (vUv.x <= mProgress) {
11669
+ mixPercent = 1.0;
11670
+ }
11671
+ gl_FragColor = mix(src2Color, src1Color, mixPercent);
11672
+ }`
11673
+ }));
11674
+ LeftEraseTransition = __decorateClass$2([
11675
+ customNode("LeftEraseTransition")
11676
+ ], LeftEraseTransition);
11677
+
11678
+ var __defProp$1 = Object.defineProperty;
11679
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11680
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11681
+ var __decorateClass$1 = (decorators, target, key, kind) => {
11682
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$1(target, key) : target;
11683
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11684
+ if (decorator = decorators[i])
11685
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11686
+ if (kind && result) __defProp$1(target, key, result);
11687
+ return result;
11688
+ };
11689
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
11690
+ let TiltShiftTransition = class extends Transition {
11691
+ blur = 100;
11692
+ gradientBlur = 600;
11693
+ apply(renderer, target) {
11694
+ const currentTimeProgress = this.currentTimeProgress;
11695
+ let sampler;
11696
+ let progress;
11697
+ if (currentTimeProgress < 0.5) {
11698
+ sampler = 0;
11699
+ progress = (0.5 - currentTimeProgress) / 0.5;
11700
+ } else {
11701
+ sampler = 1;
11702
+ progress = (currentTimeProgress - 0.5) / 0.5;
11703
+ }
11704
+ const width = target.width;
11705
+ const height = target.height;
11706
+ const start = [0, height / 2];
11707
+ const end = [600, height / 2];
11708
+ const texSize = [width, height];
11709
+ const dx = end[0] - start[0];
11710
+ const dy = end[1] - start[1];
11711
+ const d = Math.sqrt(dx * dx + dy * dy);
11712
+ QuadUvGeometry.draw(renderer, TiltShiftTransition.material, {
11713
+ sampler,
11714
+ progress,
11715
+ blur: this.blur,
11716
+ gradientBlur: this.gradientBlur,
11717
+ start,
11718
+ end,
11719
+ delta: [dx / d, dy / d],
11720
+ texSize
11721
+ });
11722
+ QuadUvGeometry.draw(renderer, TiltShiftTransition.material, {
11723
+ sampler,
11724
+ progress,
11725
+ blur: this.blur,
11726
+ gradientBlur: this.gradientBlur,
11727
+ start,
11728
+ end,
11729
+ delta: [-dy / d, dx / d],
11730
+ texSize
11731
+ });
11732
+ }
11733
+ };
11734
+ __publicField$1(TiltShiftTransition, "material", new Material({
11735
+ vert: `attribute vec2 position;
11736
+ attribute vec2 uv;
11737
+ varying vec2 vUv;
11738
+ void main() {
11739
+ gl_Position = vec4(position, 0.0, 1.0);
11740
+ vUv = uv;
11741
+ }`,
11742
+ frag: `precision highp float;
11743
+ varying vec2 vUv;
11744
+ uniform sampler2D sampler;
11745
+ uniform float blur;
11746
+ uniform float gradientBlur;
11747
+ uniform vec2 start;
11748
+ uniform vec2 end;
11749
+ uniform vec2 delta;
11750
+ uniform vec2 texSize;
11751
+ uniform float progress;
11752
+
11753
+ float random(vec3 scale, float seed) {
11754
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
11755
+ }
11756
+
11757
+ void main(void) {
11758
+ float blur1 = blur - progress * blur;
11759
+ float gradientBlur1 = progress * gradientBlur;
11760
+
11761
+ vec4 color = vec4(0.0);
11762
+ float total = 0.0;
11763
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
11764
+ vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));
11765
+ float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;
11766
+
11767
+ for (float t = -30.0; t <= 30.0; t++) {
11768
+ float percent = (t + offset - 0.5) / 30.0;
11769
+ float weight = 1.0 - abs(percent);
11770
+ vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);
11771
+ sample1.rgb *= sample1.a;
11772
+ color += sample1 * weight;
11773
+ total += weight;
11774
+ }
11775
+
11776
+ color /= total;
11777
+ color.rgb /= color.a + 0.00001;
11778
+
11779
+ gl_FragColor = color;
11780
+ }`
11781
+ }));
11782
+ TiltShiftTransition = __decorateClass$1([
11783
+ customNode("TiltShiftTransition")
11784
+ ], TiltShiftTransition);
11785
+
11786
+ var __defProp = Object.defineProperty;
11787
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11788
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11789
+ var __decorateClass = (decorators, target, key, kind) => {
11790
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc(target, key) : target;
11791
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11792
+ if (decorator = decorators[i])
11793
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11794
+ if (kind && result) __defProp(target, key, result);
11795
+ return result;
11796
+ };
11797
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
11798
+ let TwistTransition = class extends Transition {
11799
+ radius;
11800
+ angle = 4;
11801
+ padding = 20;
11802
+ offset;
11803
+ apply(renderer, source) {
11804
+ const currentTimeProgress = this.currentTimeProgress;
11805
+ let sampler;
11806
+ let progress;
11807
+ if (currentTimeProgress < 0.5) {
11808
+ sampler = 0;
11809
+ progress = (0.5 - currentTimeProgress) / 0.5;
11810
+ } else {
11811
+ sampler = 1;
11812
+ progress = (currentTimeProgress - 0.5) / 0.5;
11813
+ }
11814
+ const width = source.width;
11815
+ const height = source.height;
11816
+ QuadUvGeometry.draw(renderer, TwistTransition.material, {
11817
+ sampler,
11818
+ progress,
11819
+ filterArea: [width, height, 0, 0],
11820
+ radius: this.radius ?? width,
11821
+ angle: this.angle,
11822
+ padding: this.padding,
11823
+ offset: this.offset ?? [width / 2, height / 2]
11824
+ });
11825
+ }
11826
+ };
11827
+ __publicField(TwistTransition, "material", new Material({
11828
+ vert: `attribute vec2 position;
11829
+ attribute vec2 uv;
11830
+ varying vec2 vUv;
11831
+ void main() {
11832
+ gl_Position = vec4(position, 0.0, 1.0);
11833
+ vUv = uv;
11834
+ }`,
11835
+ frag: `precision highp float;
11836
+ varying vec2 vUv;
11837
+ uniform sampler2D sampler;
11838
+ uniform float radius;
11839
+ uniform float angle;
11840
+ uniform vec2 offset;
11841
+ uniform vec4 filterArea;
11842
+ uniform float progress;
11843
+
11844
+ vec2 mapCoord(vec2 coord) {
11845
+ coord -= filterArea.zw;
11846
+ coord *= filterArea.xy;
11847
+ return coord;
11848
+ }
11849
+
11850
+ vec2 unmapCoord(vec2 coord) {
11851
+ coord -= filterArea.zw;
11852
+ coord /= filterArea.xy;
11853
+ return coord;
11854
+ }
11855
+
11856
+ vec2 twist(vec2 coord, float radius) {
11857
+ coord -= offset;
11858
+ float dist = length(coord);
11859
+ if (dist < radius) {
11860
+ float ratioDist = (radius - dist) / radius;
11861
+ float angleMod = ratioDist * ratioDist * angle;
11862
+ float s = sin(angleMod);
11863
+ float c = cos(angleMod);
11864
+ coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);
11865
+ }
11866
+ coord += offset;
11867
+ return coord;
11868
+ }
11869
+
11870
+ void main(void) {
11871
+ vec2 coord = mapCoord(vUv);
11872
+ coord = twist(coord, radius - (progress * radius));
11873
+ coord = unmapCoord(coord);
11874
+ gl_FragColor = texture2D(sampler, coord);
11875
+ }`
11876
+ }));
11877
+ TwistTransition = __decorateClass([
11878
+ customNode("TwistTransition")
11879
+ ], TwistTransition);
11880
+
11848
11881
  class GifLoader extends Loader {
11849
11882
  install(assets) {
11850
11883
  const handler = async (url) => {
@@ -12563,4 +12596,4 @@ async function render(options) {
12563
12596
  });
12564
12597
  }
12565
12598
 
12566
- export { Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BlurEffect, CanvasContext, CanvasEditor, CanvasItem, CanvasItemStyle, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, Effect, EffectMaterial, EmbossEffect, Engine, EventEmitter, FontLoader, Geometry, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, Image2DResource, ImageTexture, IndexBuffer, Input, InputEvent, JsonLoader, KawaseEffect, LeftEraseEffect, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, Scaler, SceneTree, ScrollBar, ShadowEffect, Text2D, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftEffect, Timeline, TimelineNode, Transform2D, TwistEffect, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };
12599
+ export { Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BlurEffect, CanvasContext, CanvasEditor, CanvasItem, CanvasItemStyle, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, Effect, EffectMaterial, EmbossEffect, Engine, EventEmitter, FontLoader, Geometry, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, Image2DResource, ImageTexture, IndexBuffer, Input, InputEvent, JsonLoader, KawaseTransition, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, MouseInputEvent, Node, Node2D, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, Scaler, SceneTree, ScrollBar, ShadowEffect, Text2D, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, XScrollBar, YScrollBar, ZoomBlurEffect, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };