private void RemoveCore(Widget widget, uint duration, Easing easing, Blocking blocking, bool use_easing, bool use_blocking) { if (widget == null) { throw new ArgumentNullException("widget"); } AnimatedWidget animated_widget = null; foreach (AnimatedWidget child in Widgets) { if (child.Widget == widget) { animated_widget = child; break; } } if (animated_widget == null) { throw new ArgumentException("Cannot remove the specified widget because it has not been added to this container or it has already been removed.", "widget"); } RemoveCore(animated_widget, duration, easing, blocking, use_easing, use_blocking); RecalculateSpacings(); }
private void Pack(Widget widget, uint duration, Easing easing, Blocking blocking, bool end) { if (widget == null) { throw new ArgumentNullException("widget"); } AnimatedWidget animated_widget = new AnimatedWidget(widget, duration, easing, blocking, horizontal); animated_widget.Parent = this; animated_widget.WidgetDestroyed += OnWidgetDestroyed; stage.Add(animated_widget, duration); animated_widget.Node = end ? children.AddLast(animated_widget) : children.AddFirst(animated_widget); RecalculateSpacings(); if (active_count == 0) { if (border_state == AnimationState.Going) { border_bias = Percent; } else { border_easing = easing; border_bias = 1.0; } border_state = AnimationState.Coming; border_stage.Reset((uint)(duration * border_bias)); } active_count++; }
private void RecalculateSpacings() { int skip_count = 0; foreach (AnimatedWidget animated_widget in Widgets) { animated_widget.QueueResizeNoRedraw(); if (skip_count > 1) { skip_count--; continue; } AnimatedWidget widget = animated_widget; if (skip_count == 0) { widget.StartPadding = start_spacing; } else { skip_count--; } widget.EndPadding = end_spacing; if (widget.Node.Previous == null) { while (true) { widget.StartPadding = 0; if (widget.AnimationState == AnimationState.Coming || widget.AnimationState == AnimationState.Idle || widget.Node.Next == null) { break; } widget.EndPadding = spacing; widget = widget.Node.Next.Value; skip_count++; } } if (widget.Node.Next == null) { while (true) { widget.EndPadding = 0; if (widget.AnimationState == AnimationState.Coming || widget.AnimationState == AnimationState.Idle || widget.Node.Previous == null) { break; } widget.StartPadding = spacing; widget = widget.Node.Previous.Value; } } } }
private void RemoveCore(AnimatedWidget widget, uint duration, Easing easing, Blocking blocking, bool use_easing, bool use_blocking) { if (duration > 0) { widget.Duration = duration; } if (use_easing) { widget.Easing = easing; } if (use_blocking) { widget.Blocking = blocking; } if (widget.AnimationState == AnimationState.Coming) { widget.AnimationState = AnimationState.IntendingToGo; } else { if (widget.Easing == Easing.QuadraticIn) { widget.Easing = Easing.QuadraticOut; } else if (widget.Easing == Easing.QuadraticOut) { widget.Easing = Easing.QuadraticIn; } else if (widget.Easing == Easing.ExponentialIn) { widget.Easing = Easing.ExponentialOut; } else if (widget.Easing == Easing.ExponentialOut) { widget.Easing = Easing.ExponentialIn; } widget.AnimationState = AnimationState.Going; stage.Add(widget, widget.Duration); } duration = widget.Duration; easing = widget.Easing; active_count--; if (active_count == 0) { if (border_state == AnimationState.Coming) { border_bias = Percent; } else { border_easing = easing; border_bias = 1.0; } border_state = AnimationState.Going; border_stage.Reset((uint)(duration * border_bias)); } }
private void RemoveCore(AnimatedWidget widget) { RemoveCore(widget, widget.Duration, 0, 0, false, false); }
private void RemoveCore(AnimatedWidget widget, uint duration, Easing easing, Blocking blocking, bool use_easing, bool use_blocking) { if (duration > 0) { widget.Duration = duration; } if (use_easing) { widget.Easing = easing; } if (use_blocking) { widget.Blocking = blocking; } if (widget.AnimationState == AnimationState.Coming) { widget.AnimationState = AnimationState.IntendingToGo; } else { if (widget.Easing == Easing.QuadraticIn) { widget.Easing = Easing.QuadraticOut; } else if (widget.Easing == Easing.QuadraticOut) { widget.Easing = Easing.QuadraticIn; } else if (widget.Easing == Easing.ExponentialIn) { widget.Easing = Easing.ExponentialOut; } else if (widget.Easing == Easing.ExponentialOut) { widget.Easing = Easing.ExponentialIn; } widget.AnimationState = AnimationState.Going; stage.Add (widget, widget.Duration); } duration = widget.Duration; easing = widget.Easing; active_count--; if (active_count == 0) { if (border_state == AnimationState.Coming) { border_bias = Percent; } else { border_easing = easing; border_bias = 1.0; } border_state = AnimationState.Going; border_stage.Reset ((uint)(duration * border_bias)); } }
private void RemoveCore(AnimatedWidget widget) { RemoveCore (widget, widget.Duration, 0, 0, false, false); }
private void Pack(Widget widget, uint duration, Easing easing, Blocking blocking, bool end) { if (widget == null) { throw new ArgumentNullException ("widget"); } AnimatedWidget animated_widget = new AnimatedWidget (widget, duration, easing, blocking, horizontal); animated_widget.Parent = this; animated_widget.WidgetDestroyed += OnWidgetDestroyed; stage.Add (animated_widget, duration); animated_widget.Node = end ? children.AddLast (animated_widget) : children.AddFirst (animated_widget); RecalculateSpacings (); if (active_count == 0) { if (border_state == AnimationState.Going) { border_bias = Percent; } else { border_easing = easing; border_bias = 1.0; } border_state = AnimationState.Coming; border_stage.Reset ((uint)(duration * border_bias)); } active_count++; }