示例#1
0
        public static Extensions.EffectEntity Opacity(this Extensions.EffectEntity Element, double Value)
        {
            Brush Background = Element.Get <Brush>("Background");

            Background.GetType().GetProperty("Opacity").SetValue(Background, Value);

            return(Element);
        }
示例#2
0
        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);
        }
示例#3
0
        private void AnimateFadeIn(object sender, MouseEventArgs e)
        {
            Extensions.EffectEntity Entity = (sender as FrameworkElement).Create();

            if ((Entity.Data as MenuContainer).IsActive)
            {
                return;
            }

            if (Entity.Get <Brush>("Background").Opacity != 0.6)
            {
                Entity.Opacity(0.6);
            }

            Entity.Animate(SolidColorBrush.ColorProperty, 700, Extensions.FadeDirection.FadeIn);
            Extensions.FindVisualChildren <Border>(Entity.Element).FirstOrDefault().AnimateBorder(Entity, 700, Extensions.FadeDirection.FadeIn);
        }
示例#4
0
        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);
        }