Advertisement

help to build exponential easing out curve

Started by June 26, 2019 01:45 PM
4 comments, last by mirkojpn 5 years, 2 months ago

 

hi

i'm trying to make an exponential ease out curve that will decelerate over time but start fast, and i need to clamp it on 0-1 range, anyone can help me to figure out how to make it?


this is what i have

 

 


         _currentLerpTime += in_deltatime;
        float t = _currentLerpTime / _totalRotationTime;
 

        t = Mathf.Sin(t * Mathf.PI * 0.5f);
 

        Quaternion newRot
                    = QuaternionExtension.Lerp(_startRotation,_requestedRotation,t,false);
 
        Vector3 current = newRot.eulerAngles;
       
        _currentAngle = current.x;
 
        _myCharacter.transform.localRotation
                                        = newRot;

but doesn't start fast...

I have no idea what that code is doing, shouldn't there be something exponential in it?

Anyway, e**(-x) is 1 for x = 0, and very very very close to 0 for x at infinity, so I'd say that would be a useful start. It's also memory less, you have the same curve everywhere, so you can cut any arbitrary part from it.

Advertisement
8 hours ago, Alberth said:

I have no idea what that code is doing, shouldn't there be something exponential in it?

Anyway, e**(-x) is 1 for x = 0, and very very very close to 0 for x at infinity, so I'd say that would be a useful start. It's also memory less, you have the same curve everywhere, so you can cut any arbitrary part from it.

hello! thank's you for your help.

i found what i was looking for.. is this


Math.easeInOutExpo = function (t, b, c, d) {
	t /= d/2;
	if (t < 1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
	t--;
	return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
};

but i'm not really sure of what that four parameter mean..

26 minutes ago, mirkojpn said:

i found what i was looking for

This is a good find also...

Math for Game Programmers: Fast and Funky 1D Nonlinear Transformations

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

On 6/27/2019 at 2:12 AM, fleabay said:

hello1

thank's you, i got the point, and now i'm testing it... well, smothstart is working well, but not the same for smothstop, it will be exactly the same as smothstart.. i cant't figure out what i'm doing wrong...

 

here what i have..


        _currentLerpTime += Time.deltaTime;
        // Debug.Log(_currentLerpTime);
        if(_currentLerpTime >= _totalLerpTime)
        {
            _currentLerpTime = _totalLerpTime;
        }

        float t = _currentLerpTime / _totalLerpTime;

        float time = SmothStop(t);




        Quaternion newRot = Quaternion.Lerp(Quaternion.Euler(start),Quaternion.Euler(end),time);

        transform.rotation = newRot;

and this is smothstop function 

 


    private float SmothStop(float t)
    {
        return 1 - (1 - t * t * t * t * t);
    }

 

This topic is closed to new replies.

Advertisement