# RotationCurve

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/RotationCurve/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/RotationCurve

Represents a sequence of rotations and the interpolation curve between them.

## Properties

### Length

```luau
RotationCurve.Length: number = 0
```

- Tags: Read only, Read capabilities: Basic, Save only

Number of rotation keys in this curve.

### ValuesAndTimes

```luau
RotationCurve.ValuesAndTimes: string = "\u0001"
```

- Tags: Hidden, Not scriptable, Read capabilities: Basic

## Methods

### GetKeyAtIndex

```luau
RotationCurve:GetKeyAtIndex(index: number): RotationCurveKey
```

- Tags: Capabilities: Basic

Returns a copy of a key at a given index.

Parameters:

- `index`: Index of the key to return.

Returns: Copy of the [`RotationCurveKey`](https://rapi.sleaze.dev/index/types/RotationCurveKey.md) stored at `index`.

### GetKeyIndicesAtTime

```luau
RotationCurve:GetKeyIndicesAtTime(time: number): { any }
```

- Tags: Capabilities: Basic

Returns the index of the last and first key of a period of time.

Parameters:

- `time`: Time to look up within the curve.

Returns: Array with the indices of the keys that bracket `time`.

### GetKeys

```luau
RotationCurve:GetKeys(): { any }
```

- Tags: Capabilities: Basic

Returns a copy of all the keys in the rotation curve as a Luau array of `RotationCurveKeys`.

Returns: Array of `RotationCurveKeys`.

### GetValueAtTime

```luau
RotationCurve:GetValueAtTime(time: number): CFrame?
```

- Tags: Capabilities: Basic

Samples the rotation curve at a given time and returns the corresponding rotation as a [`CFrame`](https://rapi.sleaze.dev/index/types/CFrame.md).

Parameters:

- `time`: Time at which to sample the curve.

Returns: Value of the curve at the requested `time`.

### InsertKey

```luau
RotationCurve:InsertKey(key: RotationCurveKey): { any }
```

- Tags: Capabilities: Basic

Adds the key passed as an argument to this curve. If a key at the same time is found, it will be replaced.

Parameters:

- `key`: [`RotationCurveKey`](https://rapi.sleaze.dev/index/types/RotationCurveKey.md) to insert.

Returns: (see description) .

### RemoveKeyAtIndex

```luau
RotationCurve:RemoveKeyAtIndex(startingIndex: number, count: number? = 1): number
```

- Tags: Capabilities: Basic

Removes a given number of keys starting from a given index.

Parameters:

- `startingIndex`: Starting index from which to remove keys.
- `count`: Number of keys to remove.

Returns: Number of keys removed.

### SetKeys

```luau
RotationCurve:SetKeys(keys: { any }): number
```

- Tags: Capabilities: Basic

Resets this curve's keys using the [`RotationCurveKey`](https://rapi.sleaze.dev/index/types/RotationCurveKey.md) array passed as an argument.

Parameters:

- `keys`: Array of `RotationCurveKeys`.

Returns: Number of keys inserted.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
