bio photo

Someone over at the nifty forums asked how to switch images from java. You can find the thread and my answer here.</a>

Well. So far so good but switching images can be a lot more exciting with nifty effects :)

So let's start with adding a new effect and attach it to the image with the onCustom effect:

<onCustom name="imageSize" startSize="1.7" endSize="1.0" length="150" />
This adds an "imageSize" effect that starts with a imagesize of 1.7 times the original size and resizes the image back to the original size over the time of 150 ms. The "onCustom" effect means, that we can trigger this effect from java.

So when it comes time to change the image to the rocket launcher, the plasma gun or the BFG9000 :D we can use the following java code to trigger the effect and change the image:

The first line changes the image and the second line triggers the onCustom effect.

I've updated the slick overlay example with a little nifty image switching in the right upper border of the screen. You can change the different images with pressing the keys "a", "b" and "c".

You can find it here:</a>

and you can find the updated example in svn or you can browse it online here:</a> (Java classes)</a> (Nifty XML for the Screen - overlay.xml)

Nifty! :D