Home Reference Source Repository
import SCNAnimatable from 'jscenekit/js/SceneKit/SCNAnimatable.js'
public interface | source

SCNAnimatable

The common interface for attaching animations to nodes, geometries, materials, and other SceneKit objects.

See:

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

Attempting to modify any properties of the returned object results in undefined behavior.

public

init(): void

constructor

public

Required.

public

This method has no effect if no animation is attached to the object with the specified key.

public

Required.

public

Required.

public

Use this method to create smooth transitions between the effects of multiple animations.

public

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 get animationKeys: string[] source

This array contains all keys for which animations are attached to the object, or is empty if there are no attached animations. The ordering of animation keys in the array is arbitrary.

See:

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:

NameTypeAttributeDescription
animation CAAnimation

The animation object to be added.

key string
  • nullable: true

An string identifying the animation for later retrieval. You may pass nil if you don’t need to reference the animation later.

Return:

void

See:

public animationForKey(key: string): CAAnimation source

Attempting to modify any properties of the returned object results in undefined behavior.

Params:

NameTypeAttributeDescription
key string

A string identifying a previously added animation.

Return:

CAAnimation (nullable: true)

See:

public init(): void source

constructor

Return:

void

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:

NameTypeAttributeDescription
key string

A string identifying an attached animation.

Return:

boolean

See:

public pauseAnimationForKey(key: string): void source

This method has no effect if no animation is attached to the object with the specified key.

Params:

NameTypeAttributeDescription
key string

A string identifying an attached animation.

Return:

void

See:

public removeAllAnimations(): void source

Required. Removes all the animations currently attached to the object.

Return:

void

See:

public removeAnimationForKey(key: string): void source

Required. Removes the animation attached to the object with the specified key.

Params:

NameTypeAttributeDescription
key string

A string identifying an attached animation to remove.

Return:

void

See:

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.

Params:

NameTypeAttributeDescription
key string

A string identifying an attached animation to remove.

duration number

The duration for transitioning out of the animation’s effect before it is removed.

Return:

void

See:

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:

NameTypeAttributeDescription
key string

A string identifying an attached animation.

Return:

void

See:

public setAnimationSpeedForKey(speed: number, key: string): void source

Required.

Params:

NameTypeAttributeDescription
speed number
key string

Return:

void

See: