We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Re: enable/disable background();
Page Index Toggle Pages: 1
Re: enable/disable background(); (Read 656 times)
Re: enable/disable background();
May 11th, 2010, 3:43pm
 
i am not sure what you are trying to do.
but it doesnt make sense to call background more than once, or enable/disable it more than once in draw unless you want to erase everything drawn before the call of background.

If you call background at the beginning of draw. all last frames are erased even if you "disable" it at the end of draw.

Could you give a better example of what you are trying to do?
Re: enable/disable background();
Reply #1 - May 11th, 2010, 4:27pm
 
yes, of course:

I am  trying to make an animation with text, and i have got a lot of problems here (<= nooby).


The idea is to run some text, and erase it sometimes and let it for a longer time.

After testing around i did find a good solution for now:

Code:

PFont afont;
float x=1;

void setup() {
 size(800, 600);
 afont = createFont("FreeMono", 18);
 background (204, 24, 122);
 
 
}




void draw() {
 frameRate(x);
 

 //background(204, 24, 122);
 
 if(x < 15) {
 //background(204, 24, 122);
 textFont(afont);
 fill(0);
 text("Wenn ich das schreibe, dann ist es falsch \nDenn es ist richtig.\n", random(-width, width), random(-height, height));
 print("1.IF ");
 println(x);
 
   
 }
 

 if(x > 15 && x < 40) {
 //background (204, 24, 122);
 textFont(afont);
 fill(255);
 text("D\ne\nn\nk\ne\n\ni\nc\nh\n\nW\ni\nr\nk\nl\ni\nc\nh\nk\ne\ni\nt\n?", random(-width, width), random(-height, height));
 print("2.IF ");
 println(x);
 }
 
 if(x > 100 && x < 120) {
 textFont(afont);
 fill(0);
 text("` ` ;;;;;;; .*•±VVè £îvë ƒø® °Ø�û®§ê£¥éš »—————————————————————————————————————————;:.,.", random(-width, width), random(-height, height));
 print("3.IF ");
 println(x);
 }
 
 if(x > 120 && x < 130) {
 textFont(afont);
 fill(255);
 text("` ` ;;;;;;; .*•±•±[']ûçh †håñ [']ø®ë »—————————` ;;;;;———————————————————` ;;;—————————————;:.,.", random(-width, width), random(-height, height));
 print("3.IF ");
 println(x);
 }
 
 if(x > 130 && x < 140) {
 textFont(afont);
 fill(0);
 text(".\n;\n;\n.\n»\n»\n»\n»\n»»\n»\n»\n»\n»\n»•\n±\np\nø\nVV\në\n®\n\nƒ\nå\n�\nî\n£\n\n®\né\n§\n†\nä\n®\n†\n°\n\n»\n»\n»\n»\n»»\n»»\n`\n;\n;\n;\n;\n'\n.::\n.\n.\n.\n»\n»\n»\n»\n»\n.\n.\n,.\n,\n.\n;.——;\n:.\n,.",
 
 
 random(-width, width), random(-height, height));
 print("3.IF ");
 println(x);
 }

 
 
 
 if(x > 69 && x < 70) {
 //background (random(255),random(255),random(255));
 background (204, 24, 122);
 textFont(afont);
 fill(#078BB9);
 text("D\ne\nn\nk\ne\n\ni\nc\nh\n\nW\ni\nr\nk\nl\ni\nc\nh\nk\ne\ni\nt\n?", random(-width, width), random(-height, height));
 print("3.IF ");
 println(x);
 }
 



 x=random(0,150);
 print("ADD ");
 println(x);
}


I want to go on with some more chaotic.structures to make the animation looks more "alive". I am experimenting  with the frameRate();
Maybe the background.question was not necessary.

Another question: How to let a text beeing displayed for a longer time?
f.e.: 5 seconds, or 8 sec.?


I will be very thankful for any help and ideas :]
Page Index Toggle Pages: 1