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 › help in colors and aplha
Page Index Toggle Pages: 1
help in colors and aplha (Read 462 times)
help in colors and aplha
Aug 18th, 2006, 4:54pm
 
with this code
Code:

void setup() {
size(200, 200);
noStroke();
background(255);
framerate(60);
}

void draw() {
fill(0, 1);
rect(0, 0, width, height);
}


I've an effect that fade the background color from withe to black.

I don't understand why if i change the fill color with
Code:

fill(150, 1);


the background doesn't change
Re: help in colors and aplha
Reply #1 - Aug 18th, 2006, 6:58pm
 
It'll work with fill(150, 2); and likewise it works with anything up to (127, 1).

My guess is that something to do with the way it calculates the new color from the alpha overlay results in a value that gets rounded off somehow.

I'm sure someone senior could explain this better. For now I'd hack around it for the time being if I were you.
Re: help in colors and aplha
Reply #2 - Aug 18th, 2006, 7:27pm
 
st33d wrote on Aug 18th, 2006, 6:58pm:
It'll work with fill(150, 2); and likewise it works with anything up to (127, 1).

My guess is that something to do with the way it calculates the new color from the alpha overlay results in a value that gets rounded off somehow.

I'm sure someone senior could explain this better. For now I'd hack around it for the time being if I were you.


true,
and what is the max alpha value 100

i've tried this code and i get 2 different color, again why
Code:

void setup() {
size(200, 200);
noStroke();
background(255);
framerate(60);
}

void draw() {
fill(150, 5);
rect(0, 0, width, height/2);

fill(150, 2);
rect( 0, height/2, width, height/2);
}

Page Index Toggle Pages: 1