All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.style-spec.util.interpolate.js Maven / Gradle / Ivy

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);
    });
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy