当前位置: 首页>>代码示例>>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;未经允许,请勿转载。