# NumberSequence

## Overview

Defines a sequence where values change smoothly over time by combining multiple number keypoints (NumberSequenceKeypoint).

Each keypoint specifies a numeric value at a specific point, and these values are sequentially connected to create smooth numeric change effects. This structure is commonly used in various elements that need to express numeric changes over time, such as particle size, transparency, and intensity.

## Constructors

### new

Creates a NumberSequence using the passed numeric value. The same value is applied at both the starting and ending points of the sequence, maintaining a constant numeric value throughout the entire range without changes.

#### Parameters

| `number` InValue | The single numeric value to be applied across all points of the NumberSequence. This value remains constant from start to end. |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------ |

#### Return

| `NumberSequence` | A new NumberSequence with the passed numeric value set. |
| ---------------- | ------------------------------------------------------- |

#### Code Samples

```lua
local NumSequence = NumberSequence.new(5)
```

### new

Creates a NumberSequence from an array of NumberSequenceKeypoint.

Each keypoint must be sorted by time value in ascending order without shuffling. At least two keypoints are required to form a sequence, and the starting keypoint must have a time value of 0 while the ending keypoint must have a time value of 1.

#### Parameters

| `table` InArrayValue | An array consisting of NumberSequenceKeypoint. Each keypoint defines a time value within the ColorSequence and the numeric value at that point. Keypoints must be sorted by time value in ascending order, with at least two required. The first keypoint's time value must be 0, and the last keypoint's time value must be 1. |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#### Return

| `NumberSequence` | A new NumberSequence with the passed numeric value set. |
| ---------------- | ------------------------------------------------------- |

#### Code Samples

```lua
local Time1 = 0
local Time2 = 1

local KeyPoints =
{
    NumberSequenceKeyPoint.new(Time1, 0),
    NumberSequenceKeyPoint.new(Time2, 10)
}
local NumSequence = NumberSequence.new(KeyPoints)
```

### new

Creates a NumberSequence with value n0 at the starting point and value n1 at the ending point. The sequence smoothly interpolates values from start to end.

#### Parameters

| `number` n0 | The value to be applied at the starting point of the sequence, defining the number at time value 0. |
| ----------- | --------------------------------------------------------------------------------------------------- |
| `number` n1 | The value to be applied at the ending point of the sequence, defining the number at time value 1.   |

#### Return

| `NumberSequence` | A new NumberSequence with the passed numeric value set. |
| ---------------- | ------------------------------------------------------- |

#### Code Samples

```lua
local NumSequence = NumberSequence.new(1, 10)
```

## Properties

### Keypoints

`Array`

Returns an array consisting of NumberSequenceKeypoint.

#### Code Samples

```lua
local NumSequence = NumberSequence.new(1, 10)
local KeyPoints = NumSequence.Keypoints

for _, keypoint in ipairs(KeyPoints) do
    print(keypoint.Time, keypoint.Value)
end
```

## Methods

## Events


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/datatype/numbersequence.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
