CKScene

public final class CKScene

A scene graph—a hierarchy of nodes with attached geometries, lights, cameras and other attributes that together form a displayable scene.

Note

Read this guide: Convention CKScene Guide
  • The scene graph—a hierarchy of nodes with attached geometries, lights, cameras and other attributes

    Declaration

    Swift

    public internal(set) var graph: SCNScene { get }
  • Returns the current cube linked or nil if scene is free.

    Declaration

    Swift

    public internal(set) var cube: CKCube? { get }
  • The root node of the scene graph.

    Declaration

    Swift

    public var rootNode: SCNNode { get }
  • Create a new empty scene with ‘scene’ named root node.

    Declaration

    Swift

    public init()
  • Loads a scene from a file with the specified name in a specific subdirectory of the app’s main bundle.

    Declaration

    Swift

    public init?(named: String, inDirectory: String? = nil)
  • Loads a scene from the specified URL.

    Declaration

    Swift

    public init?(url: URL)
  • Enable an animation in scene attached to a node.

    Declaration

    Swift

    public func startAnimation(forNodeName nodeName: String, animationName: String, repeatCount: CGFloat)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to start.

    repeatCount

    Number of time to perform animation.

  • Disable an animation in scene attached to a node.

    Declaration

    Swift

    public func stopAnimation(forNodeName nodeName: String, animationName: String)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to stop.

  • Pause an animation attached to a node in scene.

    Declaration

    Swift

    public func pauseAnimation(forNodeName nodeName: String, animationName: String)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to pause.

  • Resume an animation attached to a node in scene.

    This method has no effect if no animation is attached to the node with the specified name in scene.

    Declaration

    Swift

    public func resumeAnimation(forNodeName nodeName: String, animationName: String)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to resume.

  • Add an event trigerred at time to an animation in scene attached to a node.

    Declaration

    Swift

    public func addAnimationEvent(forNodeName nodeName: String, animationName: String, keyTime: CGFloat, block: @escaping SCNAnimationEventBlock)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to add event.

    keyTime

    A number between 0.0 and 1.0 specifying the relative time for triggering the event.

    block

    A block to call at the specified time.

  • Remove all events from animation in scene attached to a node.

    Declaration

    Swift

    public func removeAnimationEvents(forNodeName nodeName: String, animationName: String)

    Parameters

    forNodeName

    The node containing specified animation.

    animationName

    The animation to remove events.