modern-canvas 0.2.3 → 0.2.4

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