<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKAction/timingFunction",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKAction(py)timingFunction"
  },
  "title" : "timingFunction"
}
-->

# timingFunction

A block used to customize the timing function.

```
var timingFunction: SKActionTimingFunction { get set }
```

## Discussion

If a timing function is provided, after the normal timing mode is applied, the result is sent to the timing function. The return [`SKActionTimingFunction`](/documentation/SpriteKit/SKActionTimingFunction) value of the timing function determines the actual time used to perform the animation.

The following code shows how you can create a custom timing function using <doc://com.apple.documentation/documentation/simd/simd_smoothstep(_:_:_:)-5839l> interpolation:

```swift
import simd
let horizontalAction = SKAction.moveTo(x: end.x, duration: 2.0)
horizontalAction.timingFunction = {
    time in
    return simd_smoothstep(0, 1, time)
}
```

If the above code is combined with a vertical linear move action, the path taken by a node running this action describes the curve illustrated below:

![Smoothstep based motion path](images/com.apple.spritekit/media-2759776@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)