void OnUpdate(float elapsed) { if (enabledX) { float duration = durationX; if (elapsed > duration) { elapsed = duration; } PhaseX = _easingX == null ? elapsed / duration : _easingX.Invoke(elapsed / duration); } if (enabledY) { float duration = durationY; if (elapsed > duration) { elapsed = duration; } PhaseY = _easingY == null ? elapsed / duration : _easingY.Invoke(elapsed / duration); } Delegate.AnimatorUpdated(this); UpdateBlock?.Invoke(); }
private void AnimationLoop() { var currentTime = System.Diagnostics.Stopwatch.GetTimestamp(); UpdateAnimationPhases(currentTime); Delegate.AnimatorUpdated(this); UpdateBlock?.Invoke(); if (currentTime >= endTime) { Stop(); } }
void OnStop() { enabledX = false; enabledY = false; // If we stopped an animation in the middle, we do not want to leave it like this if (PhaseX != 1.0f || PhaseY != 1.0f) { PhaseX = 1.0f; PhaseX = 1.0f; Delegate.AnimatorUpdated(this); UpdateBlock?.Invoke(); } Delegate.AnimatorStopped(this); StopBlock?.Invoke(); }
public void Stop() { if (displayLink != null) { displayLink.RemoveFromRunLoop(Foundation.NSRunLoop.Main, Foundation.NSRunLoopMode.Common); displayLink = null; enabledX = false; enabledY = false; // If we stopped an animation in the middle, we do not want to leave it like this if (PhaseX != 1.0 || PhaseY != 1.0) { PhaseX = 1.0f; PhaseX = 1.0f; Delegate.AnimatorUpdated(this); UpdateBlock?.Invoke(); } Delegate.AnimatorStopped(this); StopBlock?.Invoke(); } }