claude done anims
This commit is contained in:
@@ -29,6 +29,9 @@ Image saved_images[MAX_IMAGES_SAVED] = {
|
||||
{},{}
|
||||
};
|
||||
|
||||
const RGB animation_data[MAX_ANIMATIONS_COUNT][MAX_ANIMATION_FRAME_COUNT][PANEL_PIXEL_COUNT][DISPLAY_MAX_X + 1] = {};
|
||||
Animation animations[MAX_ANIMATIONS_COUNT];
|
||||
|
||||
|
||||
short getTextNodeY2(TextNode *node)
|
||||
{
|
||||
@@ -338,6 +341,62 @@ void drawImageFromMemoryByIndex(unsigned char image_index, short pos_x, short po
|
||||
}
|
||||
}
|
||||
|
||||
void displayAnimationFrame(unsigned char animation_index)
|
||||
{
|
||||
unsigned short frame = animations[animation_index].current_frame;
|
||||
|
||||
for (unsigned char y = 0; y < PANEL_PIXEL_COUNT; y++)
|
||||
{
|
||||
for (unsigned char x = 0; x <= DISPLAY_MAX_X; x++)
|
||||
{
|
||||
const RGB& px = animation_data[animation_index][frame][y][x];
|
||||
setPixel(x, y, pixels.Color(px.r * brightness / 100, px.g * brightness / 100, px.b * brightness / 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tickAnimations()
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_ANIMATIONS_COUNT; i++)
|
||||
{
|
||||
if (!animations[i].is_playing) continue;
|
||||
|
||||
animations[i].frame_progress++;
|
||||
if (animations[i].frame_progress > animations[i].frame_delay)
|
||||
{
|
||||
animations[i].frame_progress = 0;
|
||||
animations[i].current_frame++;
|
||||
|
||||
if (animations[i].current_frame >= animations[i].frame_count)
|
||||
{
|
||||
if (animations[i].is_looping)
|
||||
{
|
||||
animations[i].current_frame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
animations[i].current_frame = animations[i].frame_count - 1;
|
||||
animations[i].is_playing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void playAnimation(unsigned char index, unsigned char frame_delay, bool loop)
|
||||
{
|
||||
animations[index].current_frame = 0;
|
||||
animations[index].frame_progress = 0;
|
||||
animations[index].frame_delay = frame_delay;
|
||||
animations[index].is_playing = true;
|
||||
animations[index].is_looping = loop;
|
||||
}
|
||||
|
||||
void stopAnimation(unsigned char index)
|
||||
{
|
||||
animations[index].is_playing = false;
|
||||
}
|
||||
|
||||
void handleDisappearTimers()
|
||||
{
|
||||
for (unsigned char i = 0; i < MAX_TEXT_NODES_COUNT; i++)
|
||||
@@ -429,7 +488,7 @@ void loop()
|
||||
TextNode* node = nullptr;
|
||||
if (bottom_text_state == 0)
|
||||
{
|
||||
node = addNewTextNode("Technik informatyk",
|
||||
node = addNewTextNode("Technik informatyk + ai, robotyka",
|
||||
pixels.Color(0, 0, 50), // blue (dimmed)
|
||||
false, DISPLAY_MAX_X, 9, 1, true, true, -1, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user