package.src.style-spec.util.interpolate.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapbox-gl Show documentation
Show all versions of mapbox-gl Show documentation
A WebGL interactive maps library
The newest version!
// @flow
import Color from './color';
export function number(a: number, b: number, t: number) {
return (a * (1 - t)) + (b * t);
}
export function color(from: Color, to: Color, t: number) {
return new Color(
number(from.r, to.r, t),
number(from.g, to.g, t),
number(from.b, to.b, t),
number(from.a, to.a, t)
);
}
export function array(from: Array, to: Array, t: number): Array {
return from.map((d, i) => {
return number(d, to[i], t);
});
}