Description

The fillText() method draws filled text on the canvas. The default color of the text is black.

Usage

Parameters

  • text {String}

    Text

  • x {Integer|String} optional

    (optional) Position X. If middle value, he text is placed in the middle of the element. It is necessary that the element is a size (width and height)

  • y {Integer} optional

    (optional) Position Y

Returns

CanvasEngine.Element

Example

In ready() method :

var el = this.createElement(100, 100);
el.font = "20px Arial";
el.fillText("My Text", "middle");
stage.append(el);

Discussion