Noob question
« on: May 05, 2016, 05:50:12 AM »

I am somewhat new to DOTween and have been trying to migrate from Unity's animation system to this one.
I have a simple animation sequence that I want to have in my game, it goes as follows:

Code: [Select]
m_MoveLeft = DOTween.Sequence();
        m_MoveLeft.Insert(0.0f, m_PlayerModel.DOScale(new Vector3(1.25f, 0.8f, 1.0f), 0.05f));
        m_MoveLeft.Insert(0.05f, m_PlayerModel.DOScale(new Vector3(1.0f, 1.0f, 1.0f), 0.2f));

        Vector3[] _path = new Vector3[5];
        _path[0] = new Vector3(0.0f, 0.0f, 0.0f);
        _path[1] = new Vector3(-.5f, 0.35f, 0.0f);
        _path[2] = new Vector3(-1.0f, 0.55f, 0.0f);
        _path[3] = new Vector3(-1.5f, 0.35f, 0.0f);
        _path[4] = new Vector3(-2.0f, 0.0f, 0.0f);

        m_MoveLeft.Insert(0.0f, m_PlayerModel.DOPath(_path, 0.5f, PathType.CatmullRom, PathMode.Ignore).SetRelative().SetEase(Ease.Linear));

This works fine if I play it once. But once the animation is done the player is in a different spot and if I try to move left again the sequence restarts from the original position and not the new position. Through research I found out a sequence is like a movie and therefore, static in nature. The points won't change once they are set. And that's exactly the opposite of what I am trying to do.

Now to the questions.
Is there a way to do what I want using sequences? Having changing start and end positions to them?
If not, how can  I accomplish something similar with a Tweener? Should I be chaining callbacks after each tween is done? That does not seem correct at all to me.

Anyway, thanks for taking the time!

Re: Noob question
« Reply #1 on: June 02, 2016, 07:02:10 AM »
I'm an utter noob at programming, so in all likelihood this will be useless advice, but:

The sequence plays the same because your script establishes set floating-point values for each Vector3 variable. Instead of setting each of your Vector3 to a specific floating point value, can't you use x,y,z values which reference or integrate the changes you've made?