Options
All
  • Public
  • Public/Protected
  • All
Menu

Generates images composition based on different elements.

// example
const composition = new Composition(width, height, borderWidth);
composition.addElement(webcam, 0, 0, webcam.videoWidth, webcam.videoHeight, 1, false);
composition.get().then(blob => {
image.src = URL.createObjectURL(blob);
)};

Hierarchy

  • Composition

Index

Constructors

  • new Composition(width: number, height: number, borderWidth: number): Composition

Methods

  • addElement(element: any, x: number, y: number, width: number, height: number, scale: number, mirror: boolean): void
  • Adds an element to the composition.

    Parameters

    • element: any

      Element to add.

    • x: number

      Element X position.

    • y: number

      Element Y position.

    • width: number

      Element width.

    • height: number

      Element height.

    • scale: number

      Element scale.

    • mirror: boolean

      Value indicating whether to mirror the image.

      // example
      const composition = new Composition(width, height, borderWidth);
      composition.addElement(webcam, 0, 0, webcam.videoWidth, webcam.videoHeight, 1, false);
      composition.addElement(image, 0, 0, image.width, image.height, 1, false);

    Returns void

  • clear(): void
  • get(): Promise<Blob>
  • Gets the resulting composition.

    Returns Promise<Blob>

    A promise with a blob containing the composition.

    // example
    composition.get().then(blob => {
    image.src = URL.createObjectURL(blob);
    )};

Generated using TypeDoc