本文整理汇总了C#中System.Windows.Media.RotateTransform.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# RotateTransform.BeginAnimation方法的具体用法?C# RotateTransform.BeginAnimation怎么用?C# RotateTransform.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.RotateTransform
的用法示例。
在下文中一共展示了RotateTransform.BeginAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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;
}
}
示例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: MainWindow
public MainWindow()
{
InitializeComponent();
DoubleAnimation da = new DoubleAnimation(360, 0, new Duration(TimeSpan.FromSeconds(9)));
RotateTransform rt = new RotateTransform();
da.RepeatBehavior = RepeatBehavior.Forever;
rt.BeginAnimation(RotateTransform.AngleProperty, da);
}
示例5: AddItem
public void AddItem(UIElement item)
{
Util.RequireNotNull(item, "item");
Util.RequireArgument(VisualTreeHelper.GetParent(item) == null, "item", "item should not have a parent");
m_elements.Add(item);
this.AddVisualChild(item);
this.InvalidateMeasure();
item.RenderTransformOrigin = new Point(.5, .5);
TransformGroup group = new TransformGroup();
group.Children.Add(new ScaleTransform(.6, .6));
ScaleTransform animatedScale = new ScaleTransform();
group.Children.Add(animatedScale);
RotateTransform rotateTransform = new RotateTransform();
group.Children.Add(rotateTransform);
group.Children.Add(new TranslateTransform());
item.RenderTransform = group;
if (m_elements.Count >= c_maxCount)
{
int oldestCount = m_elements.Count - c_maxCount;
for (int i = 0; i < oldestCount; i++)
{
UIElement oldest = m_elements[0];
m_fadingElements.Add(oldest);
m_elements.RemoveAt(0);
DoubleAnimation fadeOut = GetFadeOutAnimation();
fadeOut.Completed += delegate(object sender, EventArgs e)
{
m_fadingElements.Remove(oldest);
this.RemoveVisualChild(oldest);
};
oldest.BeginAnimation(UIElement.OpacityProperty, fadeOut);
}
}
DoubleAnimation rotationAnimation = GetRandomRotateAnimation();
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, rotationAnimation);
DoubleAnimation fadeIn = GetFadeInAnimation();
item.BeginAnimation(UIElement.OpacityProperty, fadeIn);
DoubleAnimation shrink = GetShrinkAnimation();
animatedScale.BeginAnimation(ScaleTransform.ScaleXProperty, shrink);
animatedScale.BeginAnimation(ScaleTransform.ScaleYProperty, shrink);
}
示例6: RotateRectOne
private void RotateRectOne(object sender, RoutedEventArgs e)
{
var rotateAnimation = new DoubleAnimation(0, 360, new Duration(new TimeSpan(0, 0, 5)), FillBehavior.Stop);
var scaleAnimation = new DoubleAnimation(1, 2, new Duration(new TimeSpan(0, 0, 5)), FillBehavior.HoldEnd);
var transformGroup = new TransformGroup();
var rotateTransform = new RotateTransform();
var scaleTransform = new ScaleTransform();
transformGroup.Children.Add(rotateTransform);
transformGroup.Children.Add(scaleTransform);
this.RectOne.LayoutTransform = transformGroup;
Storyboard.SetTarget(rotateAnimation, rotateTransform);
Storyboard.SetTarget(scaleAnimation, scaleTransform);
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation);
rotateTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
}
示例7: StartAnim
public void StartAnim()
{
RotateTransform rt = new RotateTransform();
StatusImage.RenderTransform = rt;
DoubleAnimation anim = new DoubleAnimation();
anim.By = 360;
anim.Duration = TimeSpan.FromSeconds(1);
anim.RepeatBehavior = RepeatBehavior.Forever;
StatusImage.RenderTransform = rt;
rt.BeginAnimation(RotateTransform.AngleProperty, anim);
}
示例8: Calculator
public Calculator(Canvas canvas)
{
InitializeComponent();
myCanvas = canvas;
Canvas.SetZIndex(this, 1);
DoubleAnimation da = new DoubleAnimation(360, 0, new Duration(TimeSpan.FromSeconds(9)));
RotateTransform rt = new RotateTransform();
da.RepeatBehavior = RepeatBehavior.Forever;
rt.BeginAnimation(RotateTransform.AngleProperty, da);
}
示例9: Rotate
private void Rotate()
{
var animation = new DoubleAnimation();
animation.From = 0;
animation.To = 360;
animation.Duration = new Duration(TimeSpan.FromSeconds(1.5));
animation.RepeatBehavior = RepeatBehavior.Forever;
var rt = new RotateTransform();
this.RenderTransformOrigin = new Point(0.5, 0.5);
this.RenderTransform = rt;
rt.BeginAnimation(RotateTransform.AngleProperty, animation);
}
示例10: PopupWaiter
public PopupWaiter()
{
InitializeComponent();
this.WindowStyle = System.Windows.WindowStyle.None;
this.ResizeMode = System.Windows.ResizeMode.NoResize;
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
DoubleAnimation da = new DoubleAnimation();
da.From = 0;
da.To = 360;
da.Duration = new Duration(TimeSpan.FromSeconds(3));
da.RepeatBehavior = RepeatBehavior.Forever;
RotateTransform rt = new RotateTransform();
imageWaiting.RenderTransform = rt;
imageWaiting.RenderTransformOrigin = new Point(0.5, 0.5);
rt.BeginAnimation(RotateTransform.AngleProperty, da);
}
示例11: Manager
private Manager()
{
#region Create Loading Threads
for (int i = 0; i < MaxThreads; i++)
{
Thread loaderThread = new Thread(LoaderWork)
{
IsBackground = true,
Priority = ThreadPriority.BelowNormal,
Name = $"ImageLoaderThread{i + 1}"
};
loaderThread.Start();
}
#endregion
#region Load Images from Resources
ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionary.Source = new Uri("ImageLoader;component/Resources.xaml", UriKind.Relative);
_loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
_loadingImage?.Freeze();
_errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
_errorThumbnail?.Freeze();
#endregion
# region Create Loading Animation
ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
SkewTransform skewTransform = new SkewTransform(0, 0);
RotateTransform rotateTransform = new RotateTransform(0);
TranslateTransform translateTransform = new TranslateTransform(0, 0);
TransformGroup group = new TransformGroup();
group.Children.Add(scaleTransform);
group.Children.Add(skewTransform);
group.Children.Add(rotateTransform);
group.Children.Add(translateTransform);
DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1))
{
RepeatBehavior = RepeatBehavior.Forever
};
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);
_loadingAnimationTransform = group;
#endregion
}
示例12: Manager
private Manager()
{
#region Creates Loading Threads
_loaderThreadForThumbnails = new Thread(new ThreadStart(LoaderThreadThumbnails));
_loaderThreadForThumbnails.IsBackground = true; // otherwise, the app won't quit with the UI...
_loaderThreadForThumbnails.Priority = ThreadPriority.BelowNormal;
_loaderThreadForThumbnails.Start();
_loaderThreadForNormalSize = new Thread(new ThreadStart(LoaderThreadNormalSize));
_loaderThreadForNormalSize.IsBackground = true; // otherwise, the app won't quit with the UI...
_loaderThreadForNormalSize.Priority = ThreadPriority.BelowNormal;
_loaderThreadForNormalSize.Start();
#endregion
#region Loading Images from Resources
ResourceDictionary resourceDictionary = new ResourceDictionary();
resourceDictionary.Source = new Uri("/ByteFlood;component/Controls/PhotoLoader/Resources.xaml", UriKind.Relative);
_loadingImage = resourceDictionary["ImageLoading"] as DrawingImage;
_loadingImage.Freeze();
_errorThumbnail = resourceDictionary["ImageError"] as DrawingImage;
_errorThumbnail.Freeze();
#endregion
# region Create Loading Animation
ScaleTransform scaleTransform = new ScaleTransform(0.5, 0.5);
SkewTransform skewTransform = new SkewTransform(0, 0);
RotateTransform rotateTransform = new RotateTransform(0);
TranslateTransform translateTransform = new TranslateTransform(0, 0);
TransformGroup group = new TransformGroup();
group.Children.Add(scaleTransform);
group.Children.Add(skewTransform);
group.Children.Add(rotateTransform);
group.Children.Add(translateTransform);
DoubleAnimation doubleAnimation = new DoubleAnimation(0, 359, new TimeSpan(0, 0, 0, 1));
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation);
_loadingAnimationTransform = group;
#endregion
}
示例13: InitializeComponent
public 一条指标(bool b)
{
//true for Add
//false for Delete
InitializeComponent();
检查指标参数 = new 检查指标();
this.DataContext = 检查指标参数;
标度及其说明集合ListView.DataContext = this;
if (b == false)
{
RotateTransform rotateTrans = new RotateTransform();
AddNewItem.RenderTransform = rotateTrans;
DoubleAnimation rotateAnim = new DoubleAnimation(45, TimeSpan.FromMilliseconds(300));
rotateTrans.BeginAnimation(RotateTransform.AngleProperty, rotateAnim);
AddNewItem.MouseLeftButtonUp -= AddNewItem_MouseLeftButtonUp;
AddNewItem.MouseLeftButtonUp += DeleteItem_MouseLeftButtonUp;
}
else
{
AddNewItem.MouseLeftButtonUp += AddNewItem_MouseLeftButtonUp;
}
}
示例14: OnRender
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
{
base.OnRender(drawingContext);
if (IsBusy)
{
var centerX = ActualWidth / 2;
var centerY = ActualHeight / 2;
var drawing = new DrawingGroup();
var radius = 30.0;
var ballSize = 10.0;
var transform = new RotateTransform();
for (double i = 0; i < 8; ++i)
{
var color = (byte)(double)(((1.0 - i / 8.0) * 255.0));
drawing.Children.Add(
new GeometryDrawing(
new SolidColorBrush(Color.FromArgb(255, color, color, color)),
null,
new EllipseGeometry(
new Point(
centerX + radius * Math.Cos((Math.PI * 2 / 8.0) * i),
centerY + radius * Math.Sin((Math.PI * 2 / 8.0) * i)),
ballSize, ballSize)));
}
transform.CenterX = centerX;
transform.CenterY = centerY;
transform.BeginAnimation(RotateTransform.AngleProperty,
new DoubleAnimation(0, 360, new Duration(TimeSpan.FromSeconds(1.5)))
{
RepeatBehavior = RepeatBehavior.Forever,
});
drawing.Transform = transform;
drawingContext.DrawDrawing(drawing);
}
}
示例15: ThirdAnimationForthBullStart
private void ThirdAnimationForthBullStart(object sender, EventArgs e)
{
(sender as DispatcherTimer).Stop();
double oldLeft = bull4.Margin.Left;
double oldRight = bull4.Margin.Right;
double oldTop = bull4.Margin.Top;
double oldBottom = bull4.Margin.Bottom;
bull4.RenderTransformOrigin = new Point(0, 0.5);
bull4.Margin = new Thickness(oldLeft - 13, oldTop + 48, oldRight + 13, oldBottom);
DoubleAnimation rotate = new DoubleAnimation();
rotate.From = -45;
rotate.To = -30;
rotate.AutoReverse = false;
rotate.Duration = new Duration(TimeSpan.FromSeconds(0.250));
RotateTransform rt = new RotateTransform();
DoubleAnimation translate = new DoubleAnimation();
translate.From = 0;
translate.To = 7;
translate.AutoReverse = false;
translate.Duration = new Duration(TimeSpan.FromSeconds(0.250));
TranslateTransform tt = new TranslateTransform();
TransformGroup tg = new TransformGroup();
tg.Children.Add(rt);
tg.Children.Add(tt);
bull4.RenderTransform = tg;
rt.BeginAnimation(RotateTransform.AngleProperty, rotate);
tt.BeginAnimation(TranslateTransform.YProperty, translate);
}