Str8lines
Search Results for

    Show / Hide Table of Contents

    Class Easing

    Defines easing functions used internally and provides methods to calculate Vector3 and float values.

    Methods

    ease(EasingFunction, Single, Single, Single, Single)

    Calculates new float value according to elapsed time.

    Parameters
    easingFunction (EasingFunction)

    The easing function represents the type of easing.

    t (Float)

    Time elapsed (in seconds).

    f (Float)

    Initial float value.

    c (Float)

    float value change.

    d (Float)

    Total tween duration (in seconds).

    Returns
    Float ➜

    Resulting float value.

    Examples

    Calculates new float value.

    using UnityEngine;
    using Str8lines.Tweening;
    
    public class MyClass : MonoBehaviour
    {
        private float val = 0f;
    
        private void Start()
        {
            val = Easing.ease(EasingFunction.Linear, 2f, val, 10f, 3f);
        }
    }

    ease(EasingFunction, Single, Vector3, Vector3, Single)

    Calculates new Vector3 according to elapsed time.

    Parameters
    easingFunction (EasingFunction)

    The easing function represents the type of easing.

    t (Float)

    Time elapsed (in seconds).

    v (Vector3)

    Initial Vector3 value.

    c (Vector3)

    Vector3 value change.

    d (Float)

    Total tween duration (in seconds).

    Returns
    Vector3 ➜

    Resulting Vector3.

    Examples

    Calculates new Vector3 value.

    using UnityEngine;
    using Str8lines.Tweening;
    
    public class MyClass : MonoBehaviour
    {
        public Vector3 vector;
    
        private void Start()
        {
            Vector3 vectorChange = new Vector3(0, 500, 0);
            vector = Easing.ease(EasingFunction.Linear, 2f, vector, vectorChange, 3f);
        }
    }
    In This Article

    Geoffrey Lesne (Str8lines) © 2024 - All rights reserved

    • facebook logo
    • linkedin logo
    • discord logo
    contact us / Back to top