Demigiant Forum
Unity Assets => DOTween & DOTween Pro => Topic started by: ProgVirus on February 01, 2016, 12:03:42 AM
-
Just like the title says, I would like to try to change the duration of a tween after it starts.
I'm trying to accomplish a zoom out mechanic at one speed, and using the same tween have it zoom back to the original position at a slower rate.
if (boost > 0.0f)
{
isForwardBoosting = true;
forwardBoostTween.SetEase(forwardBoostEase)
.PlayForward();
}
else if (transform.position.z > initialPositionZ)
{
forwardBoostTween.SetEase(forwardBoostEase)
.PlayBackwards();
}
else
{
isForwardBoosting = false;
}
I've already tried using ChangeValues, with a hard coded incredibly long new duration for testing, but nothing seems to happen. I assume this is because the duration cannot be changed after it is started?
Any advice on a way to accomplish this would be great, thanks!
-
I'm a *very* new DOTween User, so I may be off base here, but... To slow the tween down, I'd think you could simply set its time scale prior to the PlayBackwards() call. So, something like this:
else if (transform.position.z > initialPositionZ)
{
forwardBoostTween.timeScale = 0.5f;
forwardBoostTween.SetEase(forwardBoostEase)
.PlayBackwards();
}
-
Thanks!
I was actually skimming through the documentation on my lunch break at work today, and had come across this -- feel like a total dolt for not seeing it earlier, but I believe you're spot on the mark.
:) Thanks again!