protected void TransformVectorTo(Vector2 startValue, Vector2 newValue, double duration, EasingTypes easing, TransformVector transform) { Type type = transform.GetType(); if (transformationDelay == 0) { Transforms.RemoveAll(t => t.GetType() == type); if (startValue == newValue) { return; } } else { startValue = (Transforms.FindLast(t => t.GetType() == type) as TransformVector)?.EndValue ?? startValue; } double startTime = Clock != null ? (Time.Current + transformationDelay) : 0; transform.StartTime = startTime; transform.EndTime = startTime + duration; transform.StartValue = startValue; transform.EndValue = newValue; transform.Easing = easing; if (Clock == null) { transform.UpdateTime(new FrameTimeInfo { Current = transform.EndTime }); transform.Apply(this); } else if (duration == 0 && transformationDelay == 0) { transform.UpdateTime(Time); transform.Apply(this); } else { Transforms.Add(transform); } }
private Drawable transformVectorTo(Vector2 startValue, Vector2 newValue, double duration, EasingTypes easing, TransformVector transform) { Type type = transform.GetType(); if (transformationDelay == 0) { Transforms.RemoveAll(t => t.GetType() == type); if (startValue == newValue) { return(this); } } else { startValue = (Transforms.FindLast(t => t.GetType() == type) as TransformVector)?.EndValue ?? startValue; } double startTime = Time + transformationDelay; transform.StartTime = startTime; transform.EndTime = startTime + duration; transform.StartValue = startValue; transform.EndValue = newValue; transform.Easing = easing; if (duration == 0) { transform.Apply(this); } else { Transforms.Add(transform); } return(this); }