You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I wanted to have an ease that starts with more acceleration than on the end and I didn't want to use Animation curves, I thought it would be great, to be able to combine two interpolate between two eases. Unfortunately I couldn't find a feature that does what I wanted, but I was able to create an Easefunction on my own.
this is what I came up with:
public static EaseFunction CombinedEase(Ease easeIn, Ease easeOut, Ease interpolationEase = Ease.Linear)
{
return new EaseFunction((time, duration, overshootOrAmplitude, period) =>
{
float t = time / duration;
float eIn = EaseManager.Evaluate(easeIn, null, t, 1, overshootOrAmplitude, period);
float eOut = EaseManager.Evaluate(easeOut, null, t, 1, overshootOrAmplitude, period);
float ti = interpolationEase == Ease.Linear ? t : EaseManager.Evaluate(interpolationEase, null, t, 1, overshootOrAmplitude, period);
return (1-ti)*eIn + ti*eOut;
});
}
the interpolationEase gives control over how the the eases are blended. this gives a lot of flexibility.
With this function you can even get an ease that starts fast, becomes slower and ends fast again, which isn't possible with the default eases. You achieve that by putting an "Out Ease" in the easeIn field and an "In Ease" in the easeOut field.
example: transform.DOMove(targetPosition, duration).SetEase(CombinedEase(Ease.OutQuad, Ease.InQuad))
I think it would be great to have something like this in DOTween by default. What do you think?
The text was updated successfully, but these errors were encountered:
It would also be great if DOVirtual.EasedValue(..) would work with EaseFunctions too.
That would make it easier for me to use my functions since I am actually not using it for tweening but for manipulating waypoints for a tweening path.
Since I wanted to have an ease that starts with more acceleration than on the end and I didn't want to use Animation curves, I thought it would be great, to be able to combine two interpolate between two eases. Unfortunately I couldn't find a feature that does what I wanted, but I was able to create an Easefunction on my own.
this is what I came up with:
the
interpolationEase
gives control over how the the eases are blended. this gives a lot of flexibility.With this function you can even get an ease that starts fast, becomes slower and ends fast again, which isn't possible with the default eases. You achieve that by putting an "Out Ease" in the
easeIn
field and an "In Ease" in theeaseOut
field.example:
transform.DOMove(targetPosition, duration).SetEase(CombinedEase(Ease.OutQuad, Ease.InQuad))
I think it would be great to have something like this in DOTween by default. What do you think?
The text was updated successfully, but these errors were encountered: