Variable Canvas

Canvas: {
    create(width?, height?): HTMLCanvasElement;
} = ...

Type declaration

  • create:function
    • Creates a canvas element.

      For example, ```ts var main = jq("#main"); main.append(canvas); var canvas = zk.canvas.Canvas.create(main.clientWidth, main.clientHeight); var ctx = canvas.getContext("2d"); ctx.fillStyle = "rgb(200,0,0)"; ctx.fillRect (10, 10, 55, 50);

      ctx.fillStyle = "rgba(0, 0, 200, 0.5)"; ctx.fillRect (30, 30, 255, 50); ```

      Parameters

      • Optional width: number

        the width. Ignored if not specified. Notice that it accepts only integer (unlike other DOM element)

      • Optional height: number

        the height. Ignored if not specified. Notice that it accepts only integer (unlike other DOM element)

      Returns HTMLCanvasElement

Since

5.0.2