- Add 3 lines (for hour, minute, second) with different strokes and lengths for your group.
- Place one end of each line at the center of your circle and the other end of each line straight up at 12 oβclock.
- Create a timeline that runs a keyframe every second.
- In the key frame:
- Calculate the degree of rotation of the hands based on the current time .
- Rotate hands should receive the required amount.
- Set the cycle timeline indefinitely .
- Put your group in the scene and add the scene to the scene.
- Play your timeline.
I created an example application that implements the above principles.
Update
In response to criticism of the coding style used in the sample application, I created a refactored sample application that uses a more functional coding style.
In addition, the jfxtras project has an AnalogueClock control. Here is the gist of how to use the jfxtras clock.
source share