public static SwipeReleaseAnimationConstructor Create(SwipeConfig config) { SwipeReleaseAnimationConstructor constructor = new SwipeReleaseAnimationConstructor(); constructor.Config = config; return(constructor); }
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(); }); }
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(); }); }
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(); }); }
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; }); }
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(); }); }
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(); }
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(); }
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; }); }
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); } }
public virtual bool ShouldTriggerAction(SwipeConfig config) { return config.ActionRateForSwipeLength <= config.CurrentSwipeRate; }
public abstract void ActionTrigger(SwipeDirection direction, SwipeConfig config, AnimationCallback beginTriggerCallback, Action triggerCompleteCallback);
public static SwipeReleaseAnimationConstructor Create(SwipeConfig config) { SwipeReleaseAnimationConstructor constructor = new SwipeReleaseAnimationConstructor(); constructor.Config = config; return constructor; }
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); }); }
public virtual bool ShouldTriggerAction(SwipeConfig config) { return(config.ActionRateForSwipeLength <= config.CurrentSwipeRate); }
protected void DisplayAnimation(SwipeConfig config, double itemTo, double clipTo, Action complete) { DisplayAnimation(config, "X", itemTo, "ScaleX", clipTo, complete); }