ESPHome 2025.5.0
Loading...
Searching...
No Matches
animation.h
Go to the documentation of this file.
1#pragma once
3
5
6namespace esphome {
7namespace animation {
8
9class Animation : public image::Image {
10 public:
11 Animation(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, image::ImageType type,
12 image::Transparency transparent);
13
14 uint32_t get_animation_frame_count() const;
15 int get_current_frame() const;
16 void next_frame();
17 void prev_frame();
18
23 void set_frame(int frame);
24
25 void set_loop(uint32_t start_frame, uint32_t end_frame, int count);
26
27 protected:
28 void update_data_start_();
29
30 const uint8_t *animation_data_start_;
37};
38
39template<typename... Ts> class AnimationNextFrameAction : public Action<Ts...> {
40 public:
42 void play(Ts... x) override { this->parent_->next_frame(); }
43
44 protected:
46};
47
48template<typename... Ts> class AnimationPrevFrameAction : public Action<Ts...> {
49 public:
51 void play(Ts... x) override { this->parent_->prev_frame(); }
52
53 protected:
55};
56
57template<typename... Ts> class AnimationSetFrameAction : public Action<Ts...> {
58 public:
60 TEMPLATABLE_VALUE(uint16_t, frame)
61 void play(Ts... x) override { this->parent_->set_frame(this->frame_.value(x...)); }
62
63 protected:
65};
66
67} // namespace animation
68} // namespace esphome
virtual void play(Ts... x)=0
uint32_t get_animation_frame_count() const
Definition animation.cpp:25
const uint8_t * animation_data_start_
Definition animation.h:30
Animation(const uint8_t *data_start, int width, int height, uint32_t animation_frame_count, image::ImageType type, image::Transparency transparent)
Definition animation.cpp:8
void set_loop(uint32_t start_frame, uint32_t end_frame, int count)
Definition animation.cpp:18
void set_frame(int frame)
Selects a specific frame within the animation.
Definition animation.cpp:50
TEMPLATABLE_VALUE(uint16_t, frame) void play(Ts... x) override
Definition animation.h:60
uint8_t type
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5