I'm a bit stuck with calculations to my program here.. This is how it works today: http://dropthebit.com/demos/pathAnimator/index.html
The object goes along the path, which the default is "forward", in a given time T and there are calculations running at 60 times a second, which determine the percentage from 0 to 100 of the object location along the path. I need to reverse that motion (in a click of a button), meaning the same calculations are still running, only now there will be a flag reverse turned on.
My problem is how to go, from the point I am now at, (in percentages) back and not to advance.
Here is the main logic of the code which runs at 60fps: (duration is in seconds)
elapsed = (now-startTime)/1000,
t = elapsed/duration,
percent = t * 100;
if( that.reverse ){
// i need to change the "percent" here somehow so it'll go backwards...
}
.. things happen...
I hope I was clear with everything.. Thanks!