By user12608660 on Jun 05, 2010
One of the more useful UI controls for TV applications is a carousel. There is no standard carousel control in JavaFX 1.3, but it is not very difficult to build one. In this post I am showing how to create a simple 3D image carousel.
This carousel uses PerspectiveTransform rather than true 3D nodes so it can be run with regular desktop toolkit as well as the 3D accelerated prism toolkit. PerspectiveTransform is not very efficient though so it will be not be very fast on a TV device. But it should not be hard to implement this using true 3D transforms which will run faster.
In this example the carousel is rotated using left-right keys or mouse. Mouse can also be used to change the camera view point. Up and down arrows change the layout of the carousel.
Some trigonometric calculations are needed to lay out and rotate the nodes correctly. It is also necessary to sort them in z order. Using Sequences.sort is a very straightforward way to do this.
Download the source code: Main.fx.