Class TweenableVariableBase<T>
Tweenable variable uses bindable variable and target value to tween over time towards a target value.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables
Syntax
public abstract class TweenableVariableBase<T> : BindableVariable<T>, IReadOnlyBindableVariable<T> where T : IEquatable<T>Type Parameters
| Name | Description | 
|---|---|
| T | BindableVariable type. | 
Fields
k_NearlyOne
Threshold to compare tween amount above which the tween is short-circuited to the target value.
Declaration
protected const float k_NearlyOne = 0.99999FField Value
| Type | Description | 
|---|---|
| Single | 
Properties
animationCurve
Animation curve used for sequence animations.
Declaration
public AnimationCurve animationCurve { get; set; }Property Value
| Type | Description | 
|---|---|
| AnimationCurve | 
initialValue
Initial value used for certain tween jobs that need to process from the initial state.
Declaration
public T initialValue { get; set; }Property Value
| Type | Description | 
|---|---|
| T | 
target
Target value used when tweening variable value.
Declaration
public T target { get; set; }Property Value
| Type | Description | 
|---|---|
| T | 
See Also
Methods
ExecuteTween(T, T, Single, Boolean)
Tween from current value to target using tween target.
Declaration
protected abstract void ExecuteTween(T startValue, T targetValue, float tweenAmount, bool useCurve = false)Parameters
| Type | Name | Description | 
|---|---|---|
| T | startValue | Tween starting value. | 
| T | targetValue | Tween target value. | 
| Single | tweenAmount | Value between 0-1 used in tween evaluation. | 
| Boolean | useCurve | Whether the animation curve should be used in the tween evaluation. | 
See Also
HandleTween(Single)
Tween from current value to target using tween target.
Declaration
public void HandleTween(float tweenTarget)Parameters
| Type | Name | Description | 
|---|---|---|
| Single | tweenTarget | Value between 0-1 used in tween evaluation. | 
OnAnimationCurveChanged(AnimationCurve)
Called when the animation curve reference used for sequence animations changed.
Declaration
protected virtual void OnAnimationCurveChanged(AnimationCurve value)Parameters
| Type | Name | Description | 
|---|---|---|
| AnimationCurve | value | The new value of the property. | 
See Also
OnTargetChanged(T)
Callback when new tween target value is assigned.
Declaration
protected virtual void OnTargetChanged(T newTarget)Parameters
| Type | Name | Description | 
|---|---|---|
| T | newTarget | New target value. | 
See Also
PlaySequence(T, T, Single, Action)
Play sequence to animate value from start to finish over given duration.
Declaration
public IEnumerator PlaySequence(T start, T finish, float duration, Action onComplete = null)Parameters
| Type | Name | Description | 
|---|---|---|
| T | start | Value to start animation at. | 
| T | finish | Target Value to end animation at. | 
| Single | duration | Duration of animation. | 
| Action | onComplete | Optional callback when animation completes. | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns enumerator used for coroutine. | 
PreprocessTween()
Logic to execute before a tween can be processed.
Declaration
protected virtual void PreprocessTween()StartAutoTween(Single)
Coroutine used to automatically tween every frame.
Declaration
public IEnumerator StartAutoTween(float deltaTimeMultiplier)Parameters
| Type | Name | Description | 
|---|---|---|
| Single | deltaTimeMultiplier | Multiplier used to scale deltaTime for tweens. | 
Returns
| Type | Description | 
|---|---|
| IEnumerator | Returns enumerator used for coroutine. |