-
Notifications
You must be signed in to change notification settings - Fork 0
How To Use
The UBTweening System is for moment only usable through scripts.
Before doing anything, you need to get the UnBocal.Tweening namespace.
using UnBocal.Tweening;Each interpolation method is static and can be called from the UBTween class.
Here is an exemple of a translation from the current position to a target position :
// Interpolate The Transform Position From Current Position To The Target Position In 1 Second
UBTween.Position(transform, transform.position, Vector3.up, 1f);
// An Other Way Of Doing The Same Action
UBTween.Position(transform, Vector3.up, 1f);To control the behavior of an interpolation you can use the controls method at the end of the instruction such as :
To add a delay before the execution of the interpolation.
// Start Interpolate After delay seconds
UBTween.Position(transform, Vector3.up, 1f)
.SetDelay(1f);Note that for the moment, the start position will be the position of the transform at the moment where the method is called.
To ease the interpolation and give it a little style. :]
// Ease The Interpolation
UBTween.Position(transform, Vector3.up, 1f)
.SetEase(EaseType.InOutExpo);To ease the interpolation following a curve.
// Ease The Interpolation Based On A Curve
UBTween.Position(transform, Vector3.up, 1f)
.SetCurve(curve);To loop the interpolation.
// Every
UBTween.Position(transform, targetPosition, 1f)
.SetLoop()// Start Interpolate After delay seconds
UBTween.Position(transform, Vector3.up, 1f)
.SetDelay(1f)
.SetEase(EaseType.InOutExpo)You have three callbacks possible :
Will be called when the interpolation starts (After the delay).
UBTween.Position(transform, Vector3.up, 1f)
.OnStart(method);Will be called at the end of every loop.
UBTween.Position(transform, Vector3.up, 1f)
.SetLoop()
.OnLoop(method);Will be called when the interpolation stops.
UBTween.Position(transform, Vector3.up, 1f)
.OnFinished(method);