---
title: "moveTo(x:duration:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/skaction/moveto(x:duration:)"
---

# moveTo(x:duration:)

Creates an action that moves a node horizontally.

## Declaration

```swift
class func moveTo(x: CGFloat, duration: TimeInterval) -> SKAction
```

## Parameters

- `x`: The x-value for the node’s new position.
- `duration`: The duration of the animation.

## Return Value

Return Value A new action object.

## Discussion

Discussion When the action executes, the node’s position property animates from its current position to its new position. This action is not reversible; the reverse of this action has the same duration but does not move the node.

## See Also

### Animating a Node’s Position in a Linear Path

- [moveBy(x:y:duration:)](spritekit/skaction/moveby(x:y:duration:).md)
- [move(by:duration:)](spritekit/skaction/move(by:duration:).md)
- [move(to:duration:)](spritekit/skaction/move(to:duration:).md)
- [moveTo(y:duration:)](spritekit/skaction/moveto(y:duration:).md)
