-
Notifications
You must be signed in to change notification settings - Fork 23
1. The Basics
If you are just getting started with ZestKit have a look at the included demo scenes. They demonstrate all the most commonly used tweens. The sections below will pinpoint the most common tweens and show how to customize the tweens to fit your needs.
Several extension methods are available to cover the most common tweens. These are by far the easiest way to get started with ZestKit. They basically hide all the internals of the library and let you focus on just tweening. All of the configuration methods in ZestKit are chain-able letting you utilize the autocomplete feature of your IDE to guide you through the available options. Lets start with the most basic and common example: a position tween. The example will then add some configuration options one-by-one so that you can get a feel for how setting up a tween works.
// tweens a Transform from it's current position to Vector3.one over the course of 0.5 seconds
transform.positionTo( 0.5f, Vector3.one ).start();// this variant adds a 2 second delay to the position tween
transform.positionTo( 0.5f, Vector3.one )
.setDelay( 2f )
.start();// now we are customizing the ease type for the tween. The EaseType enum has several to choose from
transform.positionTo( 0.5f, Vector3.one )
.setDelay( 2f )
.setEaseType( EaseType.BounceIn )
.start();// we have added 2 ping-pong (back and forth) loops
transform.positionTo( 0.5f, Vector3.one )
.setDelay( 2f )
.setEaseType( EaseType.BounceIn )
.setLoops( LoopType.PingPong, 2 )
.start();// finally, we will override the position that we begin the tween via the setFrom method
transform.positionTo( 0.5f, Vector3.one )
.setDelay( 2f )
.setEaseType( EaseType.BounceIn )
.setLoops( LoopType.PingPong, 2 )
.setFrom( Vector3.zero )
.start();Hopefully, by this point you have a cursory understanding of how the chaining configuration system works. Just use the autocomplete suggestions to see whats available to you.