當前位置: 首頁>>代碼示例>>C#>>正文


C# VisualBrush.BeginAnimation方法代碼示例

本文整理匯總了C#中System.Windows.Media.VisualBrush.BeginAnimation方法的典型用法代碼示例。如果您正苦於以下問題:C# VisualBrush.BeginAnimation方法的具體用法?C# VisualBrush.BeginAnimation怎麽用?C# VisualBrush.BeginAnimation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Media.VisualBrush的用法示例。


在下文中一共展示了VisualBrush.BeginAnimation方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BeginTransition3D

        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);
        }
開發者ID:liuxr,項目名稱:wpfumprototype,代碼行數:54,代碼來源:FlipTransition.cs

示例2: DropPreviewAdorner

 /// <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);
 }
開發者ID:Moozz,項目名稱:TinkerBell,代碼行數:20,代碼來源:DropPreviewAdorner.cs

示例3: DragDropAdorner

        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;
        }
開發者ID:jiangguang5201314,項目名稱:VMukti,代碼行數:17,代碼來源:SimpleCircleAdorner.cs

示例4: SimpleCircleAdorner

        // 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;
        }
開發者ID:ClemensT,項目名稱:WPF-Samples,代碼行數:22,代碼來源:SimpleCircleAdorner.cs

示例5: RectAdorner

        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;
        }
開發者ID:chijianfeng,項目名稱:PNManager,代碼行數:22,代碼來源:RectAdorner.cs

示例6: DragAdorner

        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);
        }
開發者ID:jonbonne,項目名稱:OCTGN,代碼行數:22,代碼來源:DragAdorner.cs


注:本文中的System.Windows.Media.VisualBrush.BeginAnimation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。