Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing a SKShapeNode

How do I resize a SKShapeNode?

What I've tried so far:

Frame resize

box.frame.width = 10

Gives the error Cannot assign to the result of this expression

SKAction

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

Nothing happens

xScale

box.xScale = 0.1

Scales the node instead of resizing

like image 576
Oskar Persson Avatar asked Jan 13 '15 20:01

Oskar Persson


1 Answers

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

You can call the action, scaleTo , with SKShapeNode.

like image 128
Reo Yoshida Avatar answered Sep 23 '22 02:09

Reo Yoshida