magarengMebala
→ paletteLerp()Finds a colour part-way along a list of colour stops.
magarengMebala(stops, amount)Where magarengMmala works with exactly two colours, magarengMebala works with as many as you like. Each is given a position along the run — a list of [colour, position] pairs — and it returns the colour at the amount you ask for.
It differs from magarengMmala in two ways: it accepts strings, numbers and arrays as colours (building them for you), and it clamps — an amount below the first position returns the first colour, and one above the last returns the last.
Positions must increase. 0 to 1 is the usual range, but other numbers work as long as they are ordered.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
mebala | lenaneo | A list of [colour, position] pairs, ordered by increasing position. |
selekanyo | palo | The position wanted along the run, usually 0–1. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 200);
tlogelaMothalo();
metlha mebala = [
['#ffffff', 0],
[bopaMmala(230, 60, 90), 0.35],
[bopaMmala(30, 80, 200), 1]
];
gopheta (diri x = 0; x < 400; x = x + 4) {
tlatsaMmala(magarengMebala(mebala, x / 400));
thalaKhutlonne(x, 0, 4, 200);
}
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(20);
paloEpePeo(7);
tlogelaMothalo();
metlha mebala = [
[bopaMmala(250, 200, 70), 0],
[bopaMmala(230, 60, 90), 0.5],
[bopaMmala(60, 180, 200), 1]
];
gopheta (diri i = 0; i < 120; i = i + 1) {
tlatsaMmala(magarengMebala(mebala, paloEpe()));
thalaSediko(paloEpe(20, 380), paloEpe(20, 380), paloEpe(10, 44));
}
}