Displaying Text • tim rodenbröker creative coding

Displaying Text

Courses / Typemachines / Displaying Text

To display text in Processing, there is the text()-function. This function takes at least three parameters:

  1. the text to be displayed
  2. the x-position (float)
  3. the y-position (float)

Basically, you can pass almost any variable type as the first parameter to the Text function. It then simply displays the value of the variable.

// Processing
String txt = "Hi!";
text(txt,width/2,height/2);
// p5.js
let txt = "Hi!";
text(txt,width/2,height/2);
// Processing
char c = "@";
text(c,width/2,height/2);
// p5.js
let c = "@";
text(c,width/2,height/2);
//Processing & P5.js
text("Hi!",width/2,height/2);
//Processing & P5.js
text(frameCount,width/2,height/2);

Language Comparison

Processingp5.js
text()text()
Published by Tim on Saturday March 28, 2020

Last modified on January 17th, 2023 at 11:44

  1. Chars and Strings
  2. Displaying Text
  3. Styling Text
  4. Preloading (p5.js)
  5. Asset-Management
  6. Utilizing a font
  7. Text-Frames
  8. Line-Breaks
  9. Line-Height
  10. String Methods
  11. String Concatenation
  12. Getting the Text-Width
  13. Example: charArt
  14. Example: Newsticker
  15. Example: 3D Typography
  16. Example: Circular Distribution
  17. Addon: Letter Spacing
  18. Wrapping Up