【发布时间】:2014-11-02 14:31:36
【问题描述】:
我正在尝试使用 WPF 中的 DoubleAnimation 类来制作基本动画。在按钮上单击矩形旋转。 cs代码是
DoubleAnimation da = new DoubleAnimation();
da.From = 0; // start from 0 to 360, full circle
da.To = 360;
da.Duration = new Duration(TimeSpan.FromSeconds(0.5));
da.RepeatBehavior = RepeatBehavior.Forever;
RotateTransform rt = new RotateTransform();
rectangle1.RenderTransform = rt;
rt.BeginAnimation(RotateTransform.AngleProperty, da);
我要做的是用滑块值更新da.Duration = new Duration(TimeSpan.FromSeconds(0.5)) 值。
尝试使用滑块值绑定,但无法正确获取。
【问题讨论】: