<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNAction/customAction(duration:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNAction(cm)customActionWithDuration:actionBlock:"
  },
  "title" : "customAction(duration:action:)"
}
-->

# customAction(duration:action:)

Creates an action that executes a block periodically over a specified duration.

```
class func customAction(duration seconds: TimeInterval, action block: @escaping @Sendable (SCNNode, CGFloat) -> Void) -> SCNAction
```

## Parameters

`seconds`

The duration of the action, in seconds.

`block`

The block to run. The block takes the following parameters:

- *node*: The node on which the action is running.
- *elapsedTime*: The amount of time that has passed since the action began executing.

## Return Value

A new action object.

## Discussion

When the action executes, SceneKit calls the block repeatedly until the action’s duration expires. For each call, SceneKit computes the elapsed time and passes it to the block.

This action is not reversible; the reverse action executes the same block.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)