text()

Displays text on canvas

Description

The text function draws a text on the canvas at the specified location. The object drawn on the canvas is a shape that has an internal region which can be colored with fill() and a boundary which can be colored by stroke().

text(sentence, x, y)
Input
Description

sentence

The content of the text. It can be any type of data, though we usually use strings.

x

the x-coordinate of the text box

y

the y-coordinate of the text box

Examples

    text("Hello, Strive!", 15, 25)
    text('This\'s been\n running for' , 15, 50)
    
    fill(255)
    text(f'{round(millis()/1000)} seconds', 15, 85)
circle-info

Find these documents helpful? Let the people who made them help your child learn to code at Strivematharrow-up-right!

We'd love to hear your Feedback/Comments herearrow-up-right.

Last updated