public void Dispose() { touchForwarder.Enabled = true; closeButton.TouchUpInside -= HandleTouchUpInside; if (animationComplete != null) { animationComplete.Dispose(); animationComplete = null; } indicatorView.RemoveFromSuperview(); indicatorView.Dispose(); webView.LoadFinished -= HandleLoadFinished; webView.RemoveFromSuperview(); webView.Dispose(); webView = null; closeButton.RemoveFromSuperview(); closeButton.Dispose(); closeButton = null; view.RemoveFromSuperview(); view.Dispose(); view = null; }
public static void MoveWithRotationAndFadeOut(FrameworkElement element, Point to, double rotationAngle, double seconds, AnimationCompletedDelegate callback) { TransformGroup transformGroup = new TransformGroup(); transformGroup.Children.Add(new RotateTransform(rotationAngle, element.Width / 2, element.Height / 2)); Duration duration = new Duration(TimeSpan.FromSeconds(seconds)); DoubleAnimation animationX = new DoubleAnimation(to.X, duration); DoubleAnimation animationY = new DoubleAnimation(to.Y, duration); DoubleAnimation fadeOutAnimation = new DoubleAnimation { From = 1, To = 0.4, Duration = duration, FillBehavior = FillBehavior.Stop }; animationX.Completed += (sender, _) => callback(sender, _); TranslateTransform trans = new TranslateTransform(); element.RenderTransform = transformGroup; trans.BeginAnimation(TranslateTransform.XProperty, animationX); trans.BeginAnimation(TranslateTransform.YProperty, animationY); element.Opacity = 0.4; element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); transformGroup.Children.Add(trans); }
public FloatingLayoutContainer(UpdateTimer mainTimer, LayoutContainer childLayout, float animationDuration, AnimationCompletedDelegate animationComplete) { this.mainTimer = mainTimer; this.childLayout = childLayout; this.animationDuration = animationDuration; this.animationComplete = animationComplete; }
public static void Move(DependencyProperty dependencyProperty, UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback) { DoubleAnimation moveAnimation = new DoubleAnimation { From = from, To = to, Duration = new Duration(TimeSpan.FromSeconds(seconds)) }; if (callback != null) { moveAnimation.Completed += (sender, _) => callback(sender, _); } if (element.RenderTransform == null) { element.RenderTransform = new TranslateTransform(); } element.RenderTransform.BeginAnimation(dependencyProperty, moveAnimation); }
void HandleTouchUpInside(object sender, EventArgs e) { closeButton.TouchUpInside -= HandleTouchUpInside; CGRect frame = view.Frame; frame.Y = frame.Height; UIView.BeginAnimations("slideAnimation"); UIView.SetAnimationDuration(AnimationDuration); UIView.SetAnimationCurve(UIViewAnimationCurve.EaseIn); UIView.SetAnimationRepeatCount(0); UIView.SetAnimationRepeatAutoreverses(false); animationComplete = new AnimationCompletedDelegate(this); UIView.SetAnimationDelegate(animationComplete); UIView.SetAnimationDidStopSelector(new Selector("slideAnimationFinished")); view.Frame = frame; UIView.CommitAnimations(); }
public static void Move(UIElement element, Point from, Point to, double seconds, AnimationCompletedDelegate callback) { Move(TranslateTransform.XProperty, element, from.X, to.X, seconds, null); Move(TranslateTransform.YProperty, element, from.Y, to.Y, seconds, callback); }
public static void Opacity(UIElement element, double from, double to, double seconds, AnimationCompletedDelegate callback) { DoubleAnimation fadeOutAnimation = new DoubleAnimation { From = from, To = to, Duration = new Duration(TimeSpan.FromSeconds(seconds)), FillBehavior = FillBehavior.Stop }; element.Opacity = to; if (callback != null) { fadeOutAnimation.Completed += (sender, _) => callback(sender, _); } element.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); }