#include <modm/ui/animation/base.hpp>
 | 
| 
using  | TimeType = typename FastRamp< T >::StepType | 
|   | 
| 
using  | Handler = void (*)(T) | 
|   | 
 | 
|   | Animation (T &value, Handler handler=nullptr) | 
|   | 
| void  | attachCallback (Handler handler) | 
|   | 
| 
virtual void  | setValue (T value) override | 
|   | stop any running animation and set a value. 
  | 
|   | 
| T  | getValue () const | 
|   | 
| virtual bool  | isAnimating () const override | 
|   | 
| 
virtual void  | stop () override | 
|   | stops any running animation. 
  | 
|   | 
| virtual bool  | animateTo (T value, uint32_t time) override | 
|   | 
| virtual bool  | update () override | 
|   | 
template<typename T = uint8_t>
class modm::ui::Animation< T >
This class allows the linear animation of one value over time.
Be aware that the algorithm for 8-bit types is optimized for low computational costs, developed for fast LED fading (
- See also
 modm::ui::Led). Therefore the animation length is limited to 128ms * value_difference, which is about 32s over the full 8-bit range. If you specify a longer time in this case, the animation simply finishes before. If this is a problem, consider using a 16-bit type, which does not have this limitation.
- Author
 - Niklas Hauser 
 
 
template<typename T  = uint8_t> 
      
        
          | modm::ui::Animation< T >::Animation  | 
          ( | 
          T &  | 
          value,  | 
        
        
           | 
           | 
          Handler  | 
          handler = nullptr  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
- Parameters
 - 
  
    | value | a reference to the value to be animated  | 
    | handler | this function will be called whenever the value has been changed  | 
  
   
 
 
template<typename T  = uint8_t> 
  
  
      
        
          | virtual bool modm::ui::Animation< T >::animateTo  | 
          ( | 
          T  | 
          value,  | 
         
        
           | 
           | 
          uint32_t  | 
          time  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
overridevirtual   | 
  
 
Animate from the current value to a new value in the specified ms. 
- Returns
 true if animation started, false if otherwise 
Implements modm::ui::AnimationBase< T >.
 
 
template<typename T  = uint8_t> 
      
        
          | void modm::ui::Animation< T >::attachCallback  | 
          ( | 
          Handler  | 
          handler | ) | 
           | 
        
      
 
- Parameters
 - 
  
    | handler | this function will be called whenever the value has been changed  | 
  
   
 
 
template<typename T  = uint8_t> 
      
        
          | T modm::ui::Animation< T >::getValue  | 
          ( | 
           | ) | 
           const | 
        
      
 
 
template<typename T  = uint8_t> 
  
  
      
        
          | virtual bool modm::ui::Animation< T >::isAnimating  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
overridevirtual   | 
  
 
 
template<typename T  = uint8_t> 
  
  
      
        
          | virtual bool modm::ui::Animation< T >::update  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
overridevirtual   | 
  
 
Can be called at an interval of 1ms or less. If you do not need 1ms response time, you may call this at intervals < 250ms. 
- Returns
 true if the value has been changed, false otherwise 
Reimplemented from modm::ui::AnimationBase< T >.
 
 
The documentation for this class was generated from the following file: