I am trying to write a class that handles swiping (touch down, move, touch up) actions. This is the code I am using to get the time and distance for the object to travel after a swipe. The results are very inconsistent- sometimes too slow or too fast, sometimes the obejcts move too far or not far enough.
Can anyone give me some direction as to what I may be doing wrong?
// Rate of acceleration.
var a: Number = .5 * -9.81
// Time taken for last movement.
var dT: Number = (new Date().time - _lastLastTime);
// Distance traveled since last movement.
var dY: Number = _touchLastLastY - me.stageY;
// Velocity of users movement through last two onMove updates.
var v1: Number = dY/dT;
// Time tween will take.
var t: Number = -Math.abs(v1) / a;
// Distance Tween will move.
var d: Number = .5 * v1 * t;
// Code here applies d to the objects current Y Position to get newY (this is done correctly)
// Tween the object to the final location.
TweenLite.to(Page(_pages[_currentPage]), t, {y: newY, ease: Sine.easeOut});