コード例 #1
0
        public static SwipeReleaseAnimationConstructor Create(SwipeConfig config)
        {
            SwipeReleaseAnimationConstructor constructor = new SwipeReleaseAnimationConstructor();

            constructor.Config = config;
            return(constructor);
        }
コード例 #2
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            beginTriggerCallback?.Invoke(config.EasingFunc, 0, config.Duration);

            DisplayAnimation(config, 0, 0, () =>
            {
                triggerCompleteCallback?.Invoke();
                config.AdjustForNotSwipeFixCompleted();
            });
        }
コード例 #3
0
        public void Restore(SwipeConfig config, AnimationCallback beginRestoreCallback, Action restoreCompleteCallback)
        {
            beginRestoreCallback?.Invoke(config.EasingFunc, 0, config.Duration);

            DisplayAnimation(config, 0, 0, () =>
            {
                config.SwipeClipRectangle.Rect   = new Rect(0, 0, 0, 0);
                config.SwipeClipTransform.ScaleX = 1;

                restoreCompleteCallback?.Invoke();
            });
        }
コード例 #4
0
        public void Restore(SwipeConfig config, AnimationCallback beginRestoreCallback, Action restoreCompleteCallback)
        {
            beginRestoreCallback?.Invoke(config.EasingFunc, 0, config.Duration);

            DisplayAnimation(config, 0, 0, ()=>
            {
                config.SwipeClipRectangle.Rect = new Rect(0, 0, 0, config.ItemActualHeight);
                config.SwipeClipTransform.ScaleX = 1;

                restoreCompleteCallback?.Invoke();
            });
        }
コード例 #5
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            beginTriggerCallback?.Invoke(config.EasingFunc, 0, config.Duration);

            DisplayAnimation(config, 0, 0, () =>
            {
                triggerCompleteCallback?.Invoke();

                config.SwipeClipRectangle.Rect   = new Rect(0, 0, 0, 0);
                config.SwipeClipTransform.ScaleX = 1;
            });
        }
コード例 #6
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            var targetX    = config.Direction == SwipeDirection.Left ? config.ItemActualWidth : -config.ItemActualWidth;
            var clipScaleX = config.ItemActualWidth / config.CurrentSwipeWidth;

            beginTriggerCallback?.Invoke(config.EasingFunc, targetX, config.Duration);

            DisplayAnimation(config, targetX, clipScaleX, () =>
            {
                triggerCompleteCallback?.Invoke();
                config.AdjustForNotSwipeFixCompleted();
            });
        }
コード例 #7
0
        protected void DisplayAnimation(SwipeConfig config, string itemProperty, double itemTo, string clipProperty, double clipTo, Action complete)
        {
            Storyboard animStory = new Storyboard();
            animStory.Children.Add(Utils.CreateDoubleAnimation(config.MainTransform, itemProperty, config.EasingFunc, itemTo, config.Duration));
            animStory.Children.Add(Utils.CreateDoubleAnimation(config.SwipeClipTransform, clipProperty, config.EasingFunc, clipTo, config.Duration));

            animStory.Completed += (sender, e) =>
            {
                complete?.Invoke();
            };

            animStory.Begin();
        }
コード例 #8
0
        protected void DisplayAnimation(SwipeConfig config, double itemTo, double clipTo, Action complete)
        {
            Storyboard animStory = new Storyboard();

            animStory.Children.Add(Utils.CreateDoubleAnimation(config.MainTransform, "X", config.EasingFunc, itemTo, config.Duration));
            animStory.Children.Add(Utils.CreateDoubleAnimation(config.SwipeClipTransform, "ScaleX", config.EasingFunc, clipTo, config.Duration));

            animStory.Completed += (sender, e) =>
            {
                complete?.Invoke();
            };

            animStory.Begin();
        }
コード例 #9
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            var targetX    = config.Direction == SwipeDirection.Left ? config.ItemActualWidth : -config.ItemActualWidth;
            var clipScaleX = config.ItemActualWidth / config.CurrentSwipeWidth;

            beginTriggerCallback?.Invoke(config.EasingFunc, targetX, config.Duration);

            DisplayAnimation(config, targetX, clipScaleX, () =>
            {
                triggerCompleteCallback?.Invoke();

                config.SwipeClipRectangle.Rect   = new Rect(0, 0, 0, 0);
                config.SwipeClipTransform.ScaleX = 1;
            });
        }
コード例 #10
0
        public void SwipeTo(SwipeDirection direction, SwipeConfig config, bool animated)
        {
            var targetWidth = config.TriggerActionTargetWidth;
            var targetX     = config.Direction == SwipeDirection.Left ? targetWidth : -targetWidth;

            config.AdjustForSwipeToFixStarted();
            var clipScaleX = targetWidth;

            if (animated)
            {
                DisplayAnimation(config, targetX, clipScaleX, () =>
                {
                    config.AdjustForSwipeFixCompleted(targetWidth);
                });
            }
            else
            {
                config.MainTransform.X = targetX;
                config.AdjustForSwipeFixCompleted(targetWidth);
            }
        }
コード例 #11
0
 public virtual bool ShouldTriggerAction(SwipeConfig config)
 {
     return config.ActionRateForSwipeLength <= config.CurrentSwipeRate;
 }
コード例 #12
0
 public abstract void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback);
コード例 #13
0
 public static SwipeReleaseAnimationConstructor Create(SwipeConfig config)
 {
     SwipeReleaseAnimationConstructor constructor = new SwipeReleaseAnimationConstructor();
     constructor.Config = config;
     return constructor;
 }
コード例 #14
0
        public void SwipeTo(SwipeDirection direction, SwipeConfig config, bool animated)
        {
            var targetWidth = config.TriggerActionTargetWidth;
            var targetX = config.Direction == SwipeDirection.Left ? targetWidth : -targetWidth;
            config.AdjustForSwipeToFixStarted();
            var clipScaleX = targetWidth;

            if (animated)
            {
                DisplayAnimation(config, targetX, clipScaleX, () =>
                {
                    config.AdjustForSwipeFixCompleted(targetWidth);
                });
            }
            else
            {
                config.MainTransform.X = targetX;
                config.AdjustForSwipeFixCompleted(targetWidth);
            }
        }
コード例 #15
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            var targetWidth = config.TriggerActionTargetWidth;
            var targetX = config.Direction == SwipeDirection.Left ? targetWidth : -targetWidth;
            var clipScaleX = targetWidth / config.CurrentSwipeWidth;

            beginTriggerCallback?.Invoke(config.EasingFunc, targetX, config.Duration);

            DisplayAnimation(config, targetX, clipScaleX, ()=>
            {
                triggerCompleteCallback?.Invoke();
                config.AdjustForSwipeFixCompleted(targetWidth);
            });
        }
コード例 #16
0
        public override void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback)
        {
            beginTriggerCallback?.Invoke(config.EasingFunc, 0, config.Duration);

            DisplayAnimation(config, 0, 0, () =>
            {
                triggerCompleteCallback?.Invoke();
                config.AdjustForNotSwipeFixCompleted();
            });
        }
コード例 #17
0
 public virtual bool ShouldTriggerAction(SwipeConfig config)
 {
     return(config.ActionRateForSwipeLength <= config.CurrentSwipeRate);
 }
コード例 #18
0
 protected void DisplayAnimation(SwipeConfig config, double itemTo, double clipTo, Action complete)
 {
     DisplayAnimation(config, "X", itemTo, "ScaleX", clipTo, complete);
 }
コード例 #19
0
 public abstract void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback);
コード例 #20
0
 protected void DisplayAnimation(SwipeConfig config, double itemTo, double clipTo, Action complete)
 {
     DisplayAnimation(config, "X", itemTo, "ScaleX", clipTo, complete);
 }