-
Notifications
You must be signed in to change notification settings - Fork 317
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
Color blending fixes #208
Color blending fixes #208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! These are some great changes.
Could you perhaps move all the color interpolations into a separate function? They are quite verbose, and especially now that they are used several places.
Sure thing; would you say that the lerp should be overloaded for Colourb to be like this? |
Great. I think it's better to make a separate function for this one. |
I do think it makes sense to overload the lerp since it doesn't behave in the correct way for Colourbs (truncating rather than rounding the result leading to errors), and someone is likely to use the wrong function unknowingly if there is another one. I'm not really sure where else it would make sense to go (locally, another function in Math)? |
I figured it would be easier to separate them in case we later provide a way to select different color interpolation strategies. We don't really have a better place right now than math, that should be fine. We could do a static assert to make sure people don't use lerp with Colourb. |
All right, I've made those changes. :) |
Awesome work! Thank you! :) |
The gradient code had the same rounding error in the color lerp that the border radius code did. I also fixed an error in the way the blending is done in the animation code. (More details here.)