Skip to content

Linear Interpolated

Interpolates a float value.

Type ID: kaya:linear_interpolated

Format

Field Type Default Description
delta Float Provider A float value that indicates the percentage of the interpolation.
start Float Provider The start value for the interpolation.
end Float Provider The end value of the interpolation.
Info

If delta is $0$, it will provide the start value. If it's $1$, it will provide the end value. Otherwise, it'll be clamped to be within the range of $0.0$ to $1.0$.

Example

{
    "type": "kaya:linear_interpolated",
    "delta": {
        "type": "kaya:quotient",
        "dividend": {
            "type": "kaya:entity/attribute",
            "attribute": "minecraft:armor",
            "entity": "this"
        },
        "divisor": 30.0
    },
    "start": 10.0,
    "end": 0.0
}

This example will provide a float value ranging from $10.0$ to $0.0$ depending on the quotient of the value of the minecraft:armor attribute from the entity provided by the kaya:this context parameter divided by $30.0$.

For example, if the attribute has a value of $20.0$, the provided value will be $3.333333333333334$ $(10.0 + 20.0 * (0.0 - 10.0) = 3.333333333333334)$

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.