Could you help with this? Create a JavaFX Application named Bounce. In this Application you will use the Ball.java class to draw a red ball in the middle of a 500×500 window. The ball’s radius must be 20 pixels. Every 25 milliseconds move the ball by 10 pixels horizontally and 5 pixels vertically. Initially move it 10 pixels horizontally to the right, but as soon as your ball touches the right edge of the window, change its direction to go 10 pixels to the left. Then when it hits the left side, change it back to the right, and so on through an infinite loop. Also, initially move your ball 5 pixels vertically down, but after your ball touches the bottom edge of the window, change its direction to go 5 pixels up instead of down, until it hits the top, and then change its direction again, and so on through the same infinite loop that controls the horizontal direction. Furthermore, whenever your Ball hits any side, change its color to a random set of RGB values that are from 0.3 to 0.7 in the JavaFX Color class.
I attached what I have so far
I think all I am missing is a couple of for statements in my EventHandler to get the ball to bounce and to change colors when it bounces, but for the life of me can’t think of the logic behind it