xpos calculation based on speed and duration