Skip to content

Target

Description

The Target object is the rendering destination for a Renderer.

It contains the GPU surface texture attached to a HTML Canvas or a platform-specific Window.

The constructor for a Target is private. You must create it with the init function in FragmentColor.

Example

import { FragmentColor } from "fragmentcolor";
let canvas = document.getElementById("canvas");
[renderer, target] = FragmentColor.init(canvas);

Methods

  • constructor( [platform-specific surface reference] )

    The constructor for Target is private. You must create it with the init function in FragmentColor.

  • size() -> [width, height]

    Returns the size of the target in pixels.

  • resize(width: number, height: number)

    Resizes the target to the given width and height in pixels. This method is useful for resizing the Target when the canvas is resized.