嗨,
我有一个16.4534的浮点数,这是视频持续时间的秒数.我想把它转换成HH:MM:SS所以看起来像00:00:16.
做过搜索但没有找到任何相关的东西.
我需要使用正则表达式吗?
非常感谢.
提前致谢.
我有以下自定义SKAction工作,但作为EaseIn而不是EaseOut.我想要它EaseOut!我使用在网络上找到的各种缓动方程式来纠正它是惨不忍睹的.
let duration = 2.0
let initialX = cameraNode.position.x
let customEaseOut = SKAction.customActionWithDuration(duration, actionBlock: {node, elapsedTime in
let t = Double(elapsedTime)/duration
let b = Double(initialX)
let c = Double(targetPoint.x)
let p = t*t*t*t*t
let l = b*(1-p) + c*p
node.position.x = CGFloat(l)
})
cameraNode.runAction(customEaseOut)
Run Code Online (Sandbox Code Playgroud)
任何帮助都会非常感激.
谢谢
我试图在 SKSpriteNode 上触发一个触摸事件,它的子节点被点击。当它触及子节点时,不会触发事件。我发现了一个 hack 工作,.parent但我觉得这不是最有效或最优雅的方法。
请看下面的代码:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
let touch = touches.first! as UITouch
let location = touch.locationInNode(self)
let node = self.nodeAtPoint(location)
if node is PlanListItem || node.parent is PlanListItem {
for plan in planListItems as [PlanListItem] {
plan.selected = false
}
// Some more code...
}
}
Run Code Online (Sandbox Code Playgroud)
非常感谢帮助。