|
Author |
Topic: appearing text (Read 581 times) |
|
hallo
|
appearing text
« on: Jan 27th, 2005, 9:47pm » |
|
Hi, there I would like to have a code that when the square hit the right side of the sketch, text should appear. But in the code below, text only appear for a brief while. Can you guys help me? float sex = 0; void setup() { size(200, 200); noStroke(); } void loop() { background(#FFFFFF); fill(#CC6600); rect(sex = sex+1, 10, 10, 10); if(sex == 200) { fill(#CC6600); BFont f = loadFont("Bodoni-Italic.vlw.gz"); textFont(f, 50); text("this is it!", 14, 60); } }//end loop
|
|
|
|
Ricard
|
Re: appearing text
« Reply #1 on: Jan 27th, 2005, 9:55pm » |
|
The text only appears for a brief while, because the sex==200 only happens for one frame, the next frame it will be 201, so when you repaint the background, the text will disappear. Try this: Code: float sex = 0; void setup() { size(200, 200); noStroke(); } void loop() { background(#FFFFFF); fill(#CC6600); rect(sex = sex+1, 10, 10, 10); if(sex >= 200) { fill(#CC6600); BFont f = loadFont("Bodoni-Italic.vlw.gz"); textFont(f, 50); text("this is it!", 14, 60); } }//end loop |
|
|
|
|
|
hallo
|
Re: appearing text
« Reply #2 on: Jan 27th, 2005, 10:38pm » |
|
Thank you Ricard! It was very helpful....
|
|
|
|
|