angry-pixel 2.0.12 → 2.0.14

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/lib/index.d.ts CHANGED
@@ -1428,9 +1428,15 @@ type AnimationSlice = {
1428
1428
  * @category Components
1429
1429
  */
1430
1430
  interface AudioPlayerOptions {
1431
+ /** The action to perform with the audio source. */
1431
1432
  action: AudioPlayerAction;
1433
+ /** The audio source to play. */
1432
1434
  audioSource: HTMLAudioElement;
1435
+ /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
1436
+ fixedToTimeScale: boolean;
1437
+ /** TRUE If the audio source should loop. */
1433
1438
  loop: boolean;
1439
+ /** The volume of the audio source. */
1434
1440
  volume: number;
1435
1441
  }
1436
1442
  /**
@@ -1438,14 +1444,34 @@ interface AudioPlayerOptions {
1438
1444
  * @category Components
1439
1445
  */
1440
1446
  declare class AudioPlayer {
1447
+ /** The action to perform with the audio source. */
1441
1448
  action: AudioPlayerAction;
1449
+ /** The audio source to play. */
1442
1450
  audioSource: HTMLAudioElement;
1451
+ /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
1452
+ fixedToTimeScale: boolean;
1453
+ /** TRUE If the audio source should loop. */
1443
1454
  loop: boolean;
1455
+ /** READONLY, TRUE If the audio source is playing. */
1444
1456
  playing: boolean;
1457
+ /** The volume of the audio source. */
1445
1458
  volume: number;
1446
1459
  /** @internal */
1447
- _currentAudio: string;
1460
+ _currentAudioSrc: string;
1461
+ _playPromisePendind: boolean;
1448
1462
  constructor(options?: Partial<AudioPlayerOptions>);
1463
+ /**
1464
+ * Play the audio source.
1465
+ */
1466
+ play(audioSource?: HTMLAudioElement): void;
1467
+ /**
1468
+ * Pause the audio source.
1469
+ */
1470
+ pause(): void;
1471
+ /**
1472
+ * Stop the audio source.
1473
+ */
1474
+ stop(): void;
1449
1475
  }
1450
1476
  /**
1451
1477
  * @public
@@ -2149,7 +2175,8 @@ interface RenderData {
2149
2175
  */
2150
2176
  declare enum MaskShape {
2151
2177
  Rectangle = 0,
2152
- Circumference = 1
2178
+ Circumference = 1,
2179
+ Polygon = 2
2153
2180
  }
2154
2181
  interface MaskRenderData extends RenderData {
2155
2182
  color: string;
@@ -2157,6 +2184,7 @@ interface MaskRenderData extends RenderData {
2157
2184
  width: number;
2158
2185
  height: number;
2159
2186
  radius: number;
2187
+ vertices: Vector2[];
2160
2188
  rotation: number;
2161
2189
  opacity: number;
2162
2190
  }
@@ -2377,13 +2405,14 @@ interface MaskRendererOptions {
2377
2405
  width: number;
2378
2406
  height: number;
2379
2407
  radius: number;
2408
+ vertexModel: Vector2[];
2380
2409
  offset: Vector2;
2381
2410
  rotation: number;
2382
2411
  opacity: number;
2383
2412
  layer: string;
2384
2413
  }
2385
2414
  /**
2386
- * Renders a filled shape (rectangle or circumference)
2415
+ * Renders a filled shape (rectangle, circumference or polygon)
2387
2416
  * @public
2388
2417
  * @category Components
2389
2418
  * @example
@@ -2406,16 +2435,27 @@ interface MaskRendererOptions {
2406
2435
  * maskRenderer.opacity = 1;
2407
2436
  * maskRenderer.layer = "Default";
2408
2437
  * ```
2438
+ * @example
2439
+ * ```js
2440
+ * maskRenderer.shape = MaskShape.Polygon;
2441
+ * maskRenderer.vertexModel = [new Vector2(0, 0), new Vector2(32, 0), new Vector2(32, 32), new Vector2(0, 32)];
2442
+ * maskRenderer.color = "#000000";
2443
+ * maskRenderer.offset = new Vector2(0, 0);
2444
+ * maskRenderer.opacity = 1;
2445
+ * maskRenderer.layer = "Default";
2446
+ * ```
2409
2447
  */
2410
2448
  declare class MaskRenderer {
2411
- /** Mask shape: Rectangle or Circumference */
2449
+ /** Mask shape: Rectangle, Circumference or Polygon */
2412
2450
  shape: MaskShape;
2413
- /** Mask width in pixels */
2451
+ /** Mask width in pixels (only for rectangle) */
2414
2452
  width: number;
2415
- /** Mask height in pixels */
2453
+ /** Mask height in pixels (only for rectangle) */
2416
2454
  height: number;
2417
2455
  /** Mask radius in pixels (only for circumference) */
2418
2456
  radius: number;
2457
+ /** Polygon vertices (only for polygon) */
2458
+ vertexModel: Vector2[];
2419
2459
  /** The color of the mask */
2420
2460
  color: string;
2421
2461
  /** X-axis and Y-axis offset */
@@ -2709,23 +2749,23 @@ type Chunk = {
2709
2749
  * @category Components
2710
2750
  */
2711
2751
  interface VideoRendererOptions {
2712
- video: HTMLVideoElement;
2713
- width: number;
2714
- height: number;
2715
- offset: Vector2;
2716
- rotation: number;
2752
+ action: "play" | "pause" | "stop";
2753
+ fixedToTimeScale: boolean;
2717
2754
  flipHorizontally: boolean;
2718
2755
  flipVertically: boolean;
2719
- opacity: number;
2756
+ height: number;
2757
+ layer: string;
2758
+ loop: boolean;
2720
2759
  maskColor: string;
2721
2760
  maskColorMix: number;
2722
- tintColor: string;
2723
- layer: string;
2761
+ offset: Vector2;
2762
+ opacity: number;
2763
+ rotation: number;
2724
2764
  slice: Slice;
2725
- loop: boolean;
2765
+ tintColor: string;
2766
+ video: HTMLVideoElement;
2726
2767
  volume: number;
2727
- play: boolean;
2728
- pause: boolean;
2768
+ width: number;
2729
2769
  }
2730
2770
  /**
2731
2771
  * The VideoRenderer component plays and renders a video element,
@@ -2749,48 +2789,63 @@ interface VideoRendererOptions {
2749
2789
  * videoRenderer.slice = {x: 0, y:0, width: 1920, height: 1080};
2750
2790
  * videoRenderer.volume = 1;
2751
2791
  * videoRenderer.loop = false;
2752
- * videoRenderer.play = true;
2753
- * videoRenderer.pause = false;
2792
+ * videoRenderer.play();
2754
2793
  * ```
2755
2794
  */
2756
2795
  declare class VideoRenderer {
2757
- /**The video element to render */
2758
- video: HTMLVideoElement;
2759
- /** Overwrite the original video width */
2760
- width: number;
2761
- /** Overwrite the original video height */
2762
- height: number;
2763
- /** X-axis and Y-axis offset */
2764
- offset: Vector2;
2765
- /** Video rotation (degrees or radians) */
2766
- rotation: number;
2796
+ /** The action to perform with the video */
2797
+ action: "play" | "pause" | "stop";
2798
+ /** TRUE If the playback rate is fixed to the TimeManager time scale, default FALSE */
2799
+ fixedToTimeScale: boolean;
2767
2800
  /** Flip the video horizontally */
2768
2801
  flipHorizontally: boolean;
2769
2802
  /** Flip the video vertically */
2770
2803
  flipVertically: boolean;
2771
- /** Change the opacity between 1 and 0 */
2772
- opacity: number;
2804
+ /** Overwrite the original video height */
2805
+ height: number;
2806
+ /** The render layer */
2807
+ layer: string;
2808
+ /** TRUE to play the video in loop */
2809
+ loop: boolean;
2773
2810
  /** Define a mask color for the video */
2774
2811
  maskColor: string;
2775
2812
  /** Define the opacity of the mask color between 1 and 0 */
2776
2813
  maskColorMix: number;
2777
- /** Define a color for tinting the video */
2778
- tintColor: string;
2779
- /** The render layer */
2780
- layer: string;
2814
+ /** X-axis and Y-axis offset */
2815
+ offset: Vector2;
2816
+ /** Change the opacity between 1 and 0 */
2817
+ opacity: number;
2818
+ /** READONLY, TRUE if the video is playing */
2819
+ playing: boolean;
2820
+ /** Video rotation (degrees or radians) */
2821
+ rotation: number;
2781
2822
  /** Cut the video based on straight coordinates starting from the top left downward */
2782
2823
  slice?: Slice;
2783
- /** TRUE to play the video in loop */
2784
- loop: boolean;
2824
+ /** Define a color for tinting the video */
2825
+ tintColor: string;
2826
+ /**The video element to render */
2827
+ video: HTMLVideoElement;
2785
2828
  /** The volume of the video (between 1 and 0) */
2786
2829
  volume: number;
2787
- /** TRUE to play the video. If the video stops playing it becomes FALSE */
2788
- play: boolean;
2789
- /** TRUE to pause the video */
2790
- pause: boolean;
2830
+ /** Overwrite the original video width */
2831
+ width: number;
2832
+ _currentVideoSrc: string;
2833
+ _playPromisePendind: boolean;
2791
2834
  /** @internal */
2792
2835
  _renderData: VideoRenderData;
2793
2836
  constructor(options?: Partial<VideoRendererOptions>);
2837
+ /**
2838
+ * Play the video source.
2839
+ */
2840
+ play(videoSource?: HTMLVideoElement): void;
2841
+ /**
2842
+ * Pause the video source.
2843
+ */
2844
+ pause(): void;
2845
+ /**
2846
+ * Stop the video source.
2847
+ */
2848
+ stop(): void;
2794
2849
  }
2795
2850
 
2796
2851
  /**