rojo/.cursor/rules/roblox/reference/engine/classes/ValueCurve.yaml
2026-02-02 12:08:47 -06:00

295 lines
9 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: ValueCurve
type: class
memory_category: Instances
summary: |
A sorted list of time-value pairs that define a curve. Used to animate a any
type of value.
description: |
An instance representing a 1D value curve encoded via a sorted list of
`Datatype.ValueCurveKey|ValueCurveKeys`. The shape of the interpolation curve
between two keys is determined by the `Datatype.ValueCurveKey.Interpolation`
type.
Not all value types (for example, strings and other non-numerical types) may
perform `Enum.KeyInterpolationMode.Linear|Linear` or
`Enum.KeyInterpolationMode.Cubic|Cubic` interpolation. These types will revert
to `Enum.KeyInterpolationMode.Constant|Constant` interpolation if necessary.
code_samples: []
inherits:
- Instance
descendants: []
tags: []
deprecation_message: ''
properties:
- name: ValueCurve.Length
summary: |
Number of keys in the value curve.
description: |
Number of keys in the value curve.
code_samples: []
type: int
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities:
- Basic
- name: ValueCurve.ValueType
summary: |
Read-only value indicating the type held in this curve.
description: |
Read-only value indicating the type held in this curve, or the string
`"Nil"` if there are no keys.
code_samples: []
type: string
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities:
- Basic
methods:
- name: ValueCurve:GetKeyAtIndex
summary: |
Returns a copy of a key at a given index.
description: |
Returns a copy of a key at a given index.
code_samples: []
parameters:
- name: index
type: int
default:
summary: |
The index in the existing set of keys held by this `Class.ValueCurve`.
returns:
- type: ValueCurveKey
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:GetKeyIndicesAtTime
summary: |
Returns the index of the last and first key of a period of time.
description: |
The first item in the returned array is the index of the last key with
time less than or equal to `time` (or the lesser of either `1` or the
curve length if no key was found). The second item in the returned array
is the index of the first key with time greater than or equal to `time`
(or the curve length if no key was found satisfying the inequality).
code_samples: []
parameters:
- name: time
type: float
default:
summary: |
A time during the animation. Inputs will be clamped between `0` and
the time of the last key held by this `Class.ValueCurve`.
returns:
- type: Array
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:GetKeys
summary: |
Returns a copy of all the keys in the ValueCurve as a Luau array of
`Datatype.ValueCurveKey|ValueCurveKeys`.
description: |
Returns a copy of all the keys in the `Class.ValueCurve` as a Luau array
of `Datatype.ValueCurveKey|ValueCurveKeys`.
code_samples: []
parameters: []
returns:
- type: Array
summary: |
Array of `Datatype.ValueCurveKey|ValueCurveKeys`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:GetValueAtTime
summary: |
Samples the value curve at a given time passed as argument.
description: |
Samples the value curve at a given time passed as argument.
code_samples: []
parameters:
- name: time
type: float
default:
summary: |
Time at which to sample the curve.
returns:
- type: Variant?
summary: |
Value of the curve at the requested `time`.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:InsertKey
summary: |
Adds the key passed as an argument to this curve. If a key at the same
time is found, it will be replaced.
description: |
Adds the key passed as an argument to this curve. If a key at the same
time is found, it will be replaced. In the returned array, the first value
is `true` if a key was added or `false` if a previous key was replaced;
the second value is the index at which the marker was added.
If there are not yet any keys, then the key may be added. If keys exist,
the type of the value must match those of existing keys; otherwise a
message is printed and `{false, -1}` is returned.
code_samples: []
parameters:
- name: key
type: ValueCurveKey
default:
summary: |
`Datatype.ValueCurveKey` to insert.
returns:
- type: Array
summary: |
(see description)
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:InsertKeyValue
summary: |
Creates a key for the given value and inserts it at the given time. If a
key at the same time is found, it will be replaced.
description: |
Creates a `Datatype.ValueCurveKey` from the given arguments and inserts it
in this curve. If a key at the same time is found, it will be replaced. In
the returned array, the first value is `true` if a key was added or
`false` if a previous key was replaced; the second value is the index at
which the marker was added.
If there are not yet any keys, then the key may be added. If keys exist,
the type of the value must match those of existing keys; otherwise a
message is printed and `{false, -1}` is returned.
code_samples: []
parameters:
- name: time
type: float
default:
summary: |
Time at which to insert the new `Datatype.ValueCurveKey`. - type:
number
- name: value
type: Variant
default:
summary: |
Value of the inserted `Datatype.ValueCurveKey`. - type: any
- name: Interpolation
type: KeyInterpolationMode
default:
summary: |
Interpolation mode of the inserted `Datatype.ValueCurveKey`. - type:
KeyInterpolationMode
returns:
- type: Array
summary: |
(see description)
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:RemoveKeyAtIndex
summary: |
Removes a given number of keys starting from a given index.
description: |
Removes a given number (`count`) of keys starting from the `startingIndex`
index and returns the number of keys that were removed.
code_samples: []
parameters:
- name: startingIndex
type: int
default:
summary: |
Starting index from which to remove keys.
- name: count
type: int
default: 1
summary: |
Number of keys to remove.
returns:
- type: int
summary: |
Number of keys removed.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
- name: ValueCurve:SetKeys
summary: |
Resets this curve's keys using the `Datatype.ValueCurveKey` array passed
as an argument.
description: |
Resets this curve's keys using the `Datatype.ValueCurveKey` array passed
as an argument. Keys in the `keys` array are sorted in ascending time
order before insertion, and keys at duplicated times are removed in a
stable manner.
Returns the number of keys actually inserted. Keys previously stored in
this curve are removed before the keys passed as arguments are added.
The keys must all contain values of the same type. And that type must
match any existing keys. Otherwise a message is printed, the keys are not
added, and `0` is returned.
code_samples: []
parameters:
- name: keys
type: Array
default:
summary: |
Array of `Datatype.ValueCurveKey|ValueCurveKeys`.
returns:
- type: int
summary: |
Number of keys inserted.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Basic
events: []
callbacks: []