Description

Draws the text given by the style. If an effect is assigned, consider integrating extension Timelines

Usage

Parameters

  • parent {CanvasEngine.Element}

    Element parent where the text will be displayed

  • x {Integer} optional

    (optional) Position X (0 by default)

  • y {Integer} optional

    (optional) Position Y (0 by default)

  • effect {Object} optional

    (optional) Effect to apply on line or text letters

    • line: {}
      • frames : Duration in frames before the line is displayed
      • onFinish : Call the function when the lines were displayed
      • onEffect : Call function when a line has been displayed. Two parameters:
        • text_line {String} The text line
        • el_line {CanvasEngine.Element} the corresponding element in line
    • _char: {}
      • frames : Duration in frames before the character is displayed
      • onFinish : Call the function when the characters were displayed
      • onEffect : Call function when a character has been displayed. Two parameters:
        • text_char {String} The text character
        • el_char {CanvasEngine.Element} the corresponding element in character

Returns

CanvasEngine.Text

Example

In ready method :

var text = RPGJS.Text.new(this, "Hello World");
    text.style({
        size: "18px",
        lineWidth: 300,
        color: "white"
    }).draw(content, 20, 20, {
        line: { // Animation
            frames: 20,
            onFinish: function() {
                console.log("Effect is finished");
            },
            onEffect: function(text_line, el_line) {
                console.log(text_line);
            }
        }
    });

Discussion