/// <inheritdoc/> protected override IAnimationBuilder OnSize(Axis axis, double?from, double to, Easing ease) { if (!(TargetElement is FrameworkElement element)) { throw new InvalidOperationException("Can't animate the size of an item that's not a framework element"); } AnimationFactories.Add(duration => { switch (axis) { case Axis.X: return(TargetElement.CreateDoubleAnimation(nameof(FrameworkElement.Width), double.IsNaN(element.Width) ? element.ActualWidth : from, to, duration, ease, true)); case Axis.Y: return(TargetElement.CreateDoubleAnimation(nameof(FrameworkElement.Height), double.IsNaN(element.Height) ? element.ActualHeight : from, to, duration, ease, true)); default: throw new ArgumentException($"Invalid axis: {axis}", nameof(axis)); } }); return(this); }
/// <inheritdoc/> protected override IAnimationBuilder OnOpacity(double?from, double to, Easing ease) { AnimationFactories.Add(duration => TargetElement.CreateDoubleAnimation(nameof(UIElement.Opacity), from, to, duration, ease)); return(this); }