51 p = p < 0.5f ? p * 2 : (p - 0.5) * 2;
72 this->transition_length_ = this->state_.get_flash_transition_length();
73 if (this->transition_length_ * 2 > this->
length_)
74 this->transition_length_ = this->
length_ / 2;
76 this->begun_lightstate_restore_ =
false;
79 this->transformer_ = this->state_.get_output()->create_default_transition();
80 this->transformer_->setup(this->state_.current_values, this->target_values_, this->transition_length_);
88 this->transformer_ = this->state_.get_output()->create_default_transition();
89 this->transformer_->setup(this->state_.current_values, this->get_start_values(), this->transition_length_);
90 this->begun_lightstate_restore_ =
true;
93 if (this->transformer_ !=
nullptr) {
94 result = this->transformer_->apply();
96 if (this->transformer_->is_finished()) {
97 this->transformer_->stop();
98 this->transformer_ =
nullptr;
107 if (this->transformer_ !=
nullptr) {
108 this->transformer_->stop();
109 this->transformer_ =
nullptr;
113 this->state_.publish_state();
121 std::unique_ptr<LightTransformer> transformer_{
nullptr};
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
bool is_on() const
Get the binary true/false state of these light color values.
void set_state(float state)
Set the state of these light color values. In range from 0.0 (off) to 1.0 (on)
uint32_t IRAM_ATTR HOT millis()
This class represents the color state for a light object.
ColorMode get_color_mode() const
Get the color mode of these light color values.
void set_brightness(float brightness)
Set the brightness property of these light color values. In range 0.0 to 1.0.
Implementation of SPI Controller mode.
static LightColorValues lerp(const LightColorValues &start, const LightColorValues &end, float completion)
Linearly interpolate between the values in start to the values in end.