Creating an extendable and rotating element with a final fade effect
In this recipe, you will learn how to create an extendable and rotating UI element with a final fade effect. This recipe is an extension of the previous one. In fact, we will add some controllers to the rotation. By extending the script that we made in the previous recipe, we can create more complex decorating elements for our UIs.
How to do it...
To begin, we need to create a UI element. In this example, we will use a square, but you can also use any other image, such as a decorative star or a circle. To do this, create the UI element, right-click on the Hierarchy panel, and then navigate to UI | Image. Finally, rename it Extendable and Rotating Element. Of course, it is also possible to resize it, change its source image, and place it wherever we wish.
Now, we need to create a script that extends and rotates our image on the screen, and gradually decreases the alpha channel of the color. By doing this, we ensure that the...