Skip to content
Chung Leong edited this page Jan 10, 2022 · 3 revisions

mix - Linear interpolation between two numbers

float mix(float $x, float $y, float $a)

mix() calculates x * ( 1 - a ) + y * a. If a is 0, the return value is x. If a is 1, the return value is y.

Parameters:

x - The base value. It can be a scalar or an array.

y - The top value. It can be a scalar or an array.

a - The amount. It can be a scalar or an array.

Return Value:

A number between x and y. If x, y, or a is an array, then return value is also an array, the size of which match the largest of the three.

Version

1.0 and above.

Clone this wiki locally