<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKShapeNode",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKShapeNode"
  },
  "title" : "SKShapeNode"
}
-->

# SKShapeNode

A mathematical shape that can be stroked or filled.

```
class SKShapeNode
```

## Overview

`SKShapeNode` allows you to create onscreen graphical elements from mathematical points, lines, and curves. The advantage this has over rasterized graphics, such as those displayed by textures, is that shapes are rasterized dynamically at runtime to produce crisp detail and smoother edges.

## Topics

### First Steps

[Getting Started with Shape Nodes](/documentation/SpriteKit/getting-started-with-shape-nodes)

Create a filled or stroked shape from a path object.

### Creating a Shape from a Path

[`init(path:)`](/documentation/SpriteKit/SKShapeNode/init(path:))

Creates a shape node from a Core Graphics path.

[`init(path:centered:)`](/documentation/SpriteKit/SKShapeNode/init(path:centered:))

Creates a shape node from a Core Graphics path, centered around its position.

[`path`](/documentation/SpriteKit/SKShapeNode/path)

The path that defines the shape.

### Creating a Shape from a Rectangle

[`init(rect:)`](/documentation/SpriteKit/SKShapeNode/init(rect:))

Creates a shape node with a rectangular path.

[`init(rectOf:)`](/documentation/SpriteKit/SKShapeNode/init(rectOf:))

Creates a shape node with a rectangular path centered on the node’s origin.

[`init(rect:cornerRadius:)`](/documentation/SpriteKit/SKShapeNode/init(rect:cornerRadius:))

Creates a shape with a rectangular path that has rounded corners.

[`init(rectOf:cornerRadius:)`](/documentation/SpriteKit/SKShapeNode/init(rectOf:cornerRadius:))

Creates a shape with a rectangular path that has rounded corners centered on the node’s position.

### Creating a Circle Shape

[`init(circleOfRadius:)`](/documentation/SpriteKit/SKShapeNode/init(circleOfRadius:))

Creates a shape node with a circular path centered on the node’s origin.

### Creating an Ellipse Shape

[`init(ellipseOf:)`](/documentation/SpriteKit/SKShapeNode/init(ellipseOf:))

Creates a shape node with an elliptical path centered on the node’s origin.

[`init(ellipseIn:)`](/documentation/SpriteKit/SKShapeNode/init(ellipseIn:))

Creates a shape node with an elliptical path that fills the specified rectangle.

### Creating a Shape from an Array of Points

[Creating a Shape Node from an Array of Points](/documentation/SpriteKit/creating-a-shape-node-from-an-array-of-points)

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

[`init(points:count:)`](/documentation/SpriteKit/SKShapeNode/init(points:count:))

Creates a shape node from a series of points.

[`init(splinePoints:count:)`](/documentation/SpriteKit/SKShapeNode/init(splinePoints:count:))

Creates a shape node from a series of spline points.

### Filling a Shape

[`fillColor`](/documentation/SpriteKit/SKShapeNode/fillColor)

The color used to fill the shape.

[`fillTexture`](/documentation/SpriteKit/SKShapeNode/fillTexture)

The texture used to fill the shape.

### Stroking a Shape

[`lineWidth`](/documentation/SpriteKit/SKShapeNode/lineWidth)

The width used to stroke the path.

[`strokeColor`](/documentation/SpriteKit/SKShapeNode/strokeColor)

The color used to stroke the shape.

[`strokeTexture`](/documentation/SpriteKit/SKShapeNode/strokeTexture)

The texture used to stroke the shape.

[`glowWidth`](/documentation/SpriteKit/SKShapeNode/glowWidth)

A glow that extends outward from the stroked line.

[`lineCap`](/documentation/SpriteKit/SKShapeNode/lineCap)

The style used to render the endpoints of the stroked portion of the shape node.

[`lineJoin`](/documentation/SpriteKit/SKShapeNode/lineJoin)

The junction type used when the stroked portion of the shape node is rendered.

[`miterLimit`](/documentation/SpriteKit/SKShapeNode/miterLimit)

The miter limit to use when the line is stroked using a miter join style.

[`isAntialiased`](/documentation/SpriteKit/SKShapeNode/isAntialiased)

A Boolean value that determines whether the stroked path is smoothed when drawn.

### Configuring Alpha Blending

Change how a shape uses its alpha value, such as additive blending, that results in the shape being brighter than it was before.

[`blendMode`](/documentation/SpriteKit/SKShapeNode/blendMode)

The blend mode used to blend the shape into the parent’s framebuffer.

### Controlling or Animating Sroke Length

Adjust or animate a shape’s stroke.

[`lineLength`](/documentation/SpriteKit/SKShapeNode/lineLength)

The length of the line defined by the shape node.

### Customizing Stroking or Fill Drawing

Take per-pixel control of drawing the stroke or fill by supplying a custom code file.

[Controlling Shape Drawing with Shaders](/documentation/SpriteKit/controlling-shape-drawing-with-shaders)

Change a shape node’s appearance by supplying custom shader code.

[`strokeShader`](/documentation/SpriteKit/SKShapeNode/strokeShader)

A custom shader used to determine the color of the stroked portion of the shape node.

[`fillShader`](/documentation/SpriteKit/SKShapeNode/fillShader)

A custom shader used to determine the color of the filled portion of the shape node.

[`attributeValues`](/documentation/SpriteKit/SKShapeNode/attributeValues)

The values of each attribute associated with the node’s attached shader.

[`setValue(_:forAttribute:)`](/documentation/SpriteKit/SKShapeNode/setValue(_:forAttribute:))

Sets an attribute value for an attached shader.

[`value(forAttributeNamed:)`](/documentation/SpriteKit/SKShapeNode/value(forAttributeNamed:))

The value of a shader attribute.

### Instance Properties

[`customPlaygroundQuickLook`](/documentation/SpriteKit/SKShapeNode/customPlaygroundQuickLook)

A custom playground quick look for this instance.



---

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)