Class TransitionUtils
Transition utilities
Namespace: UnityEditor.Experimental.EditorVR.Utilities
Syntax
public static class TransitionUtils
Methods
AnimateProperty<T>(Single, Boolean, ref Boolean, ref Single, ref T, ref T, T, T, Single, Func<T, T, Boolean>, Func<T, T, T, Single>, Func<T, T, Single, T>, Action<T>, Boolean, Action<T>)
Helper function for animating transitions
Declaration
public static void AnimateProperty<T>(float time, bool state, ref bool lastState, ref float changeTime, ref T property, ref T propertyStart, T startValue, T endValue, float totalDuration, Func<T, T, bool> approximately, Func<T, T, T, float> getPercentage, Func<T, T, float, T> lerp, Action<T> setProperty, bool setState = true, Action<T> complete = null)
where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| Single | time | The current time value |
| Boolean | state | Whether we are seeking the end value or the start value |
| Boolean | lastState | The previous value of "state" |
| Single | changeTime | The time when state changed |
| T | property | The current value of the property we are animating |
| T | propertyStart | The start value of this transition (value of "property" when state changed) |
| T | startValue | The start value of the transition (seek this value when state is false) |
| T | endValue | The end value of the transition (seek this value when state is true) |
| Single | totalDuration | The total desired duration of this transition |
| Func<T, T, Boolean> | approximately | Delegate for determining whether two values of this property are approximately equal |
| Func<T, T, T, Single> | getPercentage | Delegate for determining how far along we are in the transition (i.e. propery is X percent of the way between start and end) |
| Func<T, T, Single, T> | lerp | Delegate for determining whether two values of this property are approximately equal |
| Action<T> | setProperty | Delegate for determining whether two values of this property are approximately equal |
| Boolean | setState | Whether to set lastState equal to state at the end of the method |
| Action<T> | complete | Delegate to be executed when the transition completes |
Type Parameters
| Name | Description |
|---|---|
| T | The type of property we're animating |
Approximately(Color, Color)
Return true if one color is approximately equal to another
Declaration
public static bool Approximately(Color a, Color b)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | a | Color a |
| Color | b | Color b |
Returns
| Type | Description |
|---|---|
| Boolean | Whether a is approximately equal to b |
GetPercentage(Color, Color, Color)
Get the percentage of the current color between source and target
Declaration
public static float GetPercentage(Color currentColor, Color targetColor, Color sourceColor)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | currentColor | The current color |
| Color | targetColor | The target color |
| Color | sourceColor | The source color |
Returns
| Type | Description |
|---|---|
| Single | The percentage |
GetPercentage(Single, Single, Single)
Get the percentage of the current value between source and target
Declaration
public static float GetPercentage(float current, float target, float source)
Parameters
| Type | Name | Description |
|---|---|---|
| Single | current | The current value |
| Single | target | The target value |
| Single | source | The source value |
Returns
| Type | Description |
|---|---|
| Single | The percentage |