gpt4 book ai didi

animation - 快速更改带有动画的字体/标签大小

转载 作者:行者123 更新时间:2023-11-28 07:12:01 24 4
gpt4 key购买 nike

当游戏结束代码运行时,我正在编写代码来增加我的标签的大小....这是我目前拥有的

if gameOver == 0 {
movingObjects.speed = 0
gameOver = 1
movingObjects.removeAllChildren()// Remove all enemies
gameOverLabel.fontSize = 43
gameOverLabel.text = "Tap to retry!"
gameOverLabel.position = CGPoint(x: CGRectGetMidX(self.frame), y: CGRectGetMidY(self.frame)*1.5)
labelHolder.addChild(gameOverLabel)
gameOverLabel.zPosition = 9



var pauseScore = SKAction.waitForDuration(0.4)
var moveScore = SKAction.moveToY(CGRectGetMidY(self.frame)*1.2, duration: 0.8)
var resizeScore = SKAction.runBlock({
self.scoreLabel.fontSize = 150
})
var scoreEndSequence = SKAction.sequence([pauseScore, moveScore, resizeScore])
scoreLabel.runAction(scoreEndSequence)


if (UInt(score) > UInt(hScore as NSNumber)) {
NSUserDefaults.standardUserDefaults().setObject(score, forKey: "highscore")
println("Highscore Saved")
} else {
println("Highscore Not Saved")
}

我希望 scoreLabel 也变得更大......现在我已经做到了,但它只是跳到 150 我希望它能够动画化

最佳答案

fontSize 属性似乎不可设置动画。
要修复它,请将您的 holder 更改为 View 对象

关于animation - 快速更改带有动画的字体/标签大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28121950/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com