<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNTransaction",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNTransaction"
  },
  "title" : "SCNTransaction"
}
-->

# SCNTransaction

A mechanism for creating implicit animations and combining scene graph changes into atomic updates.

```
class SCNTransaction
```

## Overview

You use [`SCNTransaction`](/documentation/SceneKit/SCNTransaction) class methods to control the animation that results from changing animatable properties in the scene graph and to combine sets of changes into nested transactions.

### Adding Animation with Automatic Transaction

SceneKit creates a transaction automatically whenever you modify the objects in a scene graph. This transaction groups any additional changes you make from the same thread during the current iteration of that thread’s run loop. When the run loop next iterates, SceneKit automatically commits the transaction, atomically applying all changes made during the transaction to the presentation scene graph (that is, the, version of the scene graph currently being displayed).

Because an automatic transaction has a default duration of zero, any changes it contains appear instantly when SceneKit automatically commits the transaction. By using the `setAnimationDuration(_:)` method in Swift, `setAnimationDuration:` in Objective-C, to change the duration, you *implicitly animate* all changes made to animatable properties during the transaction. You can use implicit animation to add animation to a scene quickly and easily. For example, the code in Listing 1 fades out and moves one node, fades in another, moves and zooms the point of view camera, and focuses a spotlight, all in a single one-second animation.

Listing 1. Implicitly animating several property changes

```objc
[SCNTransaction setAnimationDuration:1.0];    
_textNode.position = SCNVector3Make(0.0, -10.0, 0.0);
_textNode.opacity = 0.0;
_heroNode.opacity = 1.0;
view.pointOfView = _heroCamera;
_heroCamera.camera.yFov = 20.0;
_lightNode.light.spotInnerAngle = 30.0;
```

### Creating Advanced Animations with Custom Transactions

You can also use [`SCNTransaction`](/documentation/SceneKit/SCNTransaction) class methods to create and manage a hierarchy of your own transactions. By nesting custom transactions, you can group sets of scene graph changes, applying different animation parameters to each group. Use the [`begin()`](/documentation/SceneKit/SCNTransaction/begin()) method to create a custom transaction, nested within the current transaction if one exists. Use the [`commit()`](/documentation/SceneKit/SCNTransaction/commit()) method to end a transaction, applying all scene graph changes made within.

## Topics

### Creating and Committing Transactions

[`+  begin`](/documentation/SceneKit/SCNTransaction/begin())

Begins a new transaction for the current thread.

[`+  commit`](/documentation/SceneKit/SCNTransaction/commit())

Commits all changes made during the current transaction.

[`+  flush`](/documentation/SceneKit/SCNTransaction/flush())

Applies all changes from the current automatic transaction.

### Overriding Animation Duration and Timing

[`animationDuration`](/documentation/SceneKit/SCNTransaction/animationDuration)

Returns the duration, in seconds, of all animations within the current transaction.

[`animationTimingFunction`](/documentation/SceneKit/SCNTransaction/animationTimingFunction)

Returns the timing function that SceneKit uses for all animations within this transaction group.

### Temporarily Disabling Property Animations

[`disableActions`](/documentation/SceneKit/SCNTransaction/disableActions)

Returns a Boolean value indicating whether changes to animatable properties during the transaction are implicitly animated.

### Getting and Setting Completion Block Objects

[`completionBlock`](/documentation/SceneKit/SCNTransaction/completionBlock)

Returns the block previously associated with the current transaction.

### Managing Concurrency

[`+  lock`](/documentation/SceneKit/SCNTransaction/lock())

Attempts to acquire a recursive spinlock to ensure the validity of values you retrieve during the transaction.

[`+  unlock`](/documentation/SceneKit/SCNTransaction/unlock())

Relinquishes a previously acquired transaction lock.

### Getting and Setting Transaction Properties

[`+  setValue:forKey:`](/documentation/SceneKit/SCNTransaction/setValue(_:forKey:))

Associates an arbitrary object with the current transaction using the specified key.

[`+  valueForKey:`](/documentation/SceneKit/SCNTransaction/value(forKey:))

Returns the object previously associated with the current transaction using the specified key.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)