Modifier

Partager via


SKAction Class

Definition

Modifies properties on a SKNode, often animating the changes. Sometimes reversible.

[Foundation.Register("SKAction", true)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 9, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public class SKAction : Foundation.NSObject, Foundation.INSCopying, Foundation.INSSecureCoding, IDisposable
type SKAction = class
    inherit NSObject
    interface INSCoding
    interface INativeObject
    interface IDisposable
    interface INSCopying
    interface INSSecureCoding
Inheritance
SKAction
Attributes
Implements

Remarks

Application developers use the static methods of SKAction to create actions that can be applied to the SKNodes of a SKScene. Generally, animations are animated.

The Group(SKAction[]), M:SpriteKit.MKAction.RepeatAction* and RepeatActionForever(SKAction), and Sequence(SKAction[]) methods are composite actions that take, as parameters, children SKActions.

Once a SKAction is created, application developers run it with the RunActionAsync(SKAction) method, as shown in this example:

var actions = SKAction.Group(
	new SKAction[] {
		SKAction.MoveBy(new CGVector(10, 10), 1),
		SKAction.FadeAlphaTo(0.3f, 1),
		SKAction.ScaleBy(0.8f, 1)
});

b.Node.RunAction(actions);          

Constructors

SKAction(IntPtr)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

SKAction(NSCoder)

A constructor that initializes the object from the data stored in the unarchiver object.

SKAction(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

Class (Inherited from NSObject)
ClassHandle

The handle for this class.

DebugDescription

A developer-meaningful description of this object.

(Inherited from NSObject)
Description

Description of the object, the Objective-C version of ToString.

(Inherited from NSObject)
Duration

Gets or sets the expected duration of the animation action when its speed is set to 1.

Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
RetainCount

Returns the current Objective-C retain count for the object.

(Inherited from NSObject)
ReversedAction

Gets a reversed action for the action on which it is run. (For actions that cannot be reversed, the returned action will be the identical action.)

Self (Inherited from NSObject)
Speed

Gets or sets a multiplier for the action's speed.

Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
TimingFunction
Obsolete.

Gets or sets a function that transforms wall clock time before it is passed to the animation.

TimingFunction2
TimingMode

Gets or sets the timing mode, which controls whether the animation time proceeds linearly, eases in, eases out, or eases in and out.

Zone (Inherited from NSObject)

Methods

AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using NSString keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using string keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
Animate(SKWarpGeometry[], NSNumber[], Boolean)

Creates and returns an action that distorts a node through the provided geometries at the specified times.

Animate(SKWarpGeometry[], NSNumber[])

Creates and returns an action that distorts a node through the provided geometries at the specified times.

AnimateWithNormalTextures(SKTexture[], Double, Boolean, Boolean)

Factory method to create a SKAction that animates changes to a SKSpriteNode object's NormalTexture.

AnimateWithNormalTextures(SKTexture[], Double)

Factory method to create a SKAction that animates changes to a SKSpriteNode object's NormalTexture.

AnimateWithTextures(SKTexture[], Double, Boolean, Boolean)

Creates an action that sequentially replaces the Texture property of the SKSpriteNode on which it is run with each texture that is contained in textures, every sec seconds, resizing the sprite to match the current texture size if resize is set to true.

AnimateWithTextures(SKTexture[], Double)

Creates an action that sequentially replaces Texture property of SKSpriteNode on which it is run with each texture that is contained in textures, every sec seconds.

AwakeFromNib()

Called after the object has been loaded from the nib file. Overriders must call base.AwakeFromNib().

(Inherited from NSObject)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
Bind(String, NSObject, String, NSDictionary)
Obsolete.
(Inherited from NSObject)
BindingInfo(String)
Obsolete.
(Inherited from NSObject)
BindingOptionDescriptions(String)
Obsolete.
(Inherited from NSObject)
BindingValueClass(String)
Obsolete.
(Inherited from NSObject)
ColorizeWithColor(NSColor, nfloat, Double)
ColorizeWithColor(UIColor, nfloat, Double)
ColorizeWithColorBlendFactor(nfloat, Double)
CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
ConformsToProtocol(IntPtr)

Invoked to determine if this object implements the specified protocol.

(Inherited from NSObject)
Copy()

Performs a copy of the underlying Objective-C object.

(Inherited from NSObject)
Copy(NSZone)

Performs a copy of the underlying Objective-C object.

Create(String, Double)

Factory method to create a SKAction with the specified name, of the specified duration, in seconds.

Create(String, NSUrl, Double)

Factory method to create a SKAction with the specified name, as defined in the action file located at url.

Create(String, NSUrl)

Factory method to create a SKAction with the specified name, as defined in the action file located at url.

Create(String)

Factory method to create a SKAction with the specified name.

CreateApplyAngularImpulse(nfloat, Double)
CreateApplyForce(CGVector, CGPoint, Double)
CreateApplyForce(CGVector, Double)

Factory method to create a SKAction that applies force to the center of gravity of a SKNode object's PhysicsBody.

CreateApplyImpulse(CGVector, CGPoint, Double)
CreateApplyImpulse(CGVector, Double)

Factory method to create a SKAction that applies the specified impulse to the center of gravity of a SKNode object's PhysicsBody.

CreateApplyTorque(nfloat, Double)
CreateChangeChargeBy(Single, Double)

Factory method to create a SKAction that changes the Charge by the specified amount of a SKNode object's PhysicsBody.

CreateChangeChargeTo(Single, Double)

Factory method to create a SKAction that changes the Charge the specified of a SKNode object's PhysicsBody to newCharge.

CreateChangeMassBy(Single, Double)

Alters the Mass of a SKPhysicsBody by the specified amount.

CreateChangeMassTo(Single, Double)

Sets to newMass the Mass of a SKPhysicsBody by the specified amount.

CreateChangeObstructionBy(Single, Double)

Changes the obstruction of an SKAudioNode.

CreateChangeObstructionTo(Single, Double)

Sets the obstruction of an SKAudioNode.

CreateChangeOcclusionBy(Single, Double)

Changes the occlusion of a SKAudioNode.

CreateChangeOcclusionTo(Single, Double)

Sets the occlusion of a SKAudioNode.

CreateChangePlaybackRate(Single, Double)

Sets the playback speed of an SKAudioNode.

CreateChangePlaybackRateBy(Single, Double)

Changes the playback speed of an SKAudioNode.

CreateChangeReverbBy(Single, Double)

Changes the reverb of an SKAudioNode.

CreateChangeReverbTo(Single, Double)

Sets the reverb of an SKAudioNode.

CreateChangeVolume(Single, Double)

Sets the volume of a SKAudioNode.

CreateChangeVolumeBy(Single, Double)

Changes the volume of an SKAudioNode.

CreatePause()

Factory method to create an SKAction that pauses playback of an audio node.

CreatePlay()

Factory method to create an SKAction that begins playback of an audio node.

CreateStereoPanBy(Single, Double)

Factory method to create an SKAction that modifies the stereo panning of a SKAudioNode.

CreateStereoPanTo(Single, Double)

Factory method to create an SKAction that sets the stereo panning of a SKAudioNode.

CreateStop()

Factory method to create an SKAction that stops and resets the playback of a SKAudioNode.

CustomActionWithDuration(Double, SKActionDurationHandler)

A custom action that repeats for some amount of time.

DangerousAutorelease() (Inherited from NSObject)
DangerousRelease() (Inherited from NSObject)
DangerousRetain() (Inherited from NSObject)
DidChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates a change occurred to the indexes for a to-many relationship.

(Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeValue(String)

Indicates that a change occurred on the specified key.

(Inherited from NSObject)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the NSObject object.

(Inherited from NSObject)
DoesNotRecognizeSelector(Selector)

Indicates that this object does not recognize the specified selector.

(Inherited from NSObject)
EncodeTo(NSCoder)

Encodes the state of the object on the provided encoder

Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
ExposedBindings() (Inherited from NSObject)
FadeAlphaBy(nfloat, Double)
FadeAlphaTo(nfloat, Double)
FadeInWithDuration(Double)

Creates an action that changes the alpha channel of the Color property on the SKSpriteNode on which it is run to 1, over sec seconds.

FadeOutWithDuration(Double)

Creates an action that changes the alpha channel of the Color property on the SKSpriteNode on which it is run to 0, over sec seconds.

Falloff(Single, Double)
Obsolete.

Creates an action that changes the Falloff property of the SKFieldNode to which is applied to the specified value over sec seconds.

FalloffBy(Single, Double)

Returns an action that animates the rate at which the effect of a physics field is reduced by distance.

FalloffTo(Single, Double)

Returns an action that animates the rate at which the effect of a physics field is reduced by distance.

FollowPath(CGPath, Boolean, Boolean, Double)

Creates an action that moves the SKNode on which it is run over the path, with the specified offset and orientation, taking sec seconds.

FollowPath(CGPath, Boolean, Boolean, nfloat)

Creates an action that moves the SKNode on which it is run over the path, with the specified offset, orientation, and speed.

FollowPath(CGPath, Double)

Creates an action that moves the SKNode on which it is run over the path, taking sec seconds.

FollowPath(CGPath, nfloat)

Creates an action that moves the SKNode on which it is run over the path, at the specified speed.

GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetDictionaryOfValuesFromKeys(NSString[])

Retrieves the values of the specified keys.

(Inherited from NSObject)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeField(String)
Obsolete.
(Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
Group(SKAction[])

Creates an action that starts a list of actions at the same time.

Hide()

Creates an action that hides the SKNode on which it is run.

Init() (Inherited from NSObject)
InitializeHandle(IntPtr, String) (Inherited from NSObject)
InitializeHandle(IntPtr) (Inherited from NSObject)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MoveBy(CGVector, Double)

Creates an action that moves the SKNode on which it is run in the magnitude and direction of delta, over duration seconds.

MoveBy(nfloat, nfloat, Double)
MoveTo(CGPoint, Double)
MoveToX(nfloat, Double)
MoveToY(nfloat, Double)
MutableCopy()

Creates a mutable copy of the specified NSObject.

(Inherited from NSObject)
ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

Indicates that the value at the specified keyPath relative to this object has changed.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double)

Invokes the selector on the current instance and if the obj is not null, it passes this as its single parameter.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject)

Creates an action that runs selector on target.

PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector) (Inherited from NSObject)
PlaySoundFileNamed(String, Boolean)

Plays the sound file that is located in the app's bundle and is named soundFile, setting the action duration to the length of the sound file if wait is set to true.

PrepareForInterfaceBuilder() (Inherited from NSObject)
ReachTo(CGPoint, SKNode, Double)
ReachTo(CGPoint, SKNode, nfloat)
ReachToNode(SKNode, SKNode, Double)

Creates an action that moves the node to which it is applied by rotating it, along with all nodes between it and rootNode, so that it is closer to node, over sec seconds.

ReachToNode(SKNode, SKNode, nfloat)

Creates an action that moves the node to which it is applied by rotating it, along with all nodes between it and rootNode, so that it is closer to node, in a way that moves the node at the speed that is specified by velocity.

RemoveFromParent()

Creates an action that removes the node on which it is run from its parent.

RemoveObserver(NSObject, NSString, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, NSString)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, String)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RepeatAction(SKAction, nuint)

Creates an action that repeats action a specified number of times on the node on which it is run.

RepeatActionForever(SKAction)

Creates an action that forever repeats action on the node on which it is run.

ResizeByWidth(nfloat, nfloat, Double)
ResizeTo(CGSize, Double)
ResizeTo(nfloat, nfloat, Double)
ResizeToHeight(nfloat, Double)
ResizeToWidth(nfloat, Double)
RespondsToSelector(Selector)

Whether this object recognizes the specified selector.

(Inherited from NSObject)
RotateByAngle(nfloat, Double)
RotateToAngle(nfloat, Double, Boolean)
RotateToAngle(nfloat, Double)
Run(Action, DispatchQueue)

Creates an action that runs another action on a dispatch queue.

Run(Action)

Creates an action that runs another action on a node.

RunAction(SKAction, String)

Creates an action that runs another action on a named child of a node.

ScaleBy(nfloat, Double)
ScaleBy(nfloat, nfloat, Double)
ScaleTo(CGSize, Double)
ScaleTo(nfloat, Double)
ScaleTo(nfloat, nfloat, Double)
ScaleXTo(nfloat, Double)
ScaleYTo(nfloat, Double)
Sequence(SKAction[])

Creates an action that sequentially runs the actions in the specified array.

SetNativeField(String, NSObject)
Obsolete.
(Inherited from NSObject)
SetNilValueForKey(NSString)

Sets the value of the specified key to null.

(Inherited from NSObject)
SetNormalTexture(SKTexture, Boolean)

Factory method that creates a SKAction that changes the NormalTexture of a SKSpriteNode.

SetNormalTexture(SKTexture)

Factory method that creates a SKAction that changes the NormalTexture of a SKSpriteNode.

SetTexture(SKTexture, Boolean)

Creates an action that sets and resizes the texture on the node on which it is run.

SetTexture(SKTexture)

Creates an action that sets the texture on the node on which it is run.

SetTimingFunction(SKActionTimingFunction)
Obsolete.

Sets the function that transforms the times at which actions occur.

SetValueForKey(NSObject, NSString)

Sets the value of the property specified by the key to the specified value.

(Inherited from NSObject)
SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

(Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

(Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString)

Indicates an attempt to write a value to an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

Sets the values of this NSObject to those in the specified dictionary.

(Inherited from NSObject)
SpeedBy(nfloat, Double)
SpeedTo(nfloat, Double)
StrengthBy(Single, Double)

Creates an action that adds strength to the Strength property of the SKFieldNode to which is applied, over sec seconds.

StrengthTo(Single, Double)

Creates an action that changes the Strength property of the SKFieldNode to which is applied to the specified value over sec seconds.

ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
Unbind(NSString) (Inherited from NSObject)
Unbind(String)
Obsolete.
(Inherited from NSObject)
Unhide()

Creates an action that unhides, or shows, a node.

ValueForKey(NSString)

Returns the value of the property associated with the specified key.

(Inherited from NSObject)
ValueForKeyPath(NSString)

Returns the value of a property that can be reached using a keypath.

(Inherited from NSObject)
ValueForUndefinedKey(NSString)

Indicates an attempt to read a value of an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
WaitForDuration(Double, Double)

Creates an action that waits for a random amount of time in the range (sec - durationRange, sec + durationRange).

WaitForDuration(Double)

Creates an action that waits for sec seconds.

WarpTo(SKWarpGeometry, Double)

Returns an action that warps the contents of a node over the specified duration.

WillChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates that the values of the specified indices in the specified key are about to change.

(Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String)

Indicates that the value of the specified key is about to change.

(Inherited from NSObject)

Extension Methods

ObjectDidBeginEditing(NSObject, INSEditor)
ObjectDidEndEditing(NSObject, INSEditor)
GetValidModes(NSObject, NSFontPanel)
ValidateToolbarItem(NSObject, NSToolbarItem)
GetDebugDescription(INSObjectProtocol)
AcceptsPreviewPanelControl(NSObject, QLPreviewPanel)
BeginPreviewPanelControl(NSObject, QLPreviewPanel)
EndPreviewPanelControl(NSObject, QLPreviewPanel)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

Applies to

See also