无法正确执行动画 [英] Cannot perform an animation correctly

查看:71
本文介绍了无法正确执行动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试给圆设置动画以旋转指定值,并创建了一种方法来运行序列.
但是,如果我在测试模拟控件中添加了两个调用,则其中一个将被忽略. (第一个)

Hi All,

I am trying to animate a circle to rotate by a specified value and have created a method to run a sequence.
However if I add two calls to my test simulation control one of them is ignored. (The First)

private void RunCaptureSequence()
{
    testSimulationControl1.MoveTo(Convert.ToInt32(tbDegrees.Text), cbClockwise.Checked, 500);
    testSimulationControl1.MoveTo(Convert.ToInt32(tbDegrees.Text), !cbClockwise.Checked, 500);
}



每个方法都会执行一个小的动画,您知道每个方法如何被调用而不被跳过吗?

注意:MoveTo(int度,顺时针bool,int durationInMs)

谢谢George



Each method carries out a small animation, do you know how every method can be called and not skipped?

Note : MoveTo(int degrees, bool clockwise, int durationInMs)

Thanks George

推荐答案

也许不被忽略吗?也许相反,在您有机会在第一个位置看到它之前,第二个呼叫将其移动到新位置...

尝试将呼叫放入计时器,然后每十分之一秒执行(说)一次移动. (电影/AVI通常约为每秒25帧).
Perhaps it is not being ignored? Perhaps instead, the second call moves it to the new location before you get a chance to see it in the first location...

Try putting you calls into a timer, and doing (say) one move every tenth of a second. (Movie / AVI is generally around 25 frames per second).
    Timer t = new Timer()
    t.Interval = 100;
    t.Tick +=new EventHandler(t_Tick);
    t.Start();
    ...


void t_Tick(object sender, EventArgs e)
    {
    testSimulationControl1.MoveTo(Convert.ToInt32(tbDegrees.Text), cbClockwise.Checked, 500);
    }


您必须允许进行绘画操作.如果添加三个呼叫,将忽略两个,以此类推...只有一个(最后一个)有效.因此,您应该使用计时器来执行类似的操作.或使用丑陋的技巧,例如调用testSimulationControl1.Invalidate并可能进入睡眠状态,因为眨眼后您仍然看不到它.

祝你好运!
You have to allow for a paint action to come along. If you would add three calls there would be two ignored, etc... Only one (the last one) has effect. So you should use a timer to do something like this. Or use an ugly hack like calling testSimulationControl1.Invalidate and maybe put in a sleep because you still wouldn''t see it if you blinked.

Good luck!


乔治,
只是以该方法的名称命名,我会说第二次调用不执行任何操作,因为该控件已经移至(MoveTo)指定角度.
如果该函数的语义确实是移至"而不是移至",我希望它的行为与您观察到的完全相同:
试试下面的代码,看看会发生什么:

Hi George,
just going by the name of that method I''d say the second call doesn''t do anything because the control already moved to (MoveTo) the specified angle.
If the semantic of that function really is "move to" and not "move by" I''d expect it to behave exactly as you observed:
Try this code to see what happens then:

private void RunCaptureSequence()
{
    testSimulationControl1.MoveTo(Convert.ToInt32(tbDegrees.Text), cbClockwise.Checked, 500);
    testSimulationControl1.MoveTo(0, !cbClockwise.Checked, 500);
}



如果MoveTo方法的语义是移至",则圆圈应首先旋转为tbDegrees.Text,然后以顺时针方式转换为文本,然后以逆时针方式返回零度.

最好的问候,
曼弗雷德(Manfred)



If the semantic of the MoveTo method is "move to" the circle should turn to an angle of tbDegrees.Text in clockwise fashion first and then back to zero degrees in a counterclockwise fashion.

Best Regards,
Manfred


这篇关于无法正确执行动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆