-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add a lerp function to Color #8605
Comments
Just a note, for interpolating colors you usually want to do it in HSV space, not RGB. I thought we had this code somewhere in Cesium already, but it could just be a really old TODO. |
There's an argument for either RGB or HSV lerping. Maybe it should be exposed as an option? I'd prefer RGB lerp by default since it's faster + simpler + often good enough (doesn't need to transform to HSV space and back) There are also some scenarios where you don't want HSV lerp, such as interpolating between two colors with large hue differences, as you would get a rainbowy result. I already have an RGB Color.lerp on an old branch. I can PR that. Would it help to have a separate function called Color.lerpHSV which converts the RGB inputs to HSV, lerps, then converts back to RGB. There's more advanced color lerps out there, not sure if we want to support those. |
@IanLilleyT sounds good to me! We use a RGB lerp in some of our other projects, so that's mainly what I was looking for. We can add a separate |
Add
Color.lerp
to linearly interpolate between two colors. Similarly to https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Cartesian4.js#L621The text was updated successfully, but these errors were encountered: