Book Image

Learning NGUI for Unity

By : Charles Bernardoff (EURO)
Book Image

Learning NGUI for Unity

By: Charles Bernardoff (EURO)

Overview of this book

Table of Contents (17 chapters)
Learning NGUI for Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Menu appearance


It would be good to have our main menu window appear smoothly with a gradual scale increase. We'll do that using tweens.

The tweening concept

Tweening is the process of automatically generating intermediate values between two start and end values. You define the start and end values manually, and let the computer do the calculations to go from start to end, applying smoothing methods if requested.

Considering this concept, you can tween scale, position, rotation, and more. Indeed, if we needed to tween our window's scale from 0 to 1, we could simply tween the three X, Y, and Z scale values, and the window will gradually become bigger until it reaches its final size.

With NGUI, we have a component to do just that—the Tween Scale component.

Tween Scale

The Tween Scale component can be added to any GameObject to configure a scale tween from one value to another within a given duration. Let's see how it works.

Usage

Add the Tween Scale component to our main menu window:

  1. In Hierarchy...