标签:lease content summary tps window element 版权 release void
原文:WPF编程,通过Double Animation动态旋转控件的一种方法。
?
/// <summary>
/// 控件绕中心旋转动画
/// </summary>
/// <param name="element">控件名</param>
/// <param name="anglefrom">开始角度</param>
/// <param name="angleto">结束角度</param>
/// <param name="power">过渡强度1为不用过渡</param>
/// <param name="time">持续时间,例如3秒: TimeSpan(0,0,3) </param>
public void AngleEasingAnimationShow(UIElement element, double anglefrom, double angleto,int power,TimeSpan time)
{
RotateTransform angle = new RotateTransform(); //旋转
element.RenderTransform = angle;
//定义圆心位置
element.RenderTransformOrigin = new System.Windows.Point(0.5, 0.5);
//定义过渡动画,power为过度的强度
EasingFunctionBase easeFunction = new PowerEase()
{
EasingMode = EasingMode.EaseInOut,
Power = power
};
DoubleAnimation angleAnimation = new DoubleAnimation()
{
From = anglefrom, //起始值
To = angleto, //结束值
FillBehavior = FillBehavior.HoldEnd,
Duration = time, //动画播放时间
};
angle.BeginAnimation(RotateTransform.AngleProperty, angleAnimation);
}
?
WPF编程,通过Double Animation动态旋转控件的一种方法。
标签:lease content summary tps window element 版权 release void
原文地址:https://www.cnblogs.com/lonelyxmas/p/10729335.html