예제 #1
0
        protected override void BeginTransition3D(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport)
        {
            Size size = transitionElement.RenderSize;

            // Create a rectangle
            MeshGeometry3D mesh = CreateMesh(new Point3D(),
                new Vector3D(size.Width, 0, 0),
                new Vector3D(0, size.Height, 0),
                1,
                1,
                new Rect(0, 0, 1, 1));

            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Geometry = mesh;
            VisualBrush clone = new VisualBrush(oldContent);
            geometry.Material = new DiffuseMaterial(clone);

            ModelVisual3D model = new ModelVisual3D();
            model.Content = geometry;

            viewport.Children.Add(model);

            Vector3D axis;
            Point3D center = new Point3D();
            switch (Direction)
            {
                case RotateDirection.Left:
                    axis = new Vector3D(0, 1, 0);
                    break;
                case RotateDirection.Right:
                    axis = new Vector3D(0, -1, 0);
                    center = new Point3D(size.Width, 0, 0);
                    break;
                case RotateDirection.Up:
                    axis = new Vector3D(-1, 0, 0);
                    break;
                default:
                    axis = new Vector3D(1, 0, 0);
                    center = new Point3D(0, size.Height, 0);
                    break;
            }
            AxisAngleRotation3D rotation = new AxisAngleRotation3D(axis, 0);
            model.Transform = new RotateTransform3D(rotation, center);

            DoubleAnimation da = new DoubleAnimation(0, Duration);
            clone.BeginAnimation(Brush.OpacityProperty, da);

            da = new DoubleAnimation(90 , Duration);
            da.Completed += delegate
            {
                EndTransition(transitionElement, oldContent, newContent);
            };
            rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DropPreviewAdorner"/> class.
 /// </summary>
 /// <param name="adornedElement">The adorned element.</param>
 /// <param name="adorningElement">The adorning element.</param>
 public DropPreviewAdorner(UIElement adornedElement, UIElement adorningElement)
     : base(adornedElement)
 {
     VisualBrush brush = new VisualBrush(adorningElement);
     this.child = new Rectangle();
     this.child.Width = adorningElement.RenderSize.Width;
     this.child.Height = adorningElement.RenderSize.Height;
     this.child.Fill = brush;
     this.child.IsHitTestVisible = false;
     System.Windows.Media.Animation.DoubleAnimation animation;
     animation = new System.Windows.Media.Animation.DoubleAnimation(0.3, 1, new Duration(TimeSpan.FromSeconds(1)));
     animation.AutoReverse = true;
     animation.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
     brush.BeginAnimation(System.Windows.Media.Brush.OpacityProperty, animation);
 }
        public DragDropAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            VisualBrush _brush = new VisualBrush(adornedElement);

            _child = new Rectangle();
            _child.Width = adornedElement.RenderSize.Width;
            _child.Height = adornedElement.RenderSize.Height;


            DoubleAnimation animation = new DoubleAnimation(0.3, 1, new Duration(TimeSpan.FromSeconds(1)));
            animation.AutoReverse = true;
            animation.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever;
            _brush.BeginAnimation(System.Windows.Media.Brush.OpacityProperty, animation);

            _child.Fill = _brush;
        }
예제 #4
0
        // Be sure to call the base class constructor.
        public SimpleCircleAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
            var brush = new VisualBrush(adornedElement);

            _child = new Rectangle
            {
                Width = adornedElement.RenderSize.Width,
                Height = adornedElement.RenderSize.Height
            };


            var animation = new DoubleAnimation(0.3, 1, new Duration(TimeSpan.FromSeconds(1)))
            {
                AutoReverse = true,
                RepeatBehavior = RepeatBehavior.Forever
            };
            brush.BeginAnimation(Brush.OpacityProperty, animation);

            _child.Fill = brush;
        }
예제 #5
0
        public RectAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
           Path p = (Path)(adornedElement);
           Cover c = p.ToolTip as Cover;
           Point cp = new Point();
           cp.X = ((c.Location.X - App.Tiles[0].X) / App.Tiles[0].Dx);
           cp.Y = ((App.Tiles[0].Y - c.Location.Y) / App.Tiles[0].Dy);

            _child = new Rectangle();
            _child.Width = App.StrokeThinkness * 2;
            _child.Height = App.StrokeThinkness * 2;
            
            VisualBrush _brush = new VisualBrush(adornedElement);

            DoubleAnimation animation = new DoubleAnimation(0.3, 1, new Duration(TimeSpan.FromSeconds(1)));
            animation.AutoReverse = true;
            animation.RepeatBehavior =  System.Windows.Media.Animation.RepeatBehavior.Forever;
            _brush.BeginAnimation(System.Windows.Media.Brush.OpacityProperty, animation);

            _child.Fill = _brush;
        }
예제 #6
0
        public DragAdorner(UIElement adorned)
            : base(adorned)
        {
            var brush = new VisualBrush(adorned) {Stretch = Stretch.None, AlignmentX = AlignmentX.Left};
            // HACK: this makes the markers work properly, 
            // even after adding 4+ markers and then removing to 3-,
            // and then shift-dragging (in which case the size of the adorner is correct, 
            // but the VisualBrush tries to render the now invisible number.
            _child = new Rectangle();
            _child.BeginInit();
            _child.Width = adorned.RenderSize.Width;
            _child.Height = adorned.RenderSize.Height;
            _child.Fill = brush;
            _child.IsHitTestVisible = false;
            _child.EndInit();

            var animation = new DoubleAnimation(0.6, 0.85, new Duration(TimeSpan.FromMilliseconds(500)))
                                {AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever};
            animation.Freeze();

            brush.BeginAnimation(Brush.OpacityProperty, animation);
        }