public void fadeForegroundIconColorFromOpaqueToTransparent ( final int cycleCount ) { stopForegroundIconColorFadeAnimation ( ) ; foregroundColorFadeAnimation = Animations . createFadeTransition ( foregroundIcon , JFXConstants . TRANSPARENCY_NONE , JFXConstants . TRANSPARENCY_FULLY , cycleCount , JFXConstants . ANIMATION_DURATION_FADE_SLOW ) ; foregroundColorFadeAnimation . setOnFinished ( event -> foregroundIcon . setOpacity ( JFXConstants . TRANSPARENCY_FULLY ) ) ; foregroundColorFadeAnimation . play ( ) ; }
Apply and play a FadeTransition on the icon in the foregroundIcon . This Transition modifies the opacity of the foregroundIcon from opaque to fully transparent .