I have a button which changes it's color when hovered over, but i want to make this color transition seem smooth. How can i achieve this effect?
buttonLogin.setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e){
buttonLogin.setStyle("-fx-background-color: "
+ "rgba(1, 147, 255, 0.3);"
+ "\n-fx-border-color: "
+ "rgba(1, 147, 255, 0.5);");
}
});
buttonLogin.setOnMouseExited(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e){
buttonLogin.setStyle("-fx-background-color: "
+ "rgba(255, 255, 255, 0.5);"
+ "\n-fx-border-color: "
+ "rgba(255, 255, 255, 0.8);");
}
});
I tried using fadetransitions, animation but i found it hard to understand. Can someone please explain?