public static void Animate(this AnimatedImage bee, double fromX, double toX, double y, double seconds)
        {
            Canvas.SetTop(bee, y);
            var animation = DoubleAnimation(fromX, toX, seconds);

            Storyboard.SetTarget(animation, bee);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Canvas.LeftProperty));

            var storyboard = new Storyboard();

            storyboard.Children.Add(animation);
            storyboard.Begin();
        }
        public static AnimatedImage BeeFactory(double width, double height, TimeSpan flapInterval)
        {
            List<string> imageNames = new List<string>();
            imageNames.Add("Bee animation 1.png");
            imageNames.Add("Bee animation 2.png");
            imageNames.Add("Bee animation 3.png");
            imageNames.Add("Bee animation 4.png");

            AnimatedImage bee = new AnimatedImage(imageNames, flapInterval);
            bee.Width = width;
            bee.Height = height;
            return bee;
        }
Example #3
0
        public static AnimatedImage BeeFactory(double width, double height, TimeSpan flapInterval)
        {
            List <string> imageNames = new List <string>();

            imageNames.Add("Bee animation 1.png");
            imageNames.Add("Bee animation 2.png");
            imageNames.Add("Bee animation 3.png");
            imageNames.Add("Bee animation 4.png");

            AnimatedImage bee = new AnimatedImage(imageNames, flapInterval);

            bee.Width  = width;
            bee.Height = height;
            return(bee);
        }
Example #4
0
 public static void MakeBeeMove(AnimatedImage bee,
                                double fromX, double toX, double y)
 {
     Canvas.SetTop(bee, y);
     Storyboard storyboard = new Storyboard();
     DoubleAnimation animation = new DoubleAnimation();
     Storyboard.SetTarget(animation, bee);
     Storyboard.SetTargetProperty(animation, "(Canvas.Left)");
     animation.From = fromX;
     animation.To = toX;
     animation.Duration = TimeSpan.FromSeconds(3);
     animation.RepeatBehavior = RepeatBehavior.Forever;
     animation.AutoReverse = true;
     storyboard.Children.Add(animation);
     storyboard.Begin();
 }
Example #5
0
        public static void MakeBeeMove(AnimatedImage bee, double fromX, double toX, double y)
        {
            Canvas.SetTop(bee, y);
            Storyboard      storyboard = new Storyboard();
            DoubleAnimation animation  = new DoubleAnimation();

            Storyboard.SetTarget(animation, bee);
            Storyboard.SetTargetProperty(animation, new PropertyPath(Canvas.LeftProperty));

            animation.From           = fromX;
            animation.To             = toX;
            animation.Duration       = TimeSpan.FromSeconds(3);
            animation.RepeatBehavior = RepeatBehavior.Forever;
            animation.AutoReverse    = true;
            storyboard.Children.Add(animation);
            storyboard.Begin();
        }
Example #6
0
 public static void SetBeeLocation(AnimatedImage bee, double x, double y)
 {
     Canvas.SetLeft(bee, x);
     Canvas.SetTop(bee, y);
 }
Example #7
0
 public static void SetBeeLocation(AnimatedImage bee, double x, double y)
 {
     Canvas.SetLeft(bee, x);
     Canvas.SetTop(bee, y);
 }