调整SKShapeNode的大小 [英] Resizing a SKShapeNode

查看:240
本文介绍了调整SKShapeNode的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何调整SKShapeNode的大小?

How do I resize a SKShapeNode?

box.frame.width = 10

给出错误Cannot assign to the result of this expression

let actionResize = SKAction.resizeToWidth(10, duration: NSTimeInterval(0.1))
box.runAction(actionResize)

什么都没发生

box.xScale = 0.1

缩放节点而不是调整大小

Scales the node instead of resizing

推荐答案

动作resizeToWidth可以由SKSpriteNode调用.

The action, resizeToWidth, can be called by an SKSpriteNode.

您可以调用该操作, scaleTo ,使用SKShapeNode.

You can call the action, scaleTo , with SKShapeNode.

这篇关于调整SKShapeNode的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆