java - Using a timer to fade an image in and out -


In this way I am making this type of identity for a game and I have to create some small image logos and then out But whatever I have tried to do, I have kept an infinite loop in the background, which will crash at some point, it does not execute properly, or it fades and fades out Happen. Also, getAlpha () are using the set alpha () methods, which is greatly appreciated.

  timer. Scheduling (New Timer Task) {@Override Public Zero () ({(Opening 1.getAlpha ()} 1) {System.out.println (opening1.getAlpha ()); opening1.setAlpha (Float) ( Opening 1.getAlpha () + 0.00005));} {{timer.purge ()}}}}}}}, 1 * 1100); }  

You have tried to use java.lang.math class. I would recommend to use the "exp (double A)" method with System.currentTimeMillis () or System.nanoTime () you can call it inside a loop, and this "Euler's number E is double value Is brought into power. "

Exponential function gradually increases gradually, so I will use a multi of some constants to manipulate how fast the function increases. Obviously, you can get the value from this function and use it in your setAlpha () method.

I use Math class all the time when my game programming does another assistant is a sin () and cos () methods.

To refine this approach I will set an initial time before the loop, 0 where, then add current system time for each walk through your loop.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -