public static Extensions.EffectEntity AnimateOpacity(this Extensions.EffectEntity Element, double FromValue, double ToValue, int Duration) { DoubleAnimation Animation = new DoubleAnimation(FromValue, ToValue, new Duration(TimeSpan.FromMilliseconds(Duration)), FillBehavior.Stop); Element.If <DoubleAnimation>(Animation); Brush bElement = Element.Get <SolidColorBrush>("Background"); bElement.BeginAnimation(SolidColorBrush.OpacityProperty, Animation); return(Element); }
public static Extensions.EffectEntity Animate(this Extensions.EffectEntity Element, DependencyProperty Property, int Duration, Extensions.FadeDirection Direction) { SolidColorBrush bElement = Element.Get <SolidColorBrush>("Background"); ColorAnimation Animation; if (Element.Data != null) { Animation = ReturnAnimation(Element, Duration, Direction); } else { Animation = new ColorAnimation { From = Element.Has <string>("From").ToColor(false), To = Element.Has <string>("To").ToColor(false), Duration = new Duration(TimeSpan.FromMilliseconds(Duration)) } }; Element.If <ColorAnimation>(Animation); bElement.BeginAnimation(Property, Animation); return(Element); }