modern-canvas 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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,76 +6377,235 @@ 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);
6449
- this.viewport2.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
+ get _effectMode() {
6566
+ return this.effectMode ?? "parent";
6567
+ }
6568
+ /** Viewports */
6569
+ viewport1 = new Viewport();
6570
+ viewport2 = new Viewport();
6571
+ /** Render call */
6572
+ _renderId = 0;
6573
+ _renderViewport;
6574
+ /** Temporary nodes for transition */
6575
+ _previousSibling;
6576
+ _nextSibling;
6577
+ constructor(properties, children = []) {
6578
+ super();
6579
+ this._onProcessing = this._onProcessing.bind(this);
6580
+ this._onNodeProcessed = this._onNodeProcessed.bind(this);
6581
+ this.setProperties(properties).append(children);
6582
+ }
6583
+ _updateProperty(key, value, oldValue, declaration) {
6584
+ super._updateProperty(key, value, oldValue, declaration);
6585
+ switch (key) {
6586
+ case "glsl": {
6587
+ const material = new EffectMaterial(value);
6588
+ if (!this.effectMode && material.has.transition) {
6589
+ this.effectMode = "transition";
6590
+ }
6591
+ this.material = material;
6592
+ break;
6593
+ }
6594
+ case "glslSrc": {
6595
+ if (value) {
6596
+ assets.text.load(value).then((glsl) => this.glsl = glsl);
6597
+ } else {
6598
+ this.glsl = "";
6599
+ }
6600
+ break;
6601
+ }
6602
+ }
6603
+ }
6604
+ _treeEnter(tree) {
6605
+ tree.on("processing", this._onProcessing);
6606
+ tree.on("nodeProcessed", this._onNodeProcessed);
6607
+ this.viewport1.setTree(tree);
6608
+ this.viewport2.setTree(tree);
6450
6609
  }
6451
6610
  _treeExit(oldTree) {
6452
6611
  oldTree.off("processing", this._onProcessing);
@@ -6456,7 +6615,7 @@ let Effect = class extends TimelineNode {
6456
6615
  }
6457
6616
  _onProcessing() {
6458
6617
  this._updateCurrentTime();
6459
- switch (this._mode) {
6618
+ switch (this._effectMode) {
6460
6619
  case "transition":
6461
6620
  this._previousSibling = this.previousSibling;
6462
6621
  this._nextSibling = this.nextSibling;
@@ -6473,7 +6632,7 @@ let Effect = class extends TimelineNode {
6473
6632
  const renderStack = this._tree?.renderStack;
6474
6633
  if (!renderStack)
6475
6634
  return;
6476
- switch (this._mode) {
6635
+ switch (this._effectMode) {
6477
6636
  case "transition":
6478
6637
  if (node.is(this._previousSibling)) {
6479
6638
  this._previousSibling = undefined;
@@ -6513,8 +6672,10 @@ let Effect = class extends TimelineNode {
6513
6672
  }
6514
6673
  }
6515
6674
  _onProcess(delta = 0) {
6675
+ if (!this.canProcess())
6676
+ return;
6516
6677
  this._renderId = 0;
6517
- switch (this._mode) {
6678
+ switch (this._effectMode) {
6518
6679
  case "before":
6519
6680
  super._onProcess(delta);
6520
6681
  break;
@@ -6573,7 +6734,7 @@ let Effect = class extends TimelineNode {
6573
6734
  this.viewport1.activate(renderer);
6574
6735
  this.apply(renderer, this.viewport1, {
6575
6736
  redraw: true,
6576
- target: this._mode === "parent" ? this._parent ?? undefined : undefined,
6737
+ target: this._effectMode === "parent" ? this._parent ?? undefined : undefined,
6577
6738
  targetArea: this._parseTargetArea()
6578
6739
  });
6579
6740
  oldViewport.activate(renderer);
@@ -6583,7 +6744,7 @@ let Effect = class extends TimelineNode {
6583
6744
  }
6584
6745
  }
6585
6746
  _parseTargetArea() {
6586
- if (this._mode === "parent" && this._parent && "getRect" in this._parent) {
6747
+ if (this._effectMode === "parent" && this._parent && "getRect" in this._parent) {
6587
6748
  const rect = this._parent.getRect();
6588
6749
  if (rect) {
6589
6750
  return [
@@ -6596,7 +6757,7 @@ let Effect = class extends TimelineNode {
6596
6757
  }
6597
6758
  }
6598
6759
  _render(renderer) {
6599
- switch (this._mode) {
6760
+ switch (this._effectMode) {
6600
6761
  case "before":
6601
6762
  this._renderBefore(renderer);
6602
6763
  break;
@@ -6639,7 +6800,7 @@ __decorateClass$B([
6639
6800
  ], Effect.prototype, "material", 2);
6640
6801
  __decorateClass$B([
6641
6802
  property()
6642
- ], Effect.prototype, "mode", 2);
6803
+ ], Effect.prototype, "effectMode", 2);
6643
6804
  __decorateClass$B([
6644
6805
  property({ default: "" })
6645
6806
  ], Effect.prototype, "glsl", 2);
@@ -7726,249 +7887,98 @@ var __decorateClass$r = (decorators, target, key, kind) => {
7726
7887
  return result;
7727
7888
  };
7728
7889
  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;
7890
+ let MaskEffect = class extends Effect {
7891
+ texture;
7892
+ constructor(properties, children = []) {
7893
+ super();
7894
+ this.setProperties(properties).append(children);
7895
+ }
7896
+ async load() {
7897
+ this.texture = undefined;
7898
+ if (this.src) {
7899
+ this.texture = await assets.texture.load(this.src);
7742
7900
  }
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
- }
7901
+ }
7902
+ _updateProperty(key, value, oldValue, declaration) {
7903
+ super._updateProperty(key, value, oldValue, declaration);
7904
+ switch (key) {
7905
+ case "src":
7906
+ this.load();
7907
+ break;
7908
+ case "texture":
7909
+ oldValue?.destroy?.();
7910
+ break;
7756
7911
  }
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
7912
+ }
7913
+ apply(renderer, source, context) {
7914
+ if (this.texture && context.targetArea) {
7915
+ source.redraw(renderer, () => {
7916
+ this.texture.activate(renderer, 1);
7917
+ QuadUvGeometry.draw(renderer, MaskEffect.material, {
7918
+ sampler: 0,
7919
+ mask: 1,
7920
+ area: context.targetArea
7921
+ });
7922
+ renderer.texture.unbind(1);
7768
7923
  });
7769
7924
  }
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
7925
  }
7784
7926
  };
7785
- __publicField$8(KawaseEffect, "material", new Material({
7786
- vert: `attribute vec2 position;
7927
+ __publicField$8(MaskEffect, "material", new Material({
7928
+ vert: `precision mediump float;
7929
+ attribute vec2 position;
7787
7930
  attribute vec2 uv;
7788
7931
  varying vec2 vUv;
7789
7932
  void main() {
7790
7933
  gl_Position = vec4(position, 0.0, 1.0);
7791
7934
  vUv = uv;
7792
7935
  }`,
7793
- frag: `precision highp float;
7794
- varying vec2 vUv;
7936
+ frag: `varying vec2 vUv;
7795
7937
  uniform sampler2D sampler;
7796
- uniform vec2 offset;
7797
- uniform float progress;
7938
+ uniform sampler2D mask;
7939
+ uniform float area[4];
7798
7940
 
7799
7941
  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;
7942
+ if (
7943
+ vUv.x > area[0]
7944
+ && vUv.x < (area[0] + area[2])
7945
+ && (1.0 - vUv.y) > area[1]
7946
+ && (1.0 - vUv.y) < (area[1] + area[3])
7947
+ ) {
7948
+ vec4 color = texture2D(sampler, vUv);
7949
+ vec2 uv = vec2(
7950
+ (vUv.x - area[0]) / area[2],
7951
+ ((1.0 - vUv.y) - area[1]) / area[3]
7952
+ );
7953
+ vec4 maskColor = texture2D(mask, uv);
7954
+ gl_FragColor = mix(vec4(0.), color, maskColor.a);
7955
+ } else {
7956
+ gl_FragColor = vec4(0.);
7957
+ }
7808
7958
  }`
7809
7959
  }));
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([
7960
+ __decorateClass$r([
7951
7961
  protectedProperty()
7952
7962
  ], MaskEffect.prototype, "texture", 2);
7953
- __decorateClass$p([
7963
+ __decorateClass$r([
7954
7964
  property({ default: "" })
7955
7965
  ], MaskEffect.prototype, "src", 2);
7956
- MaskEffect = __decorateClass$p([
7966
+ MaskEffect = __decorateClass$r([
7957
7967
  customNode("MaskEffect")
7958
7968
  ], MaskEffect);
7959
7969
 
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;
7970
+ var __defProp$q = Object.defineProperty;
7971
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
7972
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7973
+ var __decorateClass$q = (decorators, target, key, kind) => {
7974
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$p(target, key) : target;
7965
7975
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7966
7976
  if (decorator = decorators[i])
7967
7977
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7968
- if (kind && result) __defProp$o(target, key, result);
7978
+ if (kind && result) __defProp$q(target, key, result);
7969
7979
  return result;
7970
7980
  };
7971
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
7981
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, key + "" , value);
7972
7982
  let PixelateEffect = class extends Effect {
7973
7983
  size;
7974
7984
  constructor(size = 10) {
@@ -7985,7 +7995,7 @@ let PixelateEffect = class extends Effect {
7985
7995
  });
7986
7996
  }
7987
7997
  };
7988
- __publicField$5(PixelateEffect, "material", new Material({
7998
+ __publicField$7(PixelateEffect, "material", new Material({
7989
7999
  vert: `precision mediump float;
7990
8000
  attribute vec2 position;
7991
8001
  attribute vec2 uv;
@@ -8022,25 +8032,25 @@ void main(void) {
8022
8032
  gl_FragColor = texture2D(sampler, coord);
8023
8033
  }`
8024
8034
  }));
8025
- __decorateClass$o([
8035
+ __decorateClass$q([
8026
8036
  property()
8027
8037
  ], PixelateEffect.prototype, "size", 2);
8028
- PixelateEffect = __decorateClass$o([
8038
+ PixelateEffect = __decorateClass$q([
8029
8039
  customNode("PixelateEffect")
8030
8040
  ], PixelateEffect);
8031
8041
 
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;
8042
+ var __defProp$p = Object.defineProperty;
8043
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8044
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8045
+ var __decorateClass$p = (decorators, target, key, kind) => {
8046
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$o(target, key) : target;
8037
8047
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8038
8048
  if (decorator = decorators[i])
8039
8049
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8040
- if (kind && result) __defProp$n(target, key, result);
8050
+ if (kind && result) __defProp$p(target, key, result);
8041
8051
  return result;
8042
8052
  };
8043
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
8053
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
8044
8054
  let ShadowEffect = class extends Effect {
8045
8055
  blur = new BlurEffect();
8046
8056
  viewport3 = new Viewport();
@@ -8067,7 +8077,7 @@ let ShadowEffect = class extends Effect {
8067
8077
  });
8068
8078
  }
8069
8079
  };
8070
- __publicField$4(ShadowEffect, "material", new Material({
8080
+ __publicField$6(ShadowEffect, "material", new Material({
8071
8081
  vert: `precision mediump float;
8072
8082
  attribute vec2 position;
8073
8083
  attribute vec2 uv;
@@ -8090,67 +8100,41 @@ void main(void) {
8090
8100
  gl_FragColor = sample;
8091
8101
  }`
8092
8102
  }));
8093
- ShadowEffect = __decorateClass$n([
8103
+ ShadowEffect = __decorateClass$p([
8094
8104
  customNode("ShadowEffect")
8095
8105
  ], ShadowEffect);
8096
8106
 
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;
8107
+ var __defProp$o = Object.defineProperty;
8108
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8109
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8110
+ var __decorateClass$o = (decorators, target, key, kind) => {
8111
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$n(target, key) : target;
8102
8112
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8103
8113
  if (decorator = decorators[i])
8104
8114
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8105
- if (kind && result) __defProp$m(target, key, result);
8115
+ if (kind && result) __defProp$o(target, key, result);
8106
8116
  return result;
8107
8117
  };
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
8118
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
8119
+ let ZoomBlurEffect = class extends Effect {
8120
+ center;
8121
+ innerRadius = 20;
8122
+ radius = -1;
8123
+ strength = 0.1;
8124
+ apply(renderer, source) {
8125
+ source.redraw(renderer, () => {
8126
+ QuadUvGeometry.draw(renderer, ZoomBlurEffect.material, {
8127
+ sampler: 0,
8128
+ center: this.center ?? [source.width / 2, source.height / 2],
8129
+ innerRadius: this.innerRadius,
8130
+ radius: this.radius,
8131
+ strength: this.strength,
8132
+ inputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
8133
+ });
8150
8134
  });
8151
8135
  }
8152
8136
  };
8153
- __publicField$3(TiltShiftEffect, "material", new Material({
8137
+ __publicField$5(ZoomBlurEffect, "material", new Material({
8154
8138
  vert: `attribute vec2 position;
8155
8139
  attribute vec2 uv;
8156
8140
  varying vec2 vUv;
@@ -8158,199 +8142,22 @@ void main() {
8158
8142
  gl_Position = vec4(position, 0.0, 1.0);
8159
8143
  vUv = uv;
8160
8144
  }`,
8161
- frag: `precision highp float;
8162
- varying vec2 vUv;
8145
+ frag: `varying vec2 vUv;
8163
8146
  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;
8147
+ uniform vec4 inputSize;
8171
8148
 
8172
- float random(vec3 scale, float seed) {
8173
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
8174
- }
8149
+ uniform vec2 center;
8150
+ uniform float strength;
8151
+ uniform float innerRadius;
8152
+ uniform float radius;
8175
8153
 
8176
- void main(void) {
8177
- float blur1 = blur - progress * blur;
8178
- float gradientBlur1 = progress * gradientBlur;
8154
+ const float MAX_KERNEL_SIZE = 32.0;
8179
8155
 
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
- }
8156
+ highp float rand(vec2 co, float seed) {
8157
+ const highp float a = 12.9898, b = 78.233, c = 43758.5453;
8158
+ highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);
8159
+ return fract(sin(sn) * c + seed);
8160
+ }
8354
8161
 
8355
8162
  void main() {
8356
8163
  float minGradient = innerRadius * 0.3;
@@ -8411,30 +8218,30 @@ void main() {
8411
8218
  gl_FragColor = color;
8412
8219
  }`
8413
8220
  }));
8414
- __decorateClass$k([
8221
+ __decorateClass$o([
8415
8222
  property()
8416
8223
  ], ZoomBlurEffect.prototype, "center", 2);
8417
- __decorateClass$k([
8224
+ __decorateClass$o([
8418
8225
  property()
8419
8226
  ], ZoomBlurEffect.prototype, "innerRadius", 2);
8420
- __decorateClass$k([
8227
+ __decorateClass$o([
8421
8228
  property()
8422
8229
  ], ZoomBlurEffect.prototype, "radius", 2);
8423
- __decorateClass$k([
8230
+ __decorateClass$o([
8424
8231
  property()
8425
8232
  ], ZoomBlurEffect.prototype, "strength", 2);
8426
- ZoomBlurEffect = __decorateClass$k([
8233
+ ZoomBlurEffect = __decorateClass$o([
8427
8234
  customNode("ZoomBlurEffect")
8428
8235
  ], ZoomBlurEffect);
8429
8236
 
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;
8237
+ var __defProp$n = Object.defineProperty;
8238
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8239
+ var __decorateClass$n = (decorators, target, key, kind) => {
8240
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$m(target, key) : target;
8434
8241
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8435
8242
  if (decorator = decorators[i])
8436
8243
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8437
- if (kind && result) __defProp$j(target, key, result);
8244
+ if (kind && result) __defProp$n(target, key, result);
8438
8245
  return result;
8439
8246
  };
8440
8247
  let CanvasItem = class extends TimelineNode {
@@ -8729,13 +8536,13 @@ let CanvasItem = class extends TimelineNode {
8729
8536
  };
8730
8537
  }
8731
8538
  };
8732
- __decorateClass$j([
8539
+ __decorateClass$n([
8733
8540
  property()
8734
8541
  ], CanvasItem.prototype, "modulate", 2);
8735
- __decorateClass$j([
8542
+ __decorateClass$n([
8736
8543
  property()
8737
8544
  ], CanvasItem.prototype, "blendMode", 2);
8738
- CanvasItem = __decorateClass$j([
8545
+ CanvasItem = __decorateClass$n([
8739
8546
  customNode("CanvasItem")
8740
8547
  ], CanvasItem);
8741
8548
 
@@ -8765,14 +8572,14 @@ class RenderStack extends Node {
8765
8572
  }
8766
8573
  }
8767
8574
 
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;
8575
+ var __defProp$m = Object.defineProperty;
8576
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8577
+ var __decorateClass$m = (decorators, target, key, kind) => {
8578
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$l(target, key) : target;
8772
8579
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8773
8580
  if (decorator = decorators[i])
8774
8581
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8775
- if (kind && result) __defProp$i(target, key, result);
8582
+ if (kind && result) __defProp$m(target, key, result);
8776
8583
  return result;
8777
8584
  };
8778
8585
  let Timeline = class extends Node {
@@ -8817,213 +8624,52 @@ let Timeline = class extends Node {
8817
8624
  this.addTime(delta);
8818
8625
  }
8819
8626
  };
8820
- __decorateClass$i([
8627
+ __decorateClass$m([
8821
8628
  property({ default: 0 })
8822
8629
  ], Timeline.prototype, "startTime", 2);
8823
- __decorateClass$i([
8630
+ __decorateClass$m([
8824
8631
  property({ default: 0 })
8825
8632
  ], Timeline.prototype, "currentTime", 2);
8826
- __decorateClass$i([
8633
+ __decorateClass$m([
8827
8634
  property({ default: Number.MAX_SAFE_INTEGER })
8828
8635
  ], Timeline.prototype, "endTime", 2);
8829
- __decorateClass$i([
8636
+ __decorateClass$m([
8830
8637
  property({ default: false })
8831
8638
  ], Timeline.prototype, "loop", 2);
8832
- Timeline = __decorateClass$i([
8639
+ Timeline = __decorateClass$m([
8833
8640
  customNode("Timeline")
8834
8641
  ], Timeline);
8835
8642
 
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;
8643
+ var __defProp$l = Object.defineProperty;
8644
+ var __decorateClass$l = (decorators, target, key, kind) => {
8645
+ var result = undefined ;
8840
8646
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8841
8647
  if (decorator = decorators[i])
8842
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8843
- if (kind && result) __defProp$h(target, key, result);
8648
+ result = (decorator(target, key, result) ) || result;
8649
+ if (result) __defProp$l(target, key, result);
8844
8650
  return result;
8845
8651
  };
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;
8652
+ class SceneTree extends MainLoop {
8653
+ renderStack = new RenderStack();
8654
+ root = new Viewport(true).setTree(this);
8655
+ timeline;
8656
+ _backgroundColor = new Color();
8657
+ _currentViewport;
8658
+ getCurrentViewport() {
8659
+ return this._currentViewport;
8866
8660
  }
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
- };
8661
+ setCurrentViewport(viewport) {
8662
+ this._currentViewport = viewport;
8883
8663
  }
8884
- /** @internal */
8885
- _glFramebuffer(renderer) {
8886
- return renderer.getRelated(this.framebuffer, () => {
8887
- return renderer.framebuffer.create(
8888
- this._glFramebufferOptions(renderer)
8889
- );
8890
- });
8664
+ constructor(timeline = new Timeline()) {
8665
+ super();
8666
+ this.timeline = timeline.setTree(this);
8891
8667
  }
8892
8668
  _updateProperty(key, value, oldValue, declaration) {
8893
8669
  super._updateProperty(key, value, oldValue, declaration);
8894
8670
  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;
8671
+ case "backgroundColor":
8672
+ this._backgroundColor.value = value;
9027
8673
  break;
9028
8674
  }
9029
8675
  }
@@ -9061,21 +8707,45 @@ class SceneTree extends MainLoop {
9061
8707
  renderer.texture.unbind(texture);
9062
8708
  }
9063
8709
  }
9064
- __decorateClass$g([
8710
+ __decorateClass$l([
9065
8711
  property({ default: false })
9066
8712
  ], SceneTree.prototype, "paused");
9067
- __decorateClass$g([
8713
+ __decorateClass$l([
9068
8714
  property()
9069
8715
  ], SceneTree.prototype, "backgroundColor");
9070
8716
 
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;
8717
+ var __defProp$k = Object.defineProperty;
8718
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8719
+ var __decorateClass$k = (decorators, target, key, kind) => {
8720
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$k(target, key) : target;
9075
8721
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9076
8722
  if (decorator = decorators[i])
9077
8723
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9078
- if (kind && result) __defProp$f(target, key, result);
8724
+ if (kind && result) __defProp$k(target, key, result);
8725
+ return result;
8726
+ };
8727
+ let Transition = class extends Effect {
8728
+ constructor(properties, children = []) {
8729
+ super();
8730
+ this.setProperties(properties).append(children);
8731
+ }
8732
+ };
8733
+ Transition = __decorateClass$k([
8734
+ customNode("Transition", {
8735
+ effectMode: "transition",
8736
+ processMode: "pausable",
8737
+ duration: 2e3
8738
+ })
8739
+ ], Transition);
8740
+
8741
+ var __defProp$j = Object.defineProperty;
8742
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8743
+ var __decorateClass$j = (decorators, target, key, kind) => {
8744
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$j(target, key) : target;
8745
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8746
+ if (decorator = decorators[i])
8747
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8748
+ if (kind && result) __defProp$j(target, key, result);
9079
8749
  return result;
9080
8750
  };
9081
8751
  let Node2D = class extends CanvasItem {
@@ -9216,18 +8886,18 @@ let Node2D = class extends CanvasItem {
9216
8886
  );
9217
8887
  }
9218
8888
  };
9219
- Node2D = __decorateClass$f([
8889
+ Node2D = __decorateClass$j([
9220
8890
  customNode("Node2D")
9221
8891
  ], Node2D);
9222
8892
 
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;
8893
+ var __defProp$i = Object.defineProperty;
8894
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8895
+ var __decorateClass$i = (decorators, target, key, kind) => {
8896
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$i(target, key) : target;
9227
8897
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9228
8898
  if (decorator = decorators[i])
9229
8899
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9230
- if (kind && result) __defProp$e(target, key, result);
8900
+ if (kind && result) __defProp$i(target, key, result);
9231
8901
  return result;
9232
8902
  };
9233
8903
  function proxy(options) {
@@ -9272,61 +8942,61 @@ let Graphics2D = class extends Node2D {
9272
8942
  return this;
9273
8943
  }
9274
8944
  };
9275
- __decorateClass$e([
8945
+ __decorateClass$i([
9276
8946
  proxy()
9277
8947
  ], Graphics2D.prototype, "lineCap", 2);
9278
- __decorateClass$e([
8948
+ __decorateClass$i([
9279
8949
  proxy()
9280
8950
  ], Graphics2D.prototype, "lineJoin", 2);
9281
- __decorateClass$e([
8951
+ __decorateClass$i([
9282
8952
  proxy()
9283
8953
  ], Graphics2D.prototype, "fillStyle", 2);
9284
- __decorateClass$e([
8954
+ __decorateClass$i([
9285
8955
  proxy()
9286
8956
  ], Graphics2D.prototype, "strokeStyle", 2);
9287
- __decorateClass$e([
8957
+ __decorateClass$i([
9288
8958
  proxy()
9289
8959
  ], Graphics2D.prototype, "lineWidth", 2);
9290
- __decorateClass$e([
8960
+ __decorateClass$i([
9291
8961
  proxy()
9292
8962
  ], Graphics2D.prototype, "miterLimit", 2);
9293
- __decorateClass$e([
8963
+ __decorateClass$i([
9294
8964
  proxy({ method: true })
9295
8965
  ], Graphics2D.prototype, "rect", 2);
9296
- __decorateClass$e([
8966
+ __decorateClass$i([
9297
8967
  proxy({ method: true, redraw: true })
9298
8968
  ], Graphics2D.prototype, "fillRect", 2);
9299
- __decorateClass$e([
8969
+ __decorateClass$i([
9300
8970
  proxy({ method: true, redraw: true })
9301
8971
  ], Graphics2D.prototype, "strokeRect", 2);
9302
- __decorateClass$e([
8972
+ __decorateClass$i([
9303
8973
  proxy({ method: true })
9304
8974
  ], Graphics2D.prototype, "roundRect", 2);
9305
- __decorateClass$e([
8975
+ __decorateClass$i([
9306
8976
  proxy({ method: true })
9307
8977
  ], Graphics2D.prototype, "ellipse", 2);
9308
- __decorateClass$e([
8978
+ __decorateClass$i([
9309
8979
  proxy({ method: true })
9310
8980
  ], Graphics2D.prototype, "arc", 2);
9311
- __decorateClass$e([
8981
+ __decorateClass$i([
9312
8982
  proxy({ method: true })
9313
8983
  ], Graphics2D.prototype, "beginPath", 2);
9314
- __decorateClass$e([
8984
+ __decorateClass$i([
9315
8985
  proxy({ method: true })
9316
8986
  ], Graphics2D.prototype, "moveTo", 2);
9317
- __decorateClass$e([
8987
+ __decorateClass$i([
9318
8988
  proxy({ method: true })
9319
8989
  ], Graphics2D.prototype, "lineTo", 2);
9320
- __decorateClass$e([
8990
+ __decorateClass$i([
9321
8991
  proxy({ method: true })
9322
8992
  ], Graphics2D.prototype, "closePath", 2);
9323
- __decorateClass$e([
8993
+ __decorateClass$i([
9324
8994
  proxy({ method: true, redraw: true })
9325
8995
  ], Graphics2D.prototype, "fill", 2);
9326
- __decorateClass$e([
8996
+ __decorateClass$i([
9327
8997
  proxy({ method: true, redraw: true })
9328
8998
  ], Graphics2D.prototype, "stroke", 2);
9329
- Graphics2D = __decorateClass$e([
8999
+ Graphics2D = __decorateClass$i([
9330
9000
  customNode("Graphics2D")
9331
9001
  ], Graphics2D);
9332
9002
 
@@ -9356,14 +9026,14 @@ class Image2DResource extends Resource {
9356
9026
  }
9357
9027
  }
9358
9028
 
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;
9029
+ var __defProp$h = Object.defineProperty;
9030
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
9031
+ var __decorateClass$h = (decorators, target, key, kind) => {
9032
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$h(target, key) : target;
9363
9033
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9364
9034
  if (decorator = decorators[i])
9365
9035
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9366
- if (kind && result) __defProp$d(target, key, result);
9036
+ if (kind && result) __defProp$h(target, key, result);
9367
9037
  return result;
9368
9038
  };
9369
9039
  let Image2D = class extends Node2D {
@@ -9483,16 +9153,16 @@ let Image2D = class extends Node2D {
9483
9153
  }
9484
9154
  }
9485
9155
  };
9486
- __decorateClass$d([
9156
+ __decorateClass$h([
9487
9157
  protectedProperty()
9488
9158
  ], Image2D.prototype, "resource", 2);
9489
- __decorateClass$d([
9159
+ __decorateClass$h([
9490
9160
  property({ default: false })
9491
9161
  ], Image2D.prototype, "gif", 2);
9492
- __decorateClass$d([
9162
+ __decorateClass$h([
9493
9163
  property({ default: "" })
9494
9164
  ], Image2D.prototype, "src", 2);
9495
- Image2D = __decorateClass$d([
9165
+ Image2D = __decorateClass$h([
9496
9166
  customNode("Image2D")
9497
9167
  ], Image2D);
9498
9168
 
@@ -9510,14 +9180,14 @@ class TextureRect2D extends Node2D {
9510
9180
  }
9511
9181
  }
9512
9182
 
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;
9183
+ var __defProp$g = Object.defineProperty;
9184
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
9185
+ var __decorateClass$g = (decorators, target, key, kind) => {
9186
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$g(target, key) : target;
9517
9187
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9518
9188
  if (decorator = decorators[i])
9519
9189
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9520
- if (kind && result) __defProp$c(target, key, result);
9190
+ if (kind && result) __defProp$g(target, key, result);
9521
9191
  return result;
9522
9192
  };
9523
9193
  let Lottie2D = class extends TextureRect2D {
@@ -9560,21 +9230,21 @@ let Lottie2D = class extends TextureRect2D {
9560
9230
  super._process(delta);
9561
9231
  }
9562
9232
  };
9563
- __decorateClass$c([
9233
+ __decorateClass$g([
9564
9234
  property({ default: "" })
9565
9235
  ], Lottie2D.prototype, "src", 2);
9566
- Lottie2D = __decorateClass$c([
9236
+ Lottie2D = __decorateClass$g([
9567
9237
  customNode("Lottie2D")
9568
9238
  ], Lottie2D);
9569
9239
 
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;
9240
+ var __defProp$f = Object.defineProperty;
9241
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9242
+ var __decorateClass$f = (decorators, target, key, kind) => {
9243
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$f(target, key) : target;
9574
9244
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9575
9245
  if (decorator = decorators[i])
9576
9246
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9577
- if (kind && result) __defProp$b(target, key, result);
9247
+ if (kind && result) __defProp$f(target, key, result);
9578
9248
  return result;
9579
9249
  };
9580
9250
  const textStyles = new Set(Object.keys(textDefaultStyle));
@@ -9712,33 +9382,33 @@ let Text2D = class extends TextureRect2D {
9712
9382
  }
9713
9383
  }
9714
9384
  };
9715
- __decorateClass$b([
9385
+ __decorateClass$f([
9716
9386
  property({ default: false })
9717
9387
  ], Text2D.prototype, "split", 2);
9718
- __decorateClass$b([
9388
+ __decorateClass$f([
9719
9389
  property({ default: "" })
9720
9390
  ], Text2D.prototype, "content", 2);
9721
- __decorateClass$b([
9391
+ __decorateClass$f([
9722
9392
  property()
9723
9393
  ], Text2D.prototype, "effects", 2);
9724
- __decorateClass$b([
9394
+ __decorateClass$f([
9725
9395
  protectedProperty()
9726
9396
  ], Text2D.prototype, "measureDom", 2);
9727
- __decorateClass$b([
9397
+ __decorateClass$f([
9728
9398
  protectedProperty()
9729
9399
  ], Text2D.prototype, "fonts", 2);
9730
- Text2D = __decorateClass$b([
9400
+ Text2D = __decorateClass$f([
9731
9401
  customNode("Text2D")
9732
9402
  ], Text2D);
9733
9403
 
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;
9404
+ var __defProp$e = Object.defineProperty;
9405
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9406
+ var __decorateClass$e = (decorators, target, key, kind) => {
9407
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$e(target, key) : target;
9738
9408
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9739
9409
  if (decorator = decorators[i])
9740
9410
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9741
- if (kind && result) __defProp$a(target, key, result);
9411
+ if (kind && result) __defProp$e(target, key, result);
9742
9412
  return result;
9743
9413
  };
9744
9414
  let Video2D = class extends TextureRect2D {
@@ -9791,21 +9461,21 @@ let Video2D = class extends TextureRect2D {
9791
9461
  super._process(delta);
9792
9462
  }
9793
9463
  };
9794
- __decorateClass$a([
9464
+ __decorateClass$e([
9795
9465
  property({ default: "" })
9796
9466
  ], Video2D.prototype, "src", 2);
9797
- Video2D = __decorateClass$a([
9467
+ Video2D = __decorateClass$e([
9798
9468
  customNode("Video2D")
9799
9469
  ], Video2D);
9800
9470
 
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])
9471
+ var __defProp$d = Object.defineProperty;
9472
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9473
+ var __decorateClass$d = (decorators, target, key, kind) => {
9474
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$d(target, key) : target;
9475
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9476
+ if (decorator = decorators[i])
9807
9477
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9808
- if (kind && result) __defProp$9(target, key, result);
9478
+ if (kind && result) __defProp$d(target, key, result);
9809
9479
  return result;
9810
9480
  };
9811
9481
  const linear = (amount) => amount;
@@ -9873,21 +9543,28 @@ let Animation = class extends TimelineNode {
9873
9543
  _stoped = false;
9874
9544
  constructor(properties, children = []) {
9875
9545
  super();
9876
- this.commitStyles = this.commitStyles.bind(this);
9546
+ this._process = this._process.bind(this);
9877
9547
  this.setProperties(properties).append(children);
9878
9548
  }
9879
9549
  _treeEnter(tree) {
9880
- tree.timeline.on("updateCurrentTime", this.commitStyles);
9550
+ tree.timeline.on("updateCurrentTime", this._process);
9881
9551
  this._updateCachedProps();
9882
9552
  }
9883
9553
  _treeExit(oldTree) {
9884
- oldTree.timeline.on("updateCurrentTime", this.commitStyles);
9554
+ oldTree.timeline.on("updateCurrentTime", this._process);
9885
9555
  this.cancel();
9886
9556
  }
9557
+ _onProcess() {
9558
+ }
9559
+ _process() {
9560
+ if (this.canProcess()) {
9561
+ this.commitStyles();
9562
+ }
9563
+ }
9887
9564
  _updateProperty(key, value, oldValue, declaration) {
9888
9565
  super._updateProperty(key, value, oldValue, declaration);
9889
9566
  switch (key) {
9890
- case "animationMode":
9567
+ case "effectMode":
9891
9568
  case "keyframes":
9892
9569
  this._updateKeyframes();
9893
9570
  break;
@@ -9895,7 +9572,7 @@ let Animation = class extends TimelineNode {
9895
9572
  }
9896
9573
  _getTargets() {
9897
9574
  let targets;
9898
- switch (this.animationMode) {
9575
+ switch (this.effectMode) {
9899
9576
  case "sibling":
9900
9577
  targets = this.getParent()?.getChildren(true).filter((val) => val instanceof CanvasItem) ?? [];
9901
9578
  break;
@@ -10117,22 +9794,22 @@ let Animation = class extends TimelineNode {
10117
9794
  });
10118
9795
  }
10119
9796
  };
10120
- __decorateClass$9([
9797
+ __decorateClass$d([
10121
9798
  property({ default: "parent" })
10122
- ], Animation.prototype, "animationMode", 2);
10123
- __decorateClass$9([
9799
+ ], Animation.prototype, "effectMode", 2);
9800
+ __decorateClass$d([
10124
9801
  property({ default: false })
10125
9802
  ], Animation.prototype, "loop", 2);
10126
- __decorateClass$9([
9803
+ __decorateClass$d([
10127
9804
  property({ default: [] })
10128
9805
  ], Animation.prototype, "keyframes", 2);
10129
- __decorateClass$9([
9806
+ __decorateClass$d([
10130
9807
  property()
10131
9808
  ], Animation.prototype, "easing", 2);
10132
- Animation = __decorateClass$9([
9809
+ Animation = __decorateClass$d([
10133
9810
  customNode("Animation", {
10134
9811
  renderMode: "disabled",
10135
- processMode: "disabled",
9812
+ processMode: "pausable",
10136
9813
  duration: 2e3
10137
9814
  })
10138
9815
  ], Animation);
@@ -11012,18 +10689,18 @@ class WebAudio extends AudioPipeline {
11012
10689
  }
11013
10690
  }
11014
10691
 
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;
10692
+ var __defProp$c = Object.defineProperty;
10693
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
10694
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10695
+ var __decorateClass$c = (decorators, target, key, kind) => {
10696
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$c(target, key) : target;
11020
10697
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11021
10698
  if (decorator = decorators[i])
11022
10699
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11023
- if (kind && result) __defProp$8(target, key, result);
10700
+ if (kind && result) __defProp$c(target, key, result);
11024
10701
  return result;
11025
10702
  };
11026
- var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
10703
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, key + "" , value);
11027
10704
  let Audio = class extends TimelineNode {
11028
10705
  _sounds = [];
11029
10706
  /** PlatformAudio */
@@ -11227,8 +10904,8 @@ let Audio = class extends TimelineNode {
11227
10904
  }, 100);
11228
10905
  }
11229
10906
  };
11230
- __publicField(Audio, "_soundPool", []);
11231
- Audio = __decorateClass$8([
10907
+ __publicField$4(Audio, "_soundPool", []);
10908
+ Audio = __decorateClass$c([
11232
10909
  customNode("Audio")
11233
10910
  ], Audio);
11234
10911
 
@@ -11236,14 +10913,14 @@ class AudioSpectrum extends Node2D {
11236
10913
  //
11237
10914
  }
11238
10915
 
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;
10916
+ var __defProp$b = Object.defineProperty;
10917
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
10918
+ var __decorateClass$b = (decorators, target, key, kind) => {
10919
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$b(target, key) : target;
11243
10920
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11244
10921
  if (decorator = decorators[i])
11245
10922
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11246
- if (kind && result) __defProp$7(target, key, result);
10923
+ if (kind && result) __defProp$b(target, key, result);
11247
10924
  return result;
11248
10925
  };
11249
10926
  let AudioWaveform = class extends Node2D {
@@ -11337,27 +11014,27 @@ let AudioWaveform = class extends Node2D {
11337
11014
  }
11338
11015
  }
11339
11016
  };
11340
- __decorateClass$7([
11017
+ __decorateClass$b([
11341
11018
  property()
11342
11019
  ], AudioWaveform.prototype, "src", 2);
11343
- __decorateClass$7([
11020
+ __decorateClass$b([
11344
11021
  property()
11345
11022
  ], AudioWaveform.prototype, "gap", 2);
11346
- __decorateClass$7([
11023
+ __decorateClass$b([
11347
11024
  property()
11348
11025
  ], AudioWaveform.prototype, "color", 2);
11349
- AudioWaveform = __decorateClass$7([
11026
+ AudioWaveform = __decorateClass$b([
11350
11027
  customNode("AudioWaveform")
11351
11028
  ], AudioWaveform);
11352
11029
 
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;
11030
+ var __defProp$a = Object.defineProperty;
11031
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
11032
+ var __decorateClass$a = (decorators, target, key, kind) => {
11033
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$a(target, key) : target;
11357
11034
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11358
11035
  if (decorator = decorators[i])
11359
11036
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11360
- if (kind && result) __defProp$6(target, key, result);
11037
+ if (kind && result) __defProp$a(target, key, result);
11361
11038
  return result;
11362
11039
  };
11363
11040
  let Control = class extends CanvasItem {
@@ -11417,18 +11094,18 @@ let Control = class extends CanvasItem {
11417
11094
  return new Rect2(left, top, width, height);
11418
11095
  }
11419
11096
  };
11420
- Control = __decorateClass$6([
11097
+ Control = __decorateClass$a([
11421
11098
  customNode("Control")
11422
11099
  ], Control);
11423
11100
 
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;
11101
+ var __defProp$9 = Object.defineProperty;
11102
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
11103
+ var __decorateClass$9 = (decorators, target, key, kind) => {
11104
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$9(target, key) : target;
11428
11105
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11429
11106
  if (decorator = decorators[i])
11430
11107
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11431
- if (kind && result) __defProp$5(target, key, result);
11108
+ if (kind && result) __defProp$9(target, key, result);
11432
11109
  return result;
11433
11110
  };
11434
11111
  let Range = class extends Control {
@@ -11451,39 +11128,39 @@ let Range = class extends Control {
11451
11128
  }
11452
11129
  }
11453
11130
  };
11454
- __decorateClass$5([
11131
+ __decorateClass$9([
11455
11132
  property({ default: false })
11456
11133
  ], Range.prototype, "allowGreater", 2);
11457
- __decorateClass$5([
11134
+ __decorateClass$9([
11458
11135
  property({ default: false })
11459
11136
  ], Range.prototype, "allowLesser", 2);
11460
- __decorateClass$5([
11137
+ __decorateClass$9([
11461
11138
  property({ default: 1 })
11462
11139
  ], Range.prototype, "page", 2);
11463
- __decorateClass$5([
11140
+ __decorateClass$9([
11464
11141
  property({ default: 0 })
11465
11142
  ], Range.prototype, "minValue", 2);
11466
- __decorateClass$5([
11143
+ __decorateClass$9([
11467
11144
  property({ default: 100 })
11468
11145
  ], Range.prototype, "maxValue", 2);
11469
- __decorateClass$5([
11146
+ __decorateClass$9([
11470
11147
  property({ default: 0.01 })
11471
11148
  ], Range.prototype, "step", 2);
11472
- __decorateClass$5([
11149
+ __decorateClass$9([
11473
11150
  property({ default: 0 })
11474
11151
  ], Range.prototype, "value", 2);
11475
- Range = __decorateClass$5([
11152
+ Range = __decorateClass$9([
11476
11153
  customNode("Range")
11477
11154
  ], Range);
11478
11155
 
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;
11156
+ var __defProp$8 = Object.defineProperty;
11157
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11158
+ var __decorateClass$8 = (decorators, target, key, kind) => {
11159
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$8(target, key) : target;
11483
11160
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11484
11161
  if (decorator = decorators[i])
11485
11162
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11486
- if (kind && result) __defProp$4(target, key, result);
11163
+ if (kind && result) __defProp$8(target, key, result);
11487
11164
  return result;
11488
11165
  };
11489
11166
  let Ruler = class extends Control {
@@ -11634,45 +11311,45 @@ let Ruler = class extends Control {
11634
11311
  }
11635
11312
  }
11636
11313
  };
11637
- __decorateClass$4([
11314
+ __decorateClass$8([
11638
11315
  property({ default: 0 })
11639
11316
  ], Ruler.prototype, "offsetX", 2);
11640
- __decorateClass$4([
11317
+ __decorateClass$8([
11641
11318
  property({ default: 0 })
11642
11319
  ], Ruler.prototype, "offsetY", 2);
11643
- __decorateClass$4([
11320
+ __decorateClass$8([
11644
11321
  property({ default: 20 })
11645
11322
  ], Ruler.prototype, "thickness", 2);
11646
- __decorateClass$4([
11323
+ __decorateClass$8([
11647
11324
  property({ default: 3 })
11648
11325
  ], Ruler.prototype, "markHeight", 2);
11649
- __decorateClass$4([
11326
+ __decorateClass$8([
11650
11327
  property({ default: "#b2b6bc" })
11651
11328
  ], Ruler.prototype, "color", 2);
11652
- __decorateClass$4([
11329
+ __decorateClass$8([
11653
11330
  property({ default: "#f9f9fa" })
11654
11331
  ], Ruler.prototype, "markBackgroundColor", 2);
11655
- __decorateClass$4([
11332
+ __decorateClass$8([
11656
11333
  property({ default: "#b2b6bc" })
11657
11334
  ], Ruler.prototype, "markColor", 2);
11658
- __decorateClass$4([
11335
+ __decorateClass$8([
11659
11336
  property({ default: 300 })
11660
11337
  ], Ruler.prototype, "gap", 2);
11661
- __decorateClass$4([
11338
+ __decorateClass$8([
11662
11339
  property({ default: 1 })
11663
11340
  ], Ruler.prototype, "scale", 2);
11664
- Ruler = __decorateClass$4([
11341
+ Ruler = __decorateClass$8([
11665
11342
  customNode("Ruler")
11666
11343
  ], Ruler);
11667
11344
 
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;
11345
+ var __defProp$7 = Object.defineProperty;
11346
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11347
+ var __decorateClass$7 = (decorators, target, key, kind) => {
11348
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$7(target, key) : target;
11672
11349
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11673
11350
  if (decorator = decorators[i])
11674
11351
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11675
- if (kind && result) __defProp$3(target, key, result);
11352
+ if (kind && result) __defProp$7(target, key, result);
11676
11353
  return result;
11677
11354
  };
11678
11355
  let ScrollBar = class extends Range {
@@ -11714,21 +11391,21 @@ let ScrollBar = class extends Range {
11714
11391
  this.context.fill();
11715
11392
  }
11716
11393
  };
11717
- __decorateClass$3([
11394
+ __decorateClass$7([
11718
11395
  property({ default: "vertical" })
11719
11396
  ], ScrollBar.prototype, "direction", 2);
11720
- ScrollBar = __decorateClass$3([
11397
+ ScrollBar = __decorateClass$7([
11721
11398
  customNode("ScrollBar")
11722
11399
  ], ScrollBar);
11723
11400
 
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;
11401
+ var __defProp$6 = Object.defineProperty;
11402
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11403
+ var __decorateClass$6 = (decorators, target, key, kind) => {
11404
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$6(target, key) : target;
11728
11405
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11729
11406
  if (decorator = decorators[i])
11730
11407
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11731
- if (kind && result) __defProp$2(target, key, result);
11408
+ if (kind && result) __defProp$6(target, key, result);
11732
11409
  return result;
11733
11410
  };
11734
11411
  let XScrollBar = class extends ScrollBar {
@@ -11737,20 +11414,20 @@ let XScrollBar = class extends ScrollBar {
11737
11414
  this.setProperties(properties).append(children);
11738
11415
  }
11739
11416
  };
11740
- XScrollBar = __decorateClass$2([
11417
+ XScrollBar = __decorateClass$6([
11741
11418
  customNode("XScrollBar", {
11742
11419
  direction: "horizontal"
11743
11420
  })
11744
11421
  ], XScrollBar);
11745
11422
 
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;
11423
+ var __defProp$5 = Object.defineProperty;
11424
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11425
+ var __decorateClass$5 = (decorators, target, key, kind) => {
11426
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$5(target, key) : target;
11750
11427
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11751
11428
  if (decorator = decorators[i])
11752
11429
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11753
- if (kind && result) __defProp$1(target, key, result);
11430
+ if (kind && result) __defProp$5(target, key, result);
11754
11431
  return result;
11755
11432
  };
11756
11433
  let YScrollBar = class extends ScrollBar {
@@ -11759,20 +11436,20 @@ let YScrollBar = class extends ScrollBar {
11759
11436
  this.setProperties(properties).append(children);
11760
11437
  }
11761
11438
  };
11762
- YScrollBar = __decorateClass$1([
11439
+ YScrollBar = __decorateClass$5([
11763
11440
  customNode("YScrollBar", {
11764
11441
  direction: "vertical"
11765
11442
  })
11766
11443
  ], YScrollBar);
11767
11444
 
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;
11445
+ var __defProp$4 = Object.defineProperty;
11446
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11447
+ var __decorateClass$4 = (decorators, target, key, kind) => {
11448
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$4(target, key) : target;
11772
11449
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11773
11450
  if (decorator = decorators[i])
11774
11451
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11775
- if (kind && result) __defProp(target, key, result);
11452
+ if (kind && result) __defProp$4(target, key, result);
11776
11453
  return result;
11777
11454
  };
11778
11455
  let Scaler = class extends Node {
@@ -11829,22 +11506,376 @@ let Scaler = class extends Node {
11829
11506
  }
11830
11507
  }
11831
11508
  };
11832
- __decorateClass([
11509
+ __decorateClass$4([
11833
11510
  property({ default: 1 })
11834
11511
  ], Scaler.prototype, "value", 2);
11835
- __decorateClass([
11512
+ __decorateClass$4([
11836
11513
  property({ default: 0.05 })
11837
11514
  ], Scaler.prototype, "minValue", 2);
11838
- __decorateClass([
11515
+ __decorateClass$4([
11839
11516
  property({ default: 10 })
11840
11517
  ], Scaler.prototype, "maxValue", 2);
11841
- Scaler = __decorateClass([
11518
+ Scaler = __decorateClass$4([
11842
11519
  customNode("Scaler", {
11843
11520
  processMode: "disabled",
11844
11521
  renderMode: "disabled"
11845
11522
  })
11846
11523
  ], Scaler);
11847
11524
 
11525
+ var __defProp$3 = Object.defineProperty;
11526
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
11527
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11528
+ var __decorateClass$3 = (decorators, target, key, kind) => {
11529
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$3(target, key) : target;
11530
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11531
+ if (decorator = decorators[i])
11532
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11533
+ if (kind && result) __defProp$3(target, key, result);
11534
+ return result;
11535
+ };
11536
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, key + "" , value);
11537
+ let KawaseTransition = class extends Transition {
11538
+ blur = 10;
11539
+ quality = 10;
11540
+ apply(renderer, target) {
11541
+ const currentTimeProgress = this.currentTimeProgress;
11542
+ let sampler;
11543
+ let progress;
11544
+ if (currentTimeProgress < 0.5) {
11545
+ sampler = 0;
11546
+ progress = (0.5 - currentTimeProgress) / 0.5;
11547
+ } else {
11548
+ sampler = 1;
11549
+ progress = (currentTimeProgress - 0.5) / 0.5;
11550
+ }
11551
+ const blur = this.blur;
11552
+ const quality = this.quality;
11553
+ const width = target.width;
11554
+ const height = target.height;
11555
+ const drawCalls = [];
11556
+ const kernels = [blur];
11557
+ if (blur > 0) {
11558
+ let k = blur;
11559
+ const step = blur / quality;
11560
+ for (let i = 1; i < quality; i++) {
11561
+ k -= step;
11562
+ kernels.push(k);
11563
+ }
11564
+ }
11565
+ const uvX = 1 / width;
11566
+ const uvY = 1 / height;
11567
+ const uOffset = [];
11568
+ let offset;
11569
+ const last = quality - 1;
11570
+ for (let i = 0; i < last; i++) {
11571
+ offset = kernels[i] + 0.5;
11572
+ uOffset[0] = offset * uvX;
11573
+ uOffset[1] = offset * uvY;
11574
+ drawCalls.push({
11575
+ offset: uOffset
11576
+ });
11577
+ }
11578
+ offset = kernels[last] + 0.5;
11579
+ uOffset[0] = offset * uvX;
11580
+ uOffset[1] = offset * uvY;
11581
+ drawCalls.push({
11582
+ offset: uOffset
11583
+ });
11584
+ drawCalls.forEach((uniforms) => {
11585
+ QuadUvGeometry.draw(renderer, KawaseTransition.material, {
11586
+ sampler,
11587
+ progress,
11588
+ ...uniforms
11589
+ });
11590
+ });
11591
+ }
11592
+ };
11593
+ __publicField$3(KawaseTransition, "material", new Material({
11594
+ vert: `attribute vec2 position;
11595
+ attribute vec2 uv;
11596
+ varying vec2 vUv;
11597
+ void main() {
11598
+ gl_Position = vec4(position, 0.0, 1.0);
11599
+ vUv = uv;
11600
+ }`,
11601
+ frag: `precision highp float;
11602
+ varying vec2 vUv;
11603
+ uniform sampler2D sampler;
11604
+ uniform vec2 offset;
11605
+ uniform float progress;
11606
+
11607
+ void main(void) {
11608
+ vec2 offset1 = vec2(offset.x - progress * offset.x, offset.y - progress * offset.y);
11609
+ vec4 color = vec4(0.0);
11610
+ color += texture2D(sampler, vec2(vUv.x - offset1.x, vUv.y + offset1.y));
11611
+ color += texture2D(sampler, vec2(vUv.x + offset1.x, vUv.y + offset1.y));
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 *= 0.25;
11615
+ gl_FragColor = color;
11616
+ }`
11617
+ }));
11618
+ KawaseTransition = __decorateClass$3([
11619
+ customNode("KawaseTransition")
11620
+ ], KawaseTransition);
11621
+
11622
+ var __defProp$2 = Object.defineProperty;
11623
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
11624
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11625
+ var __decorateClass$2 = (decorators, target, key, kind) => {
11626
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$2(target, key) : target;
11627
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11628
+ if (decorator = decorators[i])
11629
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11630
+ if (kind && result) __defProp$2(target, key, result);
11631
+ return result;
11632
+ };
11633
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, key + "" , value);
11634
+ let LeftEraseTransition = class extends Transition {
11635
+ apply(renderer) {
11636
+ QuadUvGeometry.draw(renderer, LeftEraseTransition.material, {
11637
+ previous: 0,
11638
+ next: 1,
11639
+ progress: this.currentTimeProgress
11640
+ });
11641
+ }
11642
+ };
11643
+ __publicField$2(LeftEraseTransition, "material", new Material({
11644
+ vert: `attribute vec2 position;
11645
+ attribute vec2 uv;
11646
+ varying vec2 vUv;
11647
+ void main() {
11648
+ gl_Position = vec4(position, 0.0, 1.0);
11649
+ vUv = uv;
11650
+ }`,
11651
+ frag: `precision highp float;
11652
+ varying vec2 vUv;
11653
+ uniform float progress;
11654
+ uniform sampler2D previous;
11655
+ uniform sampler2D next;
11656
+
11657
+ float easeInOutQuint(float t) {
11658
+ return t < 0.5 ? 16.0*t*t*t*t*t : 1.0+16.0*(--t)*t*t*t*t;
11659
+ }
11660
+
11661
+ void main() {
11662
+ vec4 src1Color = texture2D(previous, vUv);
11663
+ vec4 src2Color = texture2D(next, vUv);
11664
+ float mProgress = 1.0 - progress;
11665
+ float mixPercent = 0.0;
11666
+ if (vUv.x <= mProgress) {
11667
+ mixPercent = 1.0;
11668
+ }
11669
+ gl_FragColor = mix(src2Color, src1Color, mixPercent);
11670
+ }`
11671
+ }));
11672
+ LeftEraseTransition = __decorateClass$2([
11673
+ customNode("LeftEraseTransition")
11674
+ ], LeftEraseTransition);
11675
+
11676
+ var __defProp$1 = Object.defineProperty;
11677
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
11678
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11679
+ var __decorateClass$1 = (decorators, target, key, kind) => {
11680
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc$1(target, key) : target;
11681
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11682
+ if (decorator = decorators[i])
11683
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11684
+ if (kind && result) __defProp$1(target, key, result);
11685
+ return result;
11686
+ };
11687
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
11688
+ let TiltShiftTransition = class extends Transition {
11689
+ blur = 100;
11690
+ gradientBlur = 600;
11691
+ apply(renderer, target) {
11692
+ const currentTimeProgress = this.currentTimeProgress;
11693
+ let sampler;
11694
+ let progress;
11695
+ if (currentTimeProgress < 0.5) {
11696
+ sampler = 0;
11697
+ progress = (0.5 - currentTimeProgress) / 0.5;
11698
+ } else {
11699
+ sampler = 1;
11700
+ progress = (currentTimeProgress - 0.5) / 0.5;
11701
+ }
11702
+ const width = target.width;
11703
+ const height = target.height;
11704
+ const start = [0, height / 2];
11705
+ const end = [600, height / 2];
11706
+ const texSize = [width, height];
11707
+ const dx = end[0] - start[0];
11708
+ const dy = end[1] - start[1];
11709
+ const d = Math.sqrt(dx * dx + dy * dy);
11710
+ QuadUvGeometry.draw(renderer, TiltShiftTransition.material, {
11711
+ sampler,
11712
+ progress,
11713
+ blur: this.blur,
11714
+ gradientBlur: this.gradientBlur,
11715
+ start,
11716
+ end,
11717
+ delta: [dx / d, dy / d],
11718
+ texSize
11719
+ });
11720
+ QuadUvGeometry.draw(renderer, TiltShiftTransition.material, {
11721
+ sampler,
11722
+ progress,
11723
+ blur: this.blur,
11724
+ gradientBlur: this.gradientBlur,
11725
+ start,
11726
+ end,
11727
+ delta: [-dy / d, dx / d],
11728
+ texSize
11729
+ });
11730
+ }
11731
+ };
11732
+ __publicField$1(TiltShiftTransition, "material", new Material({
11733
+ vert: `attribute vec2 position;
11734
+ attribute vec2 uv;
11735
+ varying vec2 vUv;
11736
+ void main() {
11737
+ gl_Position = vec4(position, 0.0, 1.0);
11738
+ vUv = uv;
11739
+ }`,
11740
+ frag: `precision highp float;
11741
+ varying vec2 vUv;
11742
+ uniform sampler2D sampler;
11743
+ uniform float blur;
11744
+ uniform float gradientBlur;
11745
+ uniform vec2 start;
11746
+ uniform vec2 end;
11747
+ uniform vec2 delta;
11748
+ uniform vec2 texSize;
11749
+ uniform float progress;
11750
+
11751
+ float random(vec3 scale, float seed) {
11752
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
11753
+ }
11754
+
11755
+ void main(void) {
11756
+ float blur1 = blur - progress * blur;
11757
+ float gradientBlur1 = progress * gradientBlur;
11758
+
11759
+ vec4 color = vec4(0.0);
11760
+ float total = 0.0;
11761
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
11762
+ vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));
11763
+ float radius = smoothstep(0.0, 1.0, abs(dot(vUv * texSize - start, normal)) / gradientBlur1) * blur1;
11764
+
11765
+ for (float t = -30.0; t <= 30.0; t++) {
11766
+ float percent = (t + offset - 0.5) / 30.0;
11767
+ float weight = 1.0 - abs(percent);
11768
+ vec4 sample1 = texture2D(sampler, vUv + delta / texSize * percent * radius);
11769
+ sample1.rgb *= sample1.a;
11770
+ color += sample1 * weight;
11771
+ total += weight;
11772
+ }
11773
+
11774
+ color /= total;
11775
+ color.rgb /= color.a + 0.00001;
11776
+
11777
+ gl_FragColor = color;
11778
+ }`
11779
+ }));
11780
+ TiltShiftTransition = __decorateClass$1([
11781
+ customNode("TiltShiftTransition")
11782
+ ], TiltShiftTransition);
11783
+
11784
+ var __defProp = Object.defineProperty;
11785
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11786
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11787
+ var __decorateClass = (decorators, target, key, kind) => {
11788
+ var result = kind > 1 ? undefined : kind ? __getOwnPropDesc(target, key) : target;
11789
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11790
+ if (decorator = decorators[i])
11791
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11792
+ if (kind && result) __defProp(target, key, result);
11793
+ return result;
11794
+ };
11795
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
11796
+ let TwistTransition = class extends Transition {
11797
+ radius;
11798
+ angle = 4;
11799
+ padding = 20;
11800
+ offset;
11801
+ apply(renderer, source) {
11802
+ const currentTimeProgress = this.currentTimeProgress;
11803
+ let sampler;
11804
+ let progress;
11805
+ if (currentTimeProgress < 0.5) {
11806
+ sampler = 0;
11807
+ progress = (0.5 - currentTimeProgress) / 0.5;
11808
+ } else {
11809
+ sampler = 1;
11810
+ progress = (currentTimeProgress - 0.5) / 0.5;
11811
+ }
11812
+ const width = source.width;
11813
+ const height = source.height;
11814
+ QuadUvGeometry.draw(renderer, TwistTransition.material, {
11815
+ sampler,
11816
+ progress,
11817
+ filterArea: [width, height, 0, 0],
11818
+ radius: this.radius ?? width,
11819
+ angle: this.angle,
11820
+ padding: this.padding,
11821
+ offset: this.offset ?? [width / 2, height / 2]
11822
+ });
11823
+ }
11824
+ };
11825
+ __publicField(TwistTransition, "material", new Material({
11826
+ vert: `attribute vec2 position;
11827
+ attribute vec2 uv;
11828
+ varying vec2 vUv;
11829
+ void main() {
11830
+ gl_Position = vec4(position, 0.0, 1.0);
11831
+ vUv = uv;
11832
+ }`,
11833
+ frag: `precision highp float;
11834
+ varying vec2 vUv;
11835
+ uniform sampler2D sampler;
11836
+ uniform float radius;
11837
+ uniform float angle;
11838
+ uniform vec2 offset;
11839
+ uniform vec4 filterArea;
11840
+ uniform float progress;
11841
+
11842
+ vec2 mapCoord(vec2 coord) {
11843
+ coord -= filterArea.zw;
11844
+ coord *= filterArea.xy;
11845
+ return coord;
11846
+ }
11847
+
11848
+ vec2 unmapCoord(vec2 coord) {
11849
+ coord -= filterArea.zw;
11850
+ coord /= filterArea.xy;
11851
+ return coord;
11852
+ }
11853
+
11854
+ vec2 twist(vec2 coord, float radius) {
11855
+ coord -= offset;
11856
+ float dist = length(coord);
11857
+ if (dist < radius) {
11858
+ float ratioDist = (radius - dist) / radius;
11859
+ float angleMod = ratioDist * ratioDist * angle;
11860
+ float s = sin(angleMod);
11861
+ float c = cos(angleMod);
11862
+ coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);
11863
+ }
11864
+ coord += offset;
11865
+ return coord;
11866
+ }
11867
+
11868
+ void main(void) {
11869
+ vec2 coord = mapCoord(vUv);
11870
+ coord = twist(coord, radius - (progress * radius));
11871
+ coord = unmapCoord(coord);
11872
+ gl_FragColor = texture2D(sampler, coord);
11873
+ }`
11874
+ }));
11875
+ TwistTransition = __decorateClass([
11876
+ customNode("TwistTransition")
11877
+ ], TwistTransition);
11878
+
11848
11879
  class GifLoader extends Loader {
11849
11880
  install(assets) {
11850
11881
  const handler = async (url) => {
@@ -12563,4 +12594,4 @@ async function render(options) {
12563
12594
  });
12564
12595
  }
12565
12596
 
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 };
12597
+ 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 };