---
title: "follow(_:asOffset:orientToPath:duration:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/skaction/follow(_:asoffset:orienttopath:duration:)"
---

# follow(_:asOffset:orientToPath:duration:)

Creates an action that moves the node along a path.

## Declaration

```swift
class func follow(_ path: CGPath, asOffset offset: Bool, orientToPath orient: Bool, duration: TimeInterval) -> SKAction
```

## Parameters

- `path`: A path to follow.
- `offset`: If doc://com.apple.documentation/documentation/Swift/true, the points in the path are relative offsets to the node’s starting position. If doc://com.apple.documentation/documentation/Swift/false, the points in the node are absolute coordinate values.
- `orient`: If doc://com.apple.documentation/documentation/Swift/true, the node’s doc://com.apple.spritekit/documentation/SpriteKit/SKNode/zRotation property animates so that the node turns to follow the path. If doc://com.apple.documentation/documentation/Swift/false, the doc://com.apple.spritekit/documentation/SpriteKit/SKNode/zRotation property of the node is unchanged.
- `duration`: The duration of the animation.

## Return Value

Return Value A new action object.

## Discussion

Discussion When the action executes, the node’s position and zRotation properties are animated along the provided path. This action is reversible; the resulting action creates a reversed path and then follows it, with the same duration.

## See Also

### Animating a Node’s Position Along a Custom Path

- [follow(_:duration:)](spritekit/skaction/follow(_:duration:).md)
- [follow(_:speed:)](spritekit/skaction/follow(_:speed:).md)
- [follow(_:asOffset:orientToPath:speed:)](spritekit/skaction/follow(_:asoffset:orienttopath:speed:).md)
