Class TweenableVariableBase<T>
Tweenable variable uses bindable variable and target value to tween over time towards a target value.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables
Assembly: Unity.XR.Interaction.Toolkit.dll
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.99999
Field Value
Type | Description |
---|---|
float |
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, float, bool)
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. |
float | tweenAmount | Value between 0-1 used in tween evaluation. |
bool | useCurve | Whether the animation curve should be used in the tween evaluation. |
See Also
HandleTween(float)
Tween from current value to target using tween target.
Declaration
public void HandleTween(float tweenTarget)
Parameters
Type | Name | Description |
---|---|---|
float | 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, float, 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. |
float | 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(float)
Coroutine used to automatically tween every frame.
Declaration
public IEnumerator StartAutoTween(float deltaTimeMultiplier)
Parameters
Type | Name | Description |
---|---|---|
float | deltaTimeMultiplier | Multiplier used to scale deltaTime for tweens. |
Returns
Type | Description |
---|---|
IEnumerator | Returns enumerator used for coroutine. |