Creates an action that changes the mass of a node’s physics body by a relative value.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Sprite
Kit
Declaration
class func changeMass(by v: Float, duration: Time Interval) -> SKAction
Parameters
v
The amount to add to the physics body’s mass.
duration
The duration of the animation.
Return Value
A new action object.
Discussion
When the action executes, the physics body’s mass
property animates from its current value to its new value.
This action is reversible; the reverse is created as if the following code is executed:
let action = SKAction.changeMass(by: -v, duration: sec)