Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN RGB values if passing zero to interpolateRgb #114

Open
songololo opened this issue Sep 15, 2023 · 0 comments
Open

NaN RGB values if passing zero to interpolateRgb #114

songololo opened this issue Sep 15, 2023 · 0 comments

Comments

@songololo
Copy link

songololo commented Sep 15, 2023

For some reason I am getting NaN values when trying to use zero with the RGB interpolator. Using 0.01 instead of zero seems to fix the problem:

const myColor = rgb(97, 80, 8, 1)
const myColorTransparent = rgb(97, 80, 8, 0.0)
const myColorMap = interpolateRgb(myColorTransparent, myColor)
console.log(color(myColorMap(0.0)))
// returns Rgb {r: NaN, g: NaN, b: NaN, opacity: 0}

const myColor = rgb(97, 80, 8, 1)
const myColorTransparent = rgb(97, 80, 8, 0.01)
const myColorMap = interpolateRgb(myColorTransparent, myColor)
console.log(color(myColorMap(0.0)))
// returns Rgb {r: 97, g: 80, b: 8, opacity: 0.01}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant