Esempio n. 1
0
        /// <summary>
        /// Enumeration of all easing equations.
        /// </summary>
        private static void OnEquationChanged(DependencyObject d,
                                              DependencyPropertyChangedEventArgs e)
        {
            PennerDoubleAnimation anim = d as PennerDoubleAnimation;

            anim._interpolator = GetInterpolator((Equations)e.NewValue);
        }
        public Blotches(Canvas canvas, Window1 window, string key, float pressure, double x, double y, Color color)
        {
            this.canvas = canvas;

            geometry = new EllipseGeometry();
            ellipse = new Path();
            SolidColorBrush brush = new SolidColorBrush();

            BlurEffect blurEffect = new BlurEffect();
            blurEffect.Radius = 0;

            geometry.Center = new Point(x, y);
            geometry.RadiusX = (SIZE * pressure) / 50;
            geometry.RadiusY = (SIZE * pressure) / 50;

            brush.Color = color;
            ellipse.Fill = brush;
            ellipse.HorizontalAlignment = HorizontalAlignment.Center;
            ellipse.VerticalAlignment = VerticalAlignment.Center;
            ellipse.Effect = blurEffect;
            ellipse.Data = geometry;
            canvas.Children.Add(this.ellipse);

            this.ellipse.Loaded += new RoutedEventHandler(ellipse_Loaded);

            // init animation
            this.hoverAnimation = new PennerDoubleAnimation(
                            Equations.ExpoEaseIn,
                            0, 0,
                            new Duration(new TimeSpan(0, 0, 3)));

            NameScope.SetNameScope(ellipse, new NameScope());
            ellipse.RegisterName("ellipse", blurEffect);

            // init storyboard
            Storyboard.SetTargetProperty(hoverAnimation, new PropertyPath(Canvas.TopProperty));
            hoverObj.Children.Add(hoverAnimation);

            this.hoverAnimation.Completed += new EventHandler(hoverAnimation_Completed);
        }