- Home /
Run an iTween path backwards?
Hi All,
A simple yes or no, followed by any ideas on how would be great for this one. I've been wracking my brain trying to work out a method of animating backwards along a path using MoveTo from the iTween set. Is it even possible? And then secondly, how would you run that path from the present location. Like hitting rewind on a tape?
I was considering using a reverse array command in there somewhere, but then that wouldn't let me pick up where my present location was.
Cheers, Daniel
That's fine if I wanted to get to the end of the path first. But I'm after swapping direction at any point along the path. Thanks though.
I'm working on something similar though simpler. Are you using the iTweenPath class? if so, are you calling iTween by hand as in iTween.$$anonymous$$oveTo(object, iTweenPath.GetPath(myPathName), or how are you doing this? in a nutshell, you'll need to add an option to revert the path, call iTween.Stop[ByName](), and then run along a new path with a partial subset of your path.
That is pretty clever. I'll have to give that a go. Yes I'm using the iTweenPath class and yeh doing it by hand. Have to think of a way of getting a subset of my path. Had to move on to something else in the meantime, but I was starting to plan on tweening between percentages along the path, just deducting a 0.01 percent each time to begin with and work out a better value as I go along.
Answer by Android324 · Jun 15, 2012 at 02:41 PM
Hi Daniel. Had the same problem recently and the solution is quite easy (this worked in my case hope it'll help u too):
Let's say this is the way to go from A to B :
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("Path1"), "time", 5, "easetype", iTween.EaseType.linear));
The code that will move your object from B to A would be :
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPathReversed("Path1"), "time", 5, "easetype", iTween.EaseType.linear));
Cheers Paul S.
Looks like I have a outdated version as GetPathReversed did not work :) Grabbed the latest and it works great :)
Your answer
Follow this Question
Related Questions
Is it possible to move through itween path manually with a parameter except of time? 1 Answer
How to control an animation by touch position along a path? 1 Answer
itween MoveTo IndexOutOfRangeException 0 Answers
An odd iTween+RageSpline animation issue with trigger/collider! 1 Answer
Dynamic animation method ✾ 1 Answer