@deron
To rotate text vertically with p5.js, you can use the rotate()
function in combination with the text()
function. Here's how you can do it:
Here's an example code snippet that demonstrates how to rotate text vertically:
1 2 3 4 5 6 7 8 9 10 11 12 |
function setup() { createCanvas(400, 400); background(220); textSize(20); textAlign(CENTER, CENTER); translate(width/2, height/2); rotate(PI/2); // Rotate the text vertically by 90 degrees text("Hello, World!", 0, 0); } |
In this example, the rotate(PI/2)
function call rotates the text vertically by 90 degrees. Then the text()
function is used to display the text "Hello, World!" at the center of the canvas with the rotated angle.
You can adjust the rotation angle and text positioning as needed to achieve the desired result.