Implementing the animated 3D image selector
The main UI element of our puzzle game is the animated 3D image selector. In this recipe, we show you how to render the animated carousel-like selector and interact with the user.
Getting ready
Before proceeding with this recipe, you may need to go back to Chapter 7, Cross-platform UI and Input System, and read how the Canvas
class works. A bit of mathematics will be required to understand better how the code in this recipe works.
How to do it...
The idea behind the rendering is quite simple. We let the individual quads move in a way that their corners slide along four guiding curves. The following figure shows the same quad in a series of positions:
The four curves show the paths of the quad's corners.
We start with the helper
Curve
class, which implements the linear interpolation on the set of control points. A curve is represented in a parametric form.A parametric equation of a curve is a representation of this curve through equations expressing the...