mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	added prev_frame for animation (#3427)
This commit is contained in:
		| @@ -584,6 +584,12 @@ void Animation::next_frame() { | ||||
|     this->current_frame_ = 0; | ||||
|   } | ||||
| } | ||||
| void Animation::prev_frame() { | ||||
|   this->current_frame_--; | ||||
|   if (this->current_frame_ < 0) { | ||||
|     this->current_frame_ = this->animation_frame_count_ - 1; | ||||
|   } | ||||
| } | ||||
|  | ||||
| DisplayPage::DisplayPage(display_writer_t writer) : writer_(std::move(writer)) {} | ||||
| void DisplayPage::show() { this->parent_->show_page(this); } | ||||
|   | ||||
| @@ -478,6 +478,7 @@ class Animation : public Image { | ||||
|   int get_animation_frame_count() const; | ||||
|   int get_current_frame() const; | ||||
|   void next_frame(); | ||||
|   void prev_frame(); | ||||
|  | ||||
|  protected: | ||||
|   int current_frame_; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user