mirror of
https://github.com/esphome/esphome.git
synced 2025-08-02 08:27:47 +00:00
revert
This commit is contained in:
parent
29e61c8913
commit
28dbf3bbcc
@ -84,9 +84,11 @@ class LightColorValues {
|
|||||||
* @return The linearly interpolated LightColorValues.
|
* @return The linearly interpolated LightColorValues.
|
||||||
*/
|
*/
|
||||||
static LightColorValues lerp(const LightColorValues &start, const LightColorValues &end, float completion) {
|
static LightColorValues lerp(const LightColorValues &start, const LightColorValues &end, float completion) {
|
||||||
// Directly interpolate the raw values to avoid getter/setter overhead
|
// Directly interpolate the raw values to avoid getter/setter overhead.
|
||||||
// Linear interpolation between two clamped values produces a clamped result,
|
// This is safe because:
|
||||||
// so we can skip the setters which include redundant clamping logic
|
// - All LightColorValues have their values clamped when set via the setters
|
||||||
|
// - std::lerp guarantees output is in the same range as inputs
|
||||||
|
// - Therefore the output doesn't need clamping, so we can skip the setters
|
||||||
LightColorValues v;
|
LightColorValues v;
|
||||||
v.color_mode_ = end.color_mode_;
|
v.color_mode_ = end.color_mode_;
|
||||||
v.state_ = std::lerp(start.state_, end.state_, completion);
|
v.state_ = std::lerp(start.state_, end.state_, completion);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user