We are about to switch to a new forum software. Until then we have removed the registration on this forum.
the text won't show when the background image is added. what am i doing wrong?
String canvasMsg = "CACTUS";
PFont font;
PImage bg;
int y;
void setup() {
size(640, 360);
bg = loadImage("cactus.JPG");
fill(153, 0, 153);
font = loadFont("ACaslonPro-Semibolditalic-48.vlw");
textFont(font);
textSize(100);
textAlign(CENTER);
text(canvasMsg, width / 2 - 10, height + 2);
}
void draw() {
background(bg);
}
Answers
Move 22 to 27.
Check draw() in the reference.
Kf
The sertup method is used to initialise your sketch variables, load images etc and is only done once when the sketch starts. The draw method is responsible for rendering a single frame and is executed about 60 times a second.
So line 18 should be placed between lines 22 and 23 so that the text appears in each frame.
Everyone wants their answer ASAP and think their discussion is important aso please do not puts ASAP in the title or use all uppercase in the title.
I have corrected it. :)
( bg = loadImage("cactus.JPG") ).resize(width, height);