Beispiel #1
0
        /// <summary>
        /// Toggles the right drawer's open status.
        /// </summary>
        public void ToggleRight()
        {
            CompositionEasingFunction cubicBezier = _compositor.CreateCubicBezierEasingFunction(new Vector2(.45f, 1.5f), new Vector2(.45f, 1f));
            Vector3KeyFrameAnimation  kfa         = _compositor.CreateVector3KeyFrameAnimation();

            kfa.Duration = TimeSpan.FromSeconds(0.5);
            if (_tracker.Position.X > 0)
            {
                DrawsClosed?.Invoke(null, null);
                kfa.InsertKeyFrame(1.0f, _vector3Zero, cubicBezier);
            }
            else
            {
                DrawOpenedRight?.Invoke(null, null);
                kfa.InsertKeyFrame(1.0f, _tracker.MaxPosition, cubicBezier);
            }

            _tracker.TryUpdatePositionWithAnimation(kfa);
        }
Beispiel #2
0
        public void ToggleLeft()
        {
            CompositionEasingFunction cubicBezier = compositor.CreateCubicBezierEasingFunction(new Vector2(.45f, 1.5f), new Vector2(.45f, 1f));
            Vector3KeyFrameAnimation  kfa         = compositor.CreateVector3KeyFrameAnimation();

            kfa.Duration = TimeSpan.FromSeconds(0.5);
            if (tracker.Position.X < 0)
            {
                kfa.InsertKeyFrame(1.0f, Vector3Zero, cubicBezier);
                DrawsClosed?.Invoke(null, null);
            }
            else
            {
                kfa.InsertKeyFrame(1.0f, tracker.MinPosition, cubicBezier);
                DrawOpenedLeft?.Invoke(null, null);
            }

            tracker.TryUpdatePositionWithAnimation(kfa);
        }