<!--
{
  "documentType" : "article",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/creating-a-shape-node-from-an-array-of-points",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Creating a Shape Node from an Array of Points"
}
-->

# Creating a Shape Node from an Array of Points

Create jagged or smooth shapes from the same array of points.

## Discussion

An [`SKShapeNode`](/documentation/SpriteKit/SKShapeNode) object can be initialized with an array of points describing a path. The [`init(splinePoints:count:)`](/documentation/SpriteKit/SKShapeNode/init(splinePoints:count:)) method can smoothly interpolate between these points to create a curve rather than the series of straight lines created by [`init(points:count:)`](/documentation/SpriteKit/SKShapeNode/init(points:count:)). The following Swift code shows how to create two shape nodes using the same array of points for both initializers.

```swift
var points = [CGPoint(x: 0, y: 0),               
              CGPoint(x: 100, y: 100),               
              CGPoint(x: 200, y: -50),               
              CGPoint(x: 300, y: 30),               
              CGPoint(x: 400, y: 20)]         
let linearShapeNode = SKShapeNode(points: &points,                                   
                                  count: points.count)          
let splineShapeNode = SKShapeNode(splinePoints: &points,                                   
                                  count: points.count)
```

The following image shows `linearShapeNode` in blue and `splineShapeNode` in red.

![Shape nodes created from points](images/com.apple.spritekit/media-2975239@2x.png)

---

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)