UNPKG

ts-useful

Version:

Functions for animation, color transitions, ecliptic, bezier, decasteljau, curves, three dimensional curves, smooth scrolling, random range, randomItem, mobius index, vectors, physics vectors, and easing.

39 lines 1.56 kB
export class ColorVect { } ColorVect.add = (prime, other) => { return [prime[0] + other[0], prime[1] + other[1], prime[2] + other[2]]; }; ColorVect.subtract = (prime, other) => { return [prime[0] - other[0], prime[1] - other[1], prime[2] - other[2]]; }; ColorVect.multiply = (prime, other) => { return [prime[0] * other[0], prime[1] * other[1], prime[2] * other[2]]; }; ColorVect.divide = (prime, other) => { return [prime[0] / other[0], prime[1] / other[1], prime[2] / other[2]]; }; ColorVect.addBy = (prime, amount) => { return [prime[0] + amount, prime[1] + amount, prime[2] + amount]; }; ColorVect.subtractBy = (prime, amount) => { return [prime[0] - amount, prime[1] - amount, prime[2] - amount]; }; ColorVect.multiplyBy = (prime, amount) => { return [prime[0] * amount, prime[1] * amount, prime[2] * amount]; }; ColorVect.divideBy = (prime, amount) => { return [prime[0] / amount, prime[1] / amount, prime[2] / amount]; }; ColorVect.addAll = (vectors) => { return vectors.reduce((p, c) => { return [p[0] + c[0], p[1] + c[1], p[2] + c[2]]; }); }; ColorVect.subtractAll = (vectors) => { return vectors.reduce((p, c) => { return [p[0] - c[0], p[1] - c[1], p[2] - c[2]]; }); }; ColorVect.multiplyAll = (vectors) => { return vectors.reduce((p, c) => { return [p[0] * c[0], p[1] * c[1], p[2] * c[2]]; }); }; ColorVect.divideAll = (vectors) => { return vectors.reduce((p, c) => { return [p[0] / c[0], p[1] / c[1], p[2] / c[2]]; }); }; //# sourceMappingURL=colorVect.js.map