1
我正在制作一个游戏,当用户进行移动时,源和目标方块在动画中点亮。动画持续时间为1秒。如何突然结束动画?
问题是,当用户轻触向前按钮时,所有的源和目标方块亮起,导致由于在第一个动画结束之前开始的第二个动画而发生许多亮方块。
如何在动画持续时间未结束时突然结束动画。
动画功能代码: -
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:value];
[UIView setAnimationRepeatCount:1];
// [UIView setAnimationRepeatAutoreverses:YES];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(src+1)+2000].backgroundColor=[UIColor clearColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor orangeColor];
[self.view viewWithTag:(dest+1)+2000].backgroundColor=[UIColor clearColor];
[UIView commitAnimations];
注: - 我接受下来表决了有益的批评方式,但做写作的原因,这样我可以提高
4分钟...非常计算:)并且提升它,以便它在将来帮助人们。谢谢 –
多数民众赞成什么stackoverflow说:) – amar
好吧,@amar如果可能的话,upvote它也可以帮助其他用户搜索相同的问题,增加答案的完整性。再次感谢 :) –