---
title: "customAction(duration:action:)"
framework: scenekit
role: symbol
role_heading: Type Method
path: "scenekit/scnaction/customaction(duration:action:)"
---

# customAction(duration:action:)

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

## Declaration

```swift
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:

## Return Value

Return Value A new action object.

## Discussion

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.

## See Also

### Creating Custom Actions

- [run(_:)](scenekit/scnaction/run(_:).md)
- [run(_:queue:)](scenekit/scnaction/run(_:queue:).md)
- [javaScriptAction(withScript:duration:)](scenekit/scnaction/javascriptaction(withscript:duration:).md)
