This puzzler is mainly directed at the students of the free JavaFX with Passion! course, and it contains concepts that have been covered in the course so far, including animation. The first student in that course who submits a correct solution will be awarded a free token for the Pro JavaFX early access eBook. If you're not enrolled in that course, feel free to submit a solution to this puzzler as well, because I'll give a free eBook for the first correct solution from a non-JavaFX-with-Passion student as well.
Here are the requirements for this second puzzler:
- As shown in the screenshot above, the JavaFX program must have a Path that resembles a "figure 8" race track.
- A blue ellipse representing the race car will follow the track when the program begins, with each lap taking 10 seconds.
- The car will loop infinitely around the track, and will remain perpendicular to the center point of the circle around which it is currently traveling.
- When the user presses the mouse on the race car (ellipse), the car will pause.
- When the user presses the mouse on a paused race car, the car will resume moving from its current location.
To enter your solution, submit a comment to this blog post that contains the source code pasted into it. To validate that the code meets the requirements, I will compile and run it with JavaFX SDK 1.1.1. It must run without any code editing, and must meet the above requirements.
I will feature the two winners and their solutions in an upcoming blog post. Have fun with this one!