We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I have a question about p5.js and p5.dom.js .
I want to add a button in my p5.js sketch using p5.dom.js, and want that I place a button on vertical center with text. So I write a code as follows.
textAlign(CENTER, CENTER);
text(“HELLO!", width/2, height/2);
var button = createButton(“<-");
button.position(width/4, height/2);
But the button and text have different base line, so I don’t get expected result. What should I do for vertical centering button and text?
Answers
http://CodePen.io/GoSubRoutine/pen/KNbwLW/right?editors=101
Thank you for your advice!
I write a code as follow, but I don’t get result yet.
Button and text have different base line in this code, so I put them vertical center.
Please your help!
I solve this problem as follow, thank you!