# FloatCurve

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/FloatCurve/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/FloatCurve

A sorted list of time-value pairs that define a curve. Used to animate a single numerical value.

## Properties

### Length

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

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

Number of keys in the float curve.

### ValuesAndTimes

```luau
FloatCurve.ValuesAndTimes: string = "\u0002"
```

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

## Methods

### GetKeyAtIndex

```luau
FloatCurve:GetKeyAtIndex(index: number): FloatCurveKey
```

- Tags: Capabilities: Basic

Returns a copy of a key at a given index.

Parameters:

- `index`: One-based index of the key to retrieve.

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

### GetKeyIndicesAtTime

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

- Tags: Capabilities: Basic

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

Parameters:

- `time`: Time value to locate within the curve's sorted keys.

Returns: Array of two one-based indices that bracket `time`: the last key at or before `time` and the first key at or after it.

### GetKeys

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

- Tags: Capabilities: Basic

Returns a copy of all the keys in the FloatCurve as a Luau array of `FloatCurveKeys`.

Returns: Array of `FloatCurveKeys`.

### GetValueAtTime

```luau
FloatCurve:GetValueAtTime(time: number): number?
```

- Tags: Capabilities: Basic

Samples the float curve at a given time passed as argument.

Parameters:

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

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

### InsertKey

```luau
FloatCurve:InsertKey(key: FloatCurveKey): { 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`: [`FloatCurveKey`](https://rapi.sleaze.dev/index/types/FloatCurveKey.md) to insert.

Returns: (see description) .

### RemoveKeyAtIndex

```luau
FloatCurve: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
FloatCurve:SetKeys(keys: { any }): number
```

- Tags: Capabilities: Basic

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

Parameters:

- `keys`: Array of `FloatCurveKeys`.

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`
