IEnumerator <object> GetMoveCoroutine(asd.DrawnObject2D object2D, MoveAnimationElement move) { asd.Vector2DF start = move.isRequireFrom ? move.from : object2D.Position; for (int i = 1; i <= move.frame; i++) { object2D.Position = new asd.Vector2DF(GetEasing(move.easing, i, start.X, move.to.X, move.frame), GetEasing(move.easing, i, start.Y, move.to.Y, move.frame)); yield return(null); } }
public void MoveTo(asd.Vector2DF to, int frame, Easing easing = Easing.Linear) { var element = new MoveAnimationElement { to = to, frame = frame > 0 ? frame : 1, easing = easing, isRequireFrom = false }; animationElements.Add(element); }