• Advertisement
Sign in to follow this  

Fading Objects In And Out

This topic is 1982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i've been attempting to make a game and was wondering how to make objects (such as rectangles) in and out from a JPanel. Can anybody help me out?

Thanks in advance,
~Ben Edited by Bench3

Share this post


Link to post
Share on other sites
Advertisement
Change the [url="http://docs.oracle.com/javase/6/docs/api/java/awt/Color.html#Color(float,%20float,%20float,%20float)"]color[/url] you use. Start out with a color that is mostly (or all) transparent (low alpha) then raise the alpha over time to 255 (fully opaque).

Edit: Thanks BeerNutts. Had it backwards. Edited by David.M

Share this post


Link to post
Share on other sites
[quote name='David.M' timestamp='1345075186' post='4969999']
Change the [url="http://docs.oracle.com/javase/6/docs/api/java/awt/Color.html#Color(float,%20float,%20float,%20float)"]color[/url] you use. Start out with a color that is mostly (or all) transparent (high alpha) then lower the alpha over time to 0 (fully opaque).
[/quote]

You said that backwards. High alpha is opaque (255 is fully opaque), and low alpha is transparent (0 is invisible).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement