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.
IndexDiscussionExhibition › My first Sketch !
Page Index Toggle Pages: 1
My first Sketch ! (Read 717 times)
My first Sketch !
May 23rd, 2008, 2:23pm
 
I im new to processing and its  great !

I did my first Sketch , its just three shapes a background , and a line that comes from the center following the mouse.

...


But i have some problems.


Why does the stroke of the rect and ellipse wich is 20 , like the line because there is an "strokeWeight (20);" gets overlaped by its own fill color,white ?

I want the ellipses to be on top of everything so i can see the whole circle, now i only see half.

Here's the code




// setup , configuracion
void setup (){
 background (234,10,98);
 size(300,300);
 smooth();
 frameRate (30 );
 cursor(CROSS);
}
void draw(){



   
 if(mouseX > width/2){
   strokeWeight(20);
   stroke(#27FF00 ,20);//linea verde
 }
 else
 {
   strokeWeight(20);
   stroke(#E4FF00,20);// linea amarillo
 }
 if(mouseX !=0 && mouseY != 0){
   line ( width/2,height/2,mouseX,mouseY);
 }
    fill(255);
   
 rect(width/4,height/4,width/2,height/2);
   ellipse(width/2,230,100,100);
   ellipse(width/2,height/5,50,50);

}







Re: My first Sketch !
Reply #1 - May 23rd, 2008, 2:55pm
 
hi, that's either because you are using transparent colors (try replacing stroke(#27FF00,20) by stroke(#27FF00,255), or because you're not clearing the background before drawing things on screen (try calling background (234,10,98) at the beginning of the draw() method).
Re: My first Sketch !
Reply #2 - May 23rd, 2008, 7:17pm
 
antiplastik wrote on May 23rd, 2008, 2:55pm:
hi, that's either because you are using transparent colors (try replacing stroke(#27FF00,20) by stroke(#27FF00,255), or because you're not clearing the background before drawing things on screen (try calling background (234,10,98) at the beginning of the draw() method).


Thanx , if i change the stroke to a non transparent color , yes the strokes look ok , the thing is i want the line to have a 20% of alpha drawing , so it appears little by little.

So i want the line to be (#27FF00,20) , but the rect and the ellipse no.

If by calling background (234,10,98) at the beginning of the draw() method).

You mean to write likr this =

void draw(){
   background (234,10,98);

I did it , but then no stroke is nearly visible.

How do i  , make the rect and ellipse to have a solid color while the line has a 20% of alpha being drawn

Thanx
Re: My first Sketch !
Reply #3 - May 24th, 2008, 8:48pm
 
Ok, then, just make the stroke color opaque before drawing your rectangle and ellipses (at the end of your code) :

Code:
stroke(#27FF00, 255);  // 255 = opaque
rect(width/4,height/4,width/2,height/2);
ellipse(width/2,230,100,100);
ellipse(width/2,height/5,50,50);


and don't change anything else.
Page Index Toggle Pages: 1