whiskeyii 
		
		YaBB Newbies
		 
		Offline 
		
		
		Posts: 9
		
		
		
		
 
	 
	
		
			
				"Highlighting" Font trouble  
				 Mar 19th , 2010, 6:21am 
			 
			
				
	  
			 
		
		
			Hi guys. I've almost got my assignment wrapped up, but I've hit a speed bump. In the code below (it's a doozy because, silly me, I created my own function instead of a class or object), I want the words "Good Night!" to "highlight" (they actually expand in a different color than the original) in order, but from the sample code I got, the letters "highlight" randomly, and I can't figure out how to fix that. Any thoughts? Also, I wanted to include a series of three staggered, descending z's, like when someone's asleep in a cartoon. But I also wanted to highlight those as well (even though I don't even know how to stagger them). Help is appreciated!  Thanks!   //Poster (Hwk #9) //Displays a poster with animated lettering. //By Ashley Lau // 3/18/2010 int margin_left=150; int margin_top=100; int gap=50; String s="Good Night!"; PFont freesia; void setup(){   size(800,600);   smooth();   freesia=loadFont("FreesiaUPCBold-48.vlw");   textFont(freesia,64);   text("Good Night!"); } void draw(){   background(34,37,100);      //Draw font   int i; //Pick Character randomly <--CHANGE TO HIGHLIGHTING IN ORDER int bigChar=(int)random(s.length()); for(i=0;i<s.length();i++){   char letter =s.charAt(i);   //Basic location   int xloc=margin_left+i*gap;   if(i==bigChar){     pushMatrix();     translate(xloc,margin_top);     scale(1.7);     //Draw letter to screen     fill(206,197,6);     text(letter,0,0);     popMatrix();   }     else{       fill(0); //<--Supposed to fill(34,37,100), but (0) for visibility       text(letter,xloc,margin_top);     } }   //Draw "snowflake" wallpaper   fill(255);   noStroke();   smooth();   for(int y=-50; y<=600; y+=45){     for (int x=-50; x<=800; x+=20){       ellipse(x+random(20,60), y+random(20,60),5,5);       frameRate(3.5);     }   } //Draw snow drawSnow(); //Draw polar bear drawPolarBear(); } void drawSnow(){   strokeWeight(2.5);   stroke(210,211,245);   fill(229,230,252);   arc(width/2,600,1200,425,PI, 2*PI); } //Polar bear function void drawPolarBear(){      //draw tail   pushMatrix();   translate(width/2, height/2);   strokeWeight(4);   stroke(210,211,222);   fill(255);   ellipse(-18,40,35,32);   popMatrix();      //draw body   pushMatrix();   translate(width/2,height/2);   rotate(PI/20);   ellipse(55,85,160,120);   popMatrix();      //draw "behind" paw   pushMatrix();   translate(width/2,height/2);   rotate(-PI/10);   ellipse(100,185,40,70);   popMatrix();     //Draw "back" ear   pushMatrix();   translate(width/2,height/2);   ellipse(170,100,40,35);   popMatrix();       //draw "front" ear   pushMatrix();   translate(width/2,height/2);   rotate(-PI/20);   ellipse(95,75,40,35);   popMatrix();      //draw head   pushMatrix();   translate(width/2,height/2);   rotate(PI/8);   ellipse(150,60,110,95);   popMatrix();      //draw face   pushMatrix();   translate(width/2,height/2);   stroke(0);   strokeWeight(2);   fill(0);   line(100,100,115,108);   line(140,120,152,127.5);   //draw nose   triangle(115,120,122,130,130,128);   popMatrix();      //draw "front" paw   pushMatrix();   translate(width/2,height/2);   strokeWeight(4);   stroke(210,211,222);   fill(255);   rotate(PI/8);   ellipse(150,113,90,43);   popMatrix();      //draw "front" back leg   pushMatrix();   translate(width/2,height/2);   rotate(PI/3);   ellipse(105,75,100,65);   popMatrix(); }