Fade In - Fade Out Efect?

Started by
7 comments, last by Thygrrr 17 years, 7 months ago
For cellphone, j2me, how can i make fade in and fade out effects? thanks :)
Advertisement
You'll need to create a byte array of rgba values using Image.getRGB(), fade the RGB values, then create a new image from the byte array using Image.createRGBImage().

Google "midp fading" for examples.

That's midp2 only.
thanks mate :)
Smart question: Does fade in-out works with sprites?

Thanks again
you need to do the same with the sprtie image, and manually reduce the RGB values in a loop each frame till they are gray...then use the new value as the sprite, you can only set a transparent in midp2 so its a limited use.
Its also a considerable processing task and not all handsets will have the power to handle it.

For sprites fading in and out during gameplay you might want to just use a bunch of frames that slowly fades out if memory permits. It will be a lot faster.

shmoove
how can i do that shmoove? :) thanks
Like any other sprite animation. A bunch of frames that slowly fade out. This will mean that you need a lot more graphics, so you'll get a bigger jar and more heap usage, so it's a trade-off in that sense (which is why I said "if memory permits").

shmoove
Depending on what you need to fade, you can simply paint a semitransparent image on top of the whole screen repeatedl and make it fade to that image.

This topic is closed to new replies.

Advertisement