本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}