小编sha*_*taf的帖子

将秒转换为HH:MM:SS

可能重复:
用javascript将秒转换为HH-MM-SS?

嗨,

我有一个16.4534的浮点数,这是视频持续时间的秒数.我想把它转换成HH:MM:SS所以看起来像00:00:16.

做过搜索但没有找到任何相关的东西.

我需要使用正则表达式吗?

非常感谢.

提前致谢.

javascript time

19
推荐指数
1
解决办法
4万
查看次数

使用自定义SKAction的EaseOut操作

我有以下自定义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)

任何帮助都会非常感激.

谢谢

ios sprite-kit skaction swift

6
推荐指数
2
解决办法
784
查看次数

带有子节点的 SKSpriteNode 的触摸检测

我试图在 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)

非常感谢帮助。

ios sprite-kit swift

4
推荐指数
1
解决办法
778
查看次数

标签 统计

ios ×2

sprite-kit ×2

swift ×2

javascript ×1

skaction ×1

time ×1