• Take a screenshot from the current scene and return a Texture. This can applied to a surface in 3D space.

    Parameters

    • opts: ScreenshotOptionsTexture

      Provide { type: "texture" } to get a texture instead of a data url.

    Returns null | Texture

    The texture of the screenshot. Returns null if the screenshot could not be taken.

  • Take a screenshot from the current scene.

    Parameters

    • opts: ScreenshotOptionsDataUrl

    Returns null | string

    The data url of the screenshot. Returns null if the screenshot could not be taken.

    const res = screenshot2({
    width: 1024,
    height: 1024,
    mimeType: "image/webp",
    transparent: true,
    })
    // use saveImage to download the image
    saveImage(res, "screenshot.webp");
  • Take a screenshot asynchronously from the current scene.

    Parameters

    • opts: ScreenshotOptionsBlob

      Set { type: "blob" } to get a blob instead of a data url.

    Returns Promise<null | Blob>

    A promise that resolves with the blob of the screenshot. Returns null if the screenshot could not be taken.

  • Take a screenshot from the current scene and return a Texture. This can applied to a surface in 3D space.

    Parameters

    • opts: ScreenshotOptionsShare

      Provide { type: "texture" } to get a texture instead of a data url.

    Returns Promise<ScreenshotOptionsShareReturnType>

    The texture of the screenshot. Returns null if the screenshot could not be taken.