public static Shape AnimateRotation(this Shape shape, double fromAngle, double toAngle, TimeSpan duration, bool autoReverse = false)
        {
            var scale = new RotateTransform(fromAngle);

            shape.AddRenderTransform(scale);
            scale.BeginAnimation(RotateTransform.AngleProperty, new DoubleAnimation(fromAngle, toAngle, new Duration(duration))
            {
                RepeatBehavior = RepeatBehavior.Forever, AutoReverse = autoReverse
            });
            scale.BeginAnimation(RotateTransform.AngleProperty, new DoubleAnimation(fromAngle, toAngle, new Duration(duration))
            {
                RepeatBehavior = RepeatBehavior.Forever, AutoReverse = autoReverse
            });
            return(shape);
        }
        public static Shape AnimateScale(this Shape shape, double fromValue, double toValue, TimeSpan duration)
        {
            var scale = new ScaleTransform(fromValue, fromValue);

            shape.AddRenderTransform(scale);
            scale.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(fromValue, toValue, new Duration(duration))
            {
                RepeatBehavior = RepeatBehavior.Forever, AutoReverse = true
            });
            scale.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(fromValue, toValue, new Duration(duration))
            {
                RepeatBehavior = RepeatBehavior.Forever, AutoReverse = true
            });
            return(shape);
        }