SCNAnimatable
Direct Implemented:
Indirect Implemented:
The common interface for attaching animations to nodes, geometries, materials, and other SceneKit objects.
Member Summary
Public Members | ||
public get |
This array contains all keys for which animations are attached to the object, or is empty if there are no attached animations. |
Method Summary
Public Methods | ||
public |
addAnimationForKey(animation: CAAnimation, key: string): void Newly added animations begin executing after the current run loop cycle ends.SceneKit does not define any requirements for the contents of the key parameter—it need only be unique among the keys for other animations you add. |
|
public |
animationForKey(key: string): CAAnimation Attempting to modify any properties of the returned object results in undefined behavior. |
|
public |
init(): void constructor |
|
public |
isAnimationPausedForKey(key: string): boolean Required. |
|
public |
pauseAnimationForKey(key: string): void This method has no effect if no animation is attached to the object with the specified key. |
|
public |
removeAllAnimations(): void Required. |
|
public |
removeAnimationForKey(key: string): void Required. |
|
public |
removeAnimationForKeyFadeOutDuration(key: string, duration: number): void Use this method to create smooth transitions between the effects of multiple animations. |
|
public |
resumeAnimationForKey(key: string): void This method has no effect if no animation is attached to the object with the specified key or if the specified animation is not currently paused. |
|
public |
setAnimationSpeedForKey(speed: number, key: string): void Required. |
Public Members
Public Methods
public addAnimationForKey(animation: CAAnimation, key: string): void source
Newly added animations begin executing after the current run loop cycle ends.SceneKit does not define any requirements for the contents of the key parameter—it need only be unique among the keys for other animations you add. If you add an animation with an existing key, this method overwrites the existing animation.
Params:
Name | Type | Attribute | Description |
animation | CAAnimation | The animation object to be added. |
|
key | string |
|
An string identifying the animation for later retrieval. You may pass nil if you don’t need to reference the animation later. |
Return:
void |
public animationForKey(key: string): CAAnimation source
Attempting to modify any properties of the returned object results in undefined behavior.
Params:
Name | Type | Attribute | Description |
key | string | A string identifying a previously added animation. |
public isAnimationPausedForKey(key: string): boolean source
Required. Returns a Boolean value indicating whether the animation attached to the object with the specified key is paused.
Params:
Name | Type | Attribute | Description |
key | string | A string identifying an attached animation. |
public pauseAnimationForKey(key: string): void source
This method has no effect if no animation is attached to the object with the specified key.
Params:
Name | Type | Attribute | Description |
key | string | A string identifying an attached animation. |
Return:
void |
public removeAllAnimations(): void source
Required. Removes all the animations currently attached to the object.
Return:
void |
public removeAnimationForKey(key: string): void source
Required. Removes the animation attached to the object with the specified key.
Params:
Name | Type | Attribute | Description |
key | string | A string identifying an attached animation to remove. |
Return:
void |
public removeAnimationForKeyFadeOutDuration(key: string, duration: number): void source
Use this method to create smooth transitions between the effects of multiple animations. For example, the geometry loaded from a scene file for a game character may have associated animations for player actions such as walking and jumping. When the player lands from a jump, you remove the jump animation so the character continues walking. If you use the removeAnimation(forKey:) method to remove the jump animation, SceneKit abruptly switches from the current frame of the jump animation to the current frame of the walk animation. If you use the removeAnimation(forKey:fadeOutDuration:) method instead, SceneKit plays both animations at once during that duration and interpolates vertex positions from one animation to the other, creating a smooth transition.
Return:
void |
public resumeAnimationForKey(key: string): void source
This method has no effect if no animation is attached to the object with the specified key or if the specified animation is not currently paused.
Params:
Name | Type | Attribute | Description |
key | string | A string identifying an attached animation. |
Return:
void |