- Home /
Question by
laurienash · Mar 07, 2021 at 03:53 PM ·
c#tweentweening
DoTween - how to add ease type?
Hi,
I'm unsure how I should add an ease type to my tween function?
Here's my script:
private void UpdatePowerbarFill(float score)
{
if (powerbarFillTween != null) powerbarFillTween.Kill();
powerbarFillTween = DOVirtual.Float(powerbar_Mat.GetFloat("FillRate"), score, fillTweenDuration, (float val) => {
powerbar_Mat.SetFloat("FillRate", val);
}).OnComplete(() => {
powerbarFillTween = null;
});
}
When looking online it seems as though I should be able to add it as an extension, but I'm getting errors when I try this:
powerbarFillTween = DOVirtual.Float(powerbar_Mat.GetFloat("FillRate"), score, fillTweenDuration, (float val).SetEase<>(Ease.InOutElastic) => {
powerbar_Mat.SetFloat("FillRate", val);
Does anyone know how to do this correctly?
Thanks!
Comment
Answer by Pitarcus_mp · Mar 19 at 08:17 AM
I know it's late, but just in case anyone needs it!
You can simply add the easing type after the creation of the tween:
DOVirtual.Float(0f, 1f, 0.5f, SetCanvasScale).SetEase(Ease.OutBounce);
,I hope you got it in the end, but here it is just in case anyone needs it!
DOVirtual.Float(0f, 1f, 0.5f, SetCanvasScale).SetEase(Ease.InOutBounce);
Your answer
Follow this Question
Related Questions
leantween ltspline control points setup 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
transform position and dotween 0 Answers