ESPHome  2022.11.3
Public Member Functions | Protected Member Functions | Protected Attributes
esphome::light::LightTransformer Class Referenceabstract

Base class for all light color transformers, such as transitions or flashes. More...

#include <light_transformer.h>

Inheritance diagram for esphome::light::LightTransformer:
esphome::light::LightFlashTransformer esphome::light::LightTransitionTransformer esphome::light::AddressableLightTransformer

Public Member Functions

virtual ~LightTransformer ()=default
 
void setup (const LightColorValues &start_values, const LightColorValues &target_values, uint32_t length)
 
virtual bool is_finished ()
 Indicates whether this transformation is finished. More...
 
virtual void start ()
 This will be called before the transition is started. More...
 
virtual optional< LightColorValuesapply ()=0
 This will be called while the transformer is active to apply the transition to the light. More...
 
virtual void stop ()
 This will be called after transition is finished. More...
 
const LightColorValuesget_start_values () const
 
const LightColorValuesget_target_values () const
 

Protected Member Functions

float get_progress_ ()
 The progress of this transition, on a scale of 0 to 1. More...
 

Protected Attributes

uint32_t start_time_
 
uint32_t length_
 
LightColorValues start_values_
 
LightColorValues target_values_
 

Detailed Description

Base class for all light color transformers, such as transitions or flashes.

Definition at line 11 of file light_transformer.h.

Constructor & Destructor Documentation

◆ ~LightTransformer()

virtual esphome::light::LightTransformer::~LightTransformer ( )
virtualdefault

Member Function Documentation

◆ apply()

virtual optional<LightColorValues> esphome::light::LightTransformer::apply ( )
pure virtual

This will be called while the transformer is active to apply the transition to the light.

Can either write to the light directly, or return LightColorValues that will be applied.

Implemented in esphome::light::AddressableLightTransformer, esphome::light::LightFlashTransformer, and esphome::light::LightTransitionTransformer.

◆ get_progress_()

float esphome::light::LightTransformer::get_progress_ ( )
inlineprotected

The progress of this transition, on a scale of 0 to 1.

Definition at line 42 of file light_transformer.h.

◆ get_start_values()

const LightColorValues& esphome::light::LightTransformer::get_start_values ( ) const
inline

Definition at line 36 of file light_transformer.h.

◆ get_target_values()

const LightColorValues& esphome::light::LightTransformer::get_target_values ( ) const
inline

Definition at line 38 of file light_transformer.h.

◆ is_finished()

virtual bool esphome::light::LightTransformer::is_finished ( )
inlinevirtual

Indicates whether this transformation is finished.

Reimplemented in esphome::light::LightFlashTransformer.

Definition at line 24 of file light_transformer.h.

◆ setup()

void esphome::light::LightTransformer::setup ( const LightColorValues start_values,
const LightColorValues target_values,
uint32_t  length 
)
inline

Definition at line 15 of file light_transformer.h.

◆ start()

virtual void esphome::light::LightTransformer::start ( )
inlinevirtual

This will be called before the transition is started.

Reimplemented in esphome::light::AddressableLightTransformer, esphome::light::LightFlashTransformer, and esphome::light::LightTransitionTransformer.

Definition at line 27 of file light_transformer.h.

◆ stop()

virtual void esphome::light::LightTransformer::stop ( )
inlinevirtual

This will be called after transition is finished.

Reimplemented in esphome::light::LightFlashTransformer.

Definition at line 34 of file light_transformer.h.

Field Documentation

◆ length_

uint32_t esphome::light::LightTransformer::length_
protected

Definition at line 53 of file light_transformer.h.

◆ start_time_

uint32_t esphome::light::LightTransformer::start_time_
protected

Definition at line 52 of file light_transformer.h.

◆ start_values_

LightColorValues esphome::light::LightTransformer::start_values_
protected

Definition at line 54 of file light_transformer.h.

◆ target_values_

LightColorValues esphome::light::LightTransformer::target_values_
protected

Definition at line 55 of file light_transformer.h.


The documentation for this class was generated from the following file: