gpt4 book ai didi

ios - SpriteKit 中的 CGAffineTransform

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

我试图在 SKLabelNode 上调用 CGAffineTransformMakeScale。但是,当我尝试构建应用程序时收到错误消息:

Property 'transform' not found on object of type 'SKLabelNode *'

这是我的代码:

self.scoreLabel.transform = CGAffineTransformMakeScale(0.8,0.8);

[UIView beginAnimations:@"button" context:nil];
[UIView setAnimationDuration:0.5];
self.scoreLabel.transform = CGAffineTransformMakeScale(1,1);
[UIView commitAnimations];

我不确定这是否是使用 SpriteKit 执行此操作的正确方法;我以前用过这是一个运行 UIKit 的应用程序。提前感谢您的帮助。

最佳答案

您应该使用 SKAction 并将操作应用于节点。

SKAction *a = [SKAction scaleTo: 0.8 duration: 4];
[scoreLabel runAction: a];

这将在 4 秒内缩小标签。

关于ios - SpriteKit 中的 CGAffineTransform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24417268/

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