Fade In on Scroll Down, Fade Out on Scroll Up – based on element position in window

The reason your attempt wasn’t working, is because the two animations (fade-in and fade-out) were working against each other. Right before an object became visible, it was still invisible and so the animation for fading-out would run. Then, the fraction of a second later when that same object had become visible, the fade-in animation would … Read more

How do I fade an image in swing?

You can do the threading yourself, but it might be easier to use the Trident library to handle it. If you create a setter on your class called (say, setOpacity), you can ask trident to interpolate the “opacity” field from 1.0 to 0.0 over a specific period of time (here’s some of the docs on … Read more