---
title: SpinAction
framework: realitykit
role: symbol
role_heading: Structure
path: realitykit/spinaction
---

# SpinAction

An action which animates the transform of an entity to rotate around a specified local axis.

## Declaration

```swift
struct SpinAction
```

## Overview

Overview This action rotates an entity around itself from a specified localAxis gradually adjusting its local transform. The localAxis specifies which cartesian axis around which to rotate in local space. The full spin completes after the action has ended. The example below creates an animation that spins an entity around the x-axis two times for five seconds with a linear transition. // Create an action that performs a spin around the specified local axis // with a linear transition. let spinAction = SpinAction(revolutions: 2,                             localAxis: [1, 0, 0],                             timingFunction: .linear,                             isAdditive: false)

// A five second animation that plays an animation causing the entity to // spin around a specified local axis. let spinAnimation = try AnimationResource     .makeActionAnimation(for: spinAction,                          duration: 5.0,                          bindTarget: .transform)

// Play the five second spin animation. entity.playAnimation(spinAnimation) note: Use the localAxis to determine whether the entity spins clockwise or counterclockwise. important: This action directly animates the BindTarget.transform on the bound entity. Ensure a correct bind target is supplied when creating the animation.

## Topics

### Initializers

- [init(revolutions:localAxis:timingFunction:isAdditive:)](realitykit/spinaction/init(revolutions:localaxis:timingfunction:isadditive:).md)

### Instance Properties

- [animatedValueType](realitykit/spinaction/animatedvaluetype.md)
- [isAdditive](realitykit/spinaction/isadditive.md)
- [localAxis](realitykit/spinaction/localaxis.md)
- [revolutions](realitykit/spinaction/revolutions.md)
- [timingFunction](realitykit/spinaction/timingfunction.md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [EntityAction](realitykit/entityaction.md)

## See Also

### Built-in actions

- [BillboardAction](realitykit/billboardaction.md)
- [EmphasizeAction](realitykit/emphasizeaction.md)
- [FromToByAction](realitykit/fromtobyaction.md)
- [ImpulseAction](realitykit/impulseaction.md)
- [OrbitEntityAction](realitykit/orbitentityaction.md)
- [PlayAnimationAction](realitykit/playanimationaction.md)
- [PlayAudioAction](realitykit/playaudioaction.md)
- [SetEntityEnabledAction](realitykit/setentityenabledaction.md)
