If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

textAlign(ALIGN, YALIGN)

Sets the current alignment for drawing text. The first parameter is used to set the display characteristics of the letters in relation to the values for the x and y parameters of the text() function.
The second parameter is used to vertically align the text. BASELINE is the default setting, if textAlign() is not used. The TOP and CENTER parameters are straightforward. The BOTTOM parameter offsets the line based on the current textDescent(). For multiple lines, the final line will be aligned to the bottom, with the previous lines appearing above it.
Parameters:
NameDescription
ALIGNHorizontal alignment, either LEFT, CENTER, or RIGHT
YALIGNVertical alignment, either TOP, BOTTOM, CENTER, or BASELINE

Want to join the conversation?

No posts yet.