本文整理汇总了C#中System.Windows.Media.RotateTransform类的典型用法代码示例。如果您正苦于以下问题:C# RotateTransform类的具体用法?C# RotateTransform怎么用?C# RotateTransform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RotateTransform类属于System.Windows.Media命名空间,在下文中一共展示了RotateTransform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AntGrid
private void AntGrid(Grid g)
{
g.Width = 5;
g.Height = 5;
g.Visibility = Visibility.Visible;
Storyboard sb = new Storyboard();
DoubleAnimation da = new DoubleAnimation(5.0, gridmain.ActualWidth - 10, new Duration(TimeSpan.FromSeconds(2)));
DoubleAnimation da1 = new DoubleAnimation(5.0, gridmain.RowDefinitions[0].ActualHeight - 10, new Duration(TimeSpan.FromSeconds(2)));
DoubleAnimation da2 = new DoubleAnimation(0, 720, new Duration(TimeSpan.FromSeconds(2)));
TransformGroup tg = new TransformGroup();
RotateTransform rt = new RotateTransform(720);
tg.Children.Add(rt);
g.RenderTransform = tg;
g.RenderTransformOrigin = new Point(0.5, 0.5);
Storyboard.SetTarget(da2, g);
Storyboard.SetTargetProperty(da2, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));//RotateTransform.AngleProperty
sb.Children.Add(da2);
Storyboard.SetTarget(da, g);
Storyboard.SetTargetProperty(da, new PropertyPath(Grid.WidthProperty));
sb.Children.Add(da);
Storyboard.SetTarget(da1, g);
Storyboard.SetTargetProperty(da1, new PropertyPath(Grid.HeightProperty));
sb.Children.Add(da1);
if (!Resources.Contains("ShowAn"))
Resources.Add("ShowAn", sb);
sb.AccelerationRatio = 1.0;
sb.Begin();
}
示例2: ParkHotelExplorer
public static void ParkHotelExplorer(bool restore, double width, Canvas canvas, double top, double left, double scale, double rotate)
{
_canvas = canvas;
var hotelExplorer = HotelExplorer.GetInstance();
hotelExplorer.IsFloating = !restore;
hotelExplorer.HightLight(!restore);
var ypos = restore ? top : Canvas.GetTop(hotelExplorer);
var xpos = restore ? width - left - (hotelExplorer.ActualWidth * scale) : Canvas.GetLeft(hotelExplorer);
var yTo = restore ? 55 : top;
var xTo = restore ? 55 : width - left - (hotelExplorer.ActualWidth / scale);
var zoomFrom = restore ? scale : 1;
var zoomTo = restore ? 1 : scale;
var rotateFrom = restore ? rotate : 0;
var rotateTo = restore ? 0 : rotate;
var yAnimation = new DoubleAnimation
{
From = ypos,
To = yTo,
Duration = new Duration(TimeSpan.FromMilliseconds(500))
};
var xAnimation = new DoubleAnimation
{
From = xpos,
To = xTo,
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
hotelExplorer.BeginAnimation(Canvas.TopProperty, yAnimation);
hotelExplorer.BeginAnimation(Canvas.LeftProperty, xAnimation);
var zoom = new DoubleAnimation
{
From = zoomFrom,
To = zoomTo,
BeginTime = TimeSpan.FromMilliseconds(0),
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
var rotateAnimation = new DoubleAnimation
{
From = rotateFrom,
To = rotateTo,
BeginTime = TimeSpan.FromMilliseconds(0),
Duration = new Duration(TimeSpan.FromMilliseconds(1000))
};
zoom.Completed += HotelZoomCompleted;
var st = new ScaleTransform();
var rt = new RotateTransform(rotateTo, 0, 0);
var group = new TransformGroup();
group.Children.Add(st);
group.Children.Add(rt);
hotelExplorer.Container.WorkingObject.RenderTransform = group;
st.BeginAnimation(ScaleTransform.ScaleXProperty, zoom);
st.BeginAnimation(ScaleTransform.ScaleYProperty, zoom);
st.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation);
}
示例3: btnSpinner_MouseEnter
private void btnSpinner_MouseEnter(object sender, MouseEventArgs e)
{
if (!isSpinning)
{
isSpinning = true;
// Make a double animation object, and register
// with the Completed event.
DoubleAnimation dblAnim = new DoubleAnimation();
dblAnim.Completed += (o, s) => { isSpinning = false; };
// Button has 4 seconds to finish the spin!
dblAnim.Duration = new Duration(TimeSpan.FromSeconds(4));
// Set the start value and end value.
dblAnim.From = 0;
dblAnim.To = 360;
// Now, create a RotateTransform object, and set
// it to the RenderTransform property of our
// button
RotateTransform rt = new RotateTransform();
btnSpinner.RenderTransform = rt;
// Now, animation the RotateTransform object.
rt.BeginAnimation(RotateTransform.AngleProperty, dblAnim);
}
}
示例4: RotateThumb_DragStarted
private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e)
{
this.designerItem = DataContext as ContentControl;
if (this.designerItem != null)
{
this.canvas = VisualTreeHelper.GetParent(this.designerItem) as Canvas;
if (this.canvas != null)
{
this.centerPoint = this.designerItem.TranslatePoint(
new Point(this.designerItem.Width * this.designerItem.RenderTransformOrigin.X,
this.designerItem.Height * this.designerItem.RenderTransformOrigin.Y),
this.canvas);
Point startPoint = Mouse.GetPosition(this.canvas);
this.startVector = Point.Subtract(startPoint, this.centerPoint);
this.rotateTransform = this.designerItem.RenderTransform as RotateTransform;
if (this.rotateTransform == null)
{
this.designerItem.RenderTransform = new RotateTransform(0);
this.initialAngle = 0;
}
else
{
this.initialAngle = this.rotateTransform.Angle;
}
}
}
}
示例5: InitializeComponent
public 一个一级部件(bool trurForAdd_falseForAddAndInsert)
{
//true for added items like 一个一级部件(),一个按钮
//false for inserted items, 两个按钮
InitializeComponent();
桥梁组成一级部件参数 = new 桥梁组成一级部件();
this.DataContext = 桥梁组成一级部件参数;
二级部件集合ListView.DataContext = this;
if (!trurForAdd_falseForAddAndInsert)
{
AddNewItem.MouseLeftButtonUp += DeleteItem;
InsertNewItem.MouseLeftButtonUp += InsertNewItem_MouseLeftButtonUp;
InsertNewItem.Visibility = Visibility.Visible;
RotateTransform rotateTrans = new RotateTransform();
AddNewItem.RenderTransform = rotateTrans;
DoubleAnimation rotateAnim = new DoubleAnimation(45, TimeSpan.FromMilliseconds(300));
rotateTrans.BeginAnimation(RotateTransform.AngleProperty, rotateAnim);
}
else
{
AddNewItem.MouseLeftButtonUp += AddNewItem_MouseLeftButtonUp;
InsertNewItem.MouseLeftButtonUp += InsertNewItem_MouseLeftButtonUp;
}
}
示例6: SetupAnimationForGear
private void SetupAnimationForGear(Canvas gearBox, double ratio, SweepDirection direction)
{
var duration = TimeSpan.FromMilliseconds(30000*ratio);
var animationRotation = new DoubleAnimationUsingKeyFrames
{
Duration = new Duration(duration),
RepeatBehavior = RepeatBehavior.Forever
};
animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(0, KeyTime.FromPercent(0)));
animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(
direction == SweepDirection.Clockwise ? 360 : -360,
KeyTime.FromPercent(1)));
var rotateTransform = new RotateTransform();
gearBox.RenderTransform = rotateTransform;
gearBox.RenderTransformOrigin = new Point(0.5, 0.5);
Storyboard.SetTarget(animationRotation, rotateTransform);
Storyboard.SetTargetProperty(animationRotation, new PropertyPath(RotateTransform.AngleProperty));
animationRotation.Freeze();
_storyBoard.Children.Add(animationRotation);
}
示例7: Update
/// <summary>
/// Updates the canvas information (for if canvas size changes)
/// </summary>
public void Update(Size canvasSize, int gridSize)
{
var previousSize = CanvasSize;
Center = new Point(canvasSize.Width / 2, canvasSize.Height / 2);
RotationTransform = new RotateTransform(45, Center.X, Center.Y);
FlipTransform = new ScaleTransform(1, -1, Center.X, Center.Y);
Transforms = new TransformGroup();
Transforms.Children.Add(RotationTransform);
Transforms.Children.Add(FlipTransform);
RotationTransformReverse = new RotateTransform(-45, Center.X, Center.Y);
TransformsReverse = new TransformGroup();
TransformsReverse.Children.Add(FlipTransform);
TransformsReverse.Children.Add(RotationTransform);
CanvasSize = canvasSize;
Grid = new Size((int)(canvasSize.Width / gridSize), (int)(canvasSize.Height / gridSize));
GridSquareSize = new Size(gridSize, gridSize);
LastCanvas = this;
ClipRegion = new RectangleGeometry(new Rect(new Point(20, 20), new Size(canvasSize.Width - 40, canvasSize.Height - 40)));
if (OnCanvasSizeChanged != null && !previousSize.Equals(CanvasSize))
OnCanvasSizeChanged(previousSize, CanvasSize);
}
示例8: PlaneRotare
//飞机角度改变
public void PlaneRotare(double angle)
{
RotateTransform rt = new RotateTransform(-1 * angle);
rt.CenterX = 0;
rt.CenterY = 20;
this.img_plane.RenderTransform = rt;
}
示例9: rotate
public void rotate()
{
RotateTransform rt = new RotateTransform();
RotateTransform rt2 = new RotateTransform();
if (!rotated)
{
cross1RotateToX.Begin();
cross2RotateToX.Begin();
rt.Angle = 180+45;
rt.CenterX = 1.5;
rt.CenterY = 8;
rt2.Angle = 180+45;
rt2.CenterX = 8;
rt2.CenterY = 1.5;
rotated = true;
}
else
{
cross1RotateToPlus.Begin();
cross2RotateToPlus.Begin();
rt.Angle = 0;
rt2.Angle = 0;
rotated = false;
}
//cross1.RenderTransform = rt;
// cross2.RenderTransform = rt2;
}
示例10: PerformTranstition
public override void PerformTranstition(UserControl newPage, UserControl oldPage)
{
this.newPage = newPage;
this.oldPage = oldPage;
Duration duration = new Duration(time);
DoubleAnimation animation = new DoubleAnimation();
animation.Duration = duration;
animation.To = 90;
Storyboard sb = new Storyboard();
sb.Duration = duration;
sb.Children.Add(animation);
sb.Completed += sb_Completed;
RotateTransform sc = new RotateTransform();
sc.CenterX = centre.X * oldPage.ActualWidth;
sc.CenterY = centre.Y * oldPage.ActualHeight;
oldPage.RenderTransform = sc;
Storyboard.SetTarget(animation, sc);
//Storyboard.SetTargetProperty(animation, "Angle");
Storyboard.SetTargetProperty(animation, new PropertyPath("Angle"));
//oldPage.Resources.Add(sb);
sb.Begin();
}
示例11: AddNewItem_MouseLeftButtonUp
private void AddNewItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
TimeSpan du = TimeSpan.FromMilliseconds(400);
AddOrDeleteButton tb = sender as AddOrDeleteButton;
RotateTransform rotateTrans = new RotateTransform();
tb.RenderTransform = rotateTrans;
DoubleAnimation rotateAnim = new DoubleAnimation(45, du);
rotateTrans.BeginAnimation(RotateTransform.AngleProperty, rotateAnim);
tb.MouseLeftButtonUp -= AddNewItem_MouseLeftButtonUp;
tb.MouseLeftButtonUp += DeleteItem_MouseLeftButtonUp;
DependencyObject dListView = tb;
DependencyObject scrollViewer = tb;
while (!(dListView is 一个二级部件))
{
dListView = VisualTreeHelper.GetParent(dListView);
}
while (!(scrollViewer is ScrollViewer))
{
scrollViewer = VisualTreeHelper.GetParent(scrollViewer);
}
一个二级部件 ListView = dListView as 一个二级部件;
一条指标 ListViewItem = new 一条指标();
ListView.指标集合.Add(ListViewItem);
(scrollViewer as ScrollViewer).ScrollToBottom();
ScaleTransform scaleTransform = new ScaleTransform();
ListViewItem.RenderTransform = scaleTransform;
DoubleAnimation scaleAnim = new DoubleAnimation(0, 1, du);
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnim);
}
示例12: Spinner
public Spinner()
{
var duration = TimeSpan.FromSeconds(1.3);
m_Animation = new DoubleAnimationUsingKeyFrames()
{
RepeatBehavior = RepeatBehavior.Forever,
Duration = duration
};
for (int i = 0; i < c_Blobs; i++)
{
m_Animation.KeyFrames.Add(new DiscreteDoubleKeyFrame(i * 360.0 / c_Blobs, KeyTime.Paced));
}
var rotateTransform = new RotateTransform();
RenderTransform = rotateTransform;
for (int i = 0; i < c_Blobs; i++)
{
var r = (byte)(0xFF - (((0xFF - 0x17) / c_Blobs) * i));
var g = (byte)(0xFF - (((0xFF - 0x7F) / c_Blobs) * i));
var b = (byte)(0xFF - (((0xFF - 0x2E) / c_Blobs) * i));
m_Brushes[i] = new SolidColorBrush(Color.FromRgb(r, g, b));
m_Brushes[i].Freeze();
}
}
示例13: RenderImportanceArrow
private void RenderImportanceArrow(DrawingContext dc, FrameworkElement mostImportant, FrameworkElement leastImportant)
{
var startPoint = FindPoint(mostImportant, new Point(mostImportant.ActualWidth/2, mostImportant.ActualHeight));
var endPoint = FindPoint(leastImportant, new Point(leastImportant.ActualWidth/2, 0));
var vector = Point.Subtract(endPoint, startPoint);
var midPoint = Point.Add(startPoint, Vector.Multiply(vector, 0.66));
Transform arrowTransform = Transform.Identity;
double angle;
if (Math.Abs((angle = Vector.AngleBetween(vector, new Vector(0, -1))) - 0) > double.Epsilon)
{
arrowTransform = new RotateTransform(angle, midPoint.X, midPoint.Y);
}
var line = BuildPath.From(startPoint).LineTo(endPoint.X, endPoint.Y).Build();
var arrow = BuildPath.From(midPoint.X - 3, midPoint.Y - 3).LineTo(midPoint.X, midPoint.Y)
.LineTo(midPoint.X + 3, midPoint.Y - 3).Build();
dc.DrawGeometry(null, _pen, line);
dc.PushTransform(arrowTransform);
dc.DrawGeometry(null, _pen, arrow);
dc.Pop();
}
示例14: ChangeLayoutTransform
private void ChangeLayoutTransform()
{
if (placement == AxisPlacement.Left)
LayoutTransform = new RotateTransform(-90);
else
LayoutTransform = new RotateTransform(90);
}
示例15: Sprite
public Sprite(FrameworkElement content)
{
Content = content;
Width = (float)content.Width;
Height = (float)content.Height;
TranslateTransform = new TranslateTransform();
TranslateTransform.X = 0;
TranslateTransform.Y = 0;
RotateTransform = new RotateTransform();
RotateTransform.CenterX = Origin.X;
RotateTransform.CenterY = Origin.Y;
RotateTransform.Angle = 0;
ScaleTransform = new ScaleTransform();
ScaleTransform.ScaleX = 1;
ScaleTransform.ScaleY = 1;
_transformGroup = new TransformGroup();
_transformGroup.Children.Add(RotateTransform);
_transformGroup.Children.Add(TranslateTransform);
_transformGroup.Children.Add(ScaleTransform);
RenderTransform = _transformGroup;
}