SKShapeNode Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/SpriteKit.framework
Availability
Available in iOS 7.0 and later.
Companion guide
Declared in
SKShapeNode.h

Overview

An SKShapeNode object represents an arbitrary shape defined by a Core Graphics path. You can apply different colors to stroke and fill the path. You can also choose to add a glow to the stroked portion of the path.

Tasks

Defining the Shape Path

Setting the Fill Properties

Setting the Stroke Properties

Blending the Shape With the Framebuffer

Properties

antialiased

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

@property(getter=isAntialiased, nonatomic) BOOL antialiased
Discussion

The default value is YES.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

blendMode

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

@property(nonatomic) SKBlendMode blendMode
Discussion

The default value is SKBlendModeAlpha.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

fillColor

The color used to fill the shape.

@property(retain, nonatomic) SKColor *fillColor
Discussion

The default fill color is [SKColor clearColor], which means the shape is not filled.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

glowWidth

The glow that extends outward from the stroked line.

@property(nonatomic) CGFloat glowWidth
Discussion

The default value is 0.0, which means no glow is added.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

lineWidth

The width used to stroke the path.

@property(nonatomic) CGFloat lineWidth
Discussion

A line width larger than 2.0 may cause rendering artifacts in the final rendered image. The default value is 1.0.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

path

The path that defines the shape.

@property(nonatomic) CGPathRef path
Discussion

The path is defined in the node’s coordinate space.

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h

strokeColor

The color used to stroke the shape.

@property(retain, nonatomic) SKColor *strokeColor
Discussion

The default stroke color is [SKColor whiteColor]. If you do not want to stroke the shape, use [SKColor clearColor].

Availability
  • Available in iOS 7.0 and later.
Declared In
SKShapeNode.h