Math.Lerp¶
Name | Mandatory | Description | Default | Type |
---|---|---|---|---|
⬅️ Input |
The factor to interpolate between the start and end values. | Float |
||
Output ➡️ |
The interpolated value between the start and end values based on the factor provided as input. | Int Int2 Int3 Int4 Int8 Int16 Float Float2 Float3 Float4 Color [Any] |
||
First |
No | The start value | none |
Int Var(Int) Int2 Var(Int2) Int3 Var(Int3) Int4 Var(Int4) Int8 Var(Int8) Int16 Var(Int16) Float Var(Float) Float2 Var(Float2) Float3 Var(Float3) Float4 Var(Float4) Color Var(Color) |
Second |
No | The end value | none |
Int Var(Int) Int2 Var(Int2) Int3 Var(Int3) Int4 Var(Int4) Int8 Var(Int8) Int16 Var(Int16) Float Var(Float) Float2 Var(Float2) Float3 Var(Float3) Float4 Var(Float4) Color Var(Color) |
Linearly interpolate between the start value specified in the First
parameter and the end value specified in the Second
parameter based on the factor provided as input.
Details¶
The value in the First
parameter and the Second
parameter must be of the same type.
If the integers are provided in the First
and Second
parameters, the output of the shard will be an integer rounded down to the nearest integer.
If vectors are provided in the First
and Second
parameters, The first element in the First
vector will be linearly interpolated to the first element in the Second
vector, the second element in the First
vector will be linearly interpolated to the second element in the Second
vector, and so on.
Do note that the output of the shard is not automatically written to the value in the First
parameter.
Consider the following example:
@wire(lerp {
Once({
0 >= x
})
0.1
Math.Lerp(First: x Second: 100)
Log("Result")
} Looped: true)
10
regardless of how many times the Math.Lerp shard is called. For the output value to progress, you must write the output back to x
. Like so:
@wire(lerp {
Once({
0 >= x
})
0.1
Math.Lerp(First: x Second: 100)
> x
Log("Result")
} Looped: true)
Math.Ler
is called the output will be 10, then 20 and so on.