See my answer here and the corresponding PG: the function computeOffsetInAnim() should be what you need.
computeOffsetInAnim()