private void posImage(Viewport3DControl image, int index)
        {
            double diffFactor = index - _current;

            double left = _xCenter + diffFactor * SpaceWidth - _touch_move_distance;
            double top  = 1.0;

            double Zindex = -Math.Abs(diffFactor) * 100;

            image.SetValue(Canvas.ZIndexProperty, (int)Zindex);

            if (index == _target)
            {
                left += 30;
                image.AnimationRotateTo(1, 1, 1, 0);
            }
            else if (index > _target)
            {
                left += 55;
                image.AnimationRotateTo(0.9, 0.9, 1, -45);
            }
            else if (index < _target)
            {
                image.AnimationRotateTo(0.9, 0.9, 1, 45);
            }

            image.Opacity = 1 - Math.Abs(diffFactor) * OPACITY_DOWN_FACTOR;
            image.SetValue(Canvas.LeftProperty, left);
            image.SetValue(Canvas.TopProperty, top);
        }
        public void AddImage(ImageSource bitmapImage)
        {
            Viewport3DControl image = new Viewport3DControl();

            image.SetImageSource(ref bitmapImage);
            image.Index      = _images.Count;
            image.Width      = ChildViewWidth;
            image.Height     = ChildViewHeight;
            image.MouseDown += new MouseButtonEventHandler(image_MouseDown);
            LayoutRoot.Children.Add(image);
            posImage(image, _images.Count);
            _images.Add(image);
        }
 void _timer_Tick(object sender, EventArgs e)
 {
     //还原位置
     if (IsPressed == false && _touch_move_distance != 0)
     {
         //回弹
         _touch_move_distance += (-_touch_move_distance) * SPRINESS;
     }
     for (int i = 0; i < _images.Count; i++)
     {
         Viewport3DControl image = _images[i];
         posImage(image, i);
     }
     if (Math.Abs(_target - _current) < CRITICAL_POINT && IsPressed == false)
     {
         return;
     }
     _current += (_target - _current) * SPRINESS;
 }
 public void AddImages(string[] imagesUri)
 {
     for (int i = 0; i < imagesUri.Length; i++)
     {
         if (imagesUri[i] != null)
         {
             string            url   = imagesUri[i];
             Viewport3DControl image = new Viewport3DControl();
             image.SetImageSource(url);
             image.Index      = i;
             image.Width      = ChildViewWidth;
             image.Height     = ChildViewHeight;
             image.MouseDown += new MouseButtonEventHandler(image_MouseDown);
             LayoutRoot.Children.Add(image);
             posImage(image, i);
             _images.Add(image);
         }
     }
 }
        void image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Viewport3DControl view = (Viewport3DControl)sender;

            OnTouchDownEvent(view, view.Index);
        }