如何在给定时间内移动节点?
How to move a node for a given time?
我想知道如何为我分配几秒钟直到下一个动作发生的节点设置动画。
比如按下一个按钮,一个节点开始移动三秒,三秒过去后,屏幕上出现图片或文字。
我应该使用 NSTimer 和 NSTimerInterval 吗?
尝试使用这种相当简单的方法来帮助您管理动画。这个动画需要 3 秒,最后它会执行一个完成处理程序。
UIView.animateWithDuration(3.0, animations: { () -> Void in
//animate object here
}) { (state: Bool) -> Void in
// hide animated object here
}
我想知道如何为我分配几秒钟直到下一个动作发生的节点设置动画。
比如按下一个按钮,一个节点开始移动三秒,三秒过去后,屏幕上出现图片或文字。
我应该使用 NSTimer 和 NSTimerInterval 吗?
尝试使用这种相当简单的方法来帮助您管理动画。这个动画需要 3 秒,最后它会执行一个完成处理程序。
UIView.animateWithDuration(3.0, animations: { () -> Void in
//animate object here
}) { (state: Bool) -> Void in
// hide animated object here
}