コード例 #1
0
        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();
        }
コード例 #2
0
        private void AnimationLoop()
        {
            var currentTime = System.Diagnostics.Stopwatch.GetTimestamp();

            UpdateAnimationPhases(currentTime);

            Delegate.AnimatorUpdated(this);
            UpdateBlock?.Invoke();


            if (currentTime >= endTime)
            {
                Stop();
            }
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
            }
        }