docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AnimateProperty

    AnimateProperty<T>(float, bool, ref bool, ref float, ref T, ref T, T, T, float, Func<T, T, bool>, Func<T, T, T, float>, Func<T, T, float, T>, Action<T>, bool, 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
    float time

    The current time value

    bool state

    Whether we are seeking the end value or the start value

    bool lastState

    The previous value of "state"

    float 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)

    float totalDuration

    The total desired duration of this transition

    Func<T, T, bool> approximately

    Delegate for determining whether two values of this property are approximately equal

    Func<T, T, T, float> 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, float, 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

    bool 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

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)