logo       

Re: fade out surfaces: msg#00193

python.pygame

Subject: Re: fade out surfaces

On Fri, 2005-09-23 at 12:26 +1000, Luke Miller wrote:
> s.alpha -= 5 #or sometimes s.alpha += 5
> multiply_alpha(s.image, s.alpha)
> draw(s.image)

You are right about fading the alpha in. You'll need to keep a copy of
the original alpha and go back that each step you fade in. The integer
multiplication loses precision fast, so once you fade the alpha down, it
can't really come back up.

You are using the wrong type of arguments for multiple_alpha. It takes
an integer between 0 and 255. Think of this as multiplying between 0-1.
multiple_alpha(image, 128) will half the values in the per pixel alphas.
Passing 255 will have no effect, because it is like multiplying by 1.
Passing 0 will set all the alpha pixels to 0.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise