本文整理汇总了C#中System.Windows.Window.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# Window.BeginAnimation方法的具体用法?C# Window.BeginAnimation怎么用?C# Window.BeginAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Window
的用法示例。
在下文中一共展示了Window.BeginAnimation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewWIdowsSlidFront
public void NewWIdowsSlidFront(Window panal, double centerlocation, double duration)
{
DoubleAnimation slider = new DoubleAnimation();
slider.To = centerlocation;
slider.DecelerationRatio = .7;
slider.From = -panal.Width - 100;
slider.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
panal.BeginAnimation(Window.LeftProperty, slider);
}
示例2: HideWindow
/// <summary>
/// 隐藏窗口
/// </summary>
/// <param name="window">要隐藏的窗口</param>
public void HideWindow(Window window)
{
ObjectAnimationUsingKeyFrames visAni = new ObjectAnimationUsingKeyFrames();
visAni.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.3))));
window.BeginAnimation(Window.VisibilityProperty, visAni);
DoubleAnimationUsingKeyFrames alphaAni = new DoubleAnimationUsingKeyFrames();
CubicEase ef = new CubicEase();
alphaAni.KeyFrames.Add(new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)), ef));
alphaAni.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.3)), ef));
window.BeginAnimation(Window.OpacityProperty, alphaAni);
}
示例3: animateWindowHeight
/// <summary>
/// Animates the window's height
/// </summary>
/// <param name="window">The window to animate</param>
/// <param name="height">The height to animate the window to</param>
/// <param name="duration">The duration for the animation</param>
/// <param name="callback">An optional callback to be executed when the animation finishes</param>
private void animateWindowHeight(Window window, double height, double duration, Action callback = null)
{
window.BeginInit();
window.Dispatcher.BeginInvoke((Action)(() =>
{
DoubleAnimation windowAnimation = new DoubleAnimation();
windowAnimation.Duration = new Duration(TimeSpan.FromSeconds(duration));
windowAnimation.From = window.Height;
windowAnimation.To = height;
windowAnimation.FillBehavior = FillBehavior.HoldEnd;
//If a callback is passed, execute it using a lambda expression
if (callback != null)
{
windowAnimation.Completed += (s, e) => callback();
}
window.BeginAnimation(Window.HeightProperty, windowAnimation);
}), null);
window.EndInit();
}
示例4: Animate
public static void Animate(Window _this, float _time, float from, float to, DependencyProperty property , bool isClosing)
{
DoubleAnimation da = new DoubleAnimation(from, to, new Duration(TimeSpan.FromSeconds(_time)));
da.Completed += (s, e) =>
{
_this.Close();
};
_this.BeginAnimation(property, da);
}
示例5: WIdowsSlidBack
public void WIdowsSlidBack(Window panal, double duration)
{
DoubleAnimation slider = new DoubleAnimation();
slider.To = -panal.Width - 100;
slider.From = panal.Left;
slider.AccelerationRatio = .4;
slider.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
panal.BeginAnimation(Window.LeftProperty, slider);
}