animations: add missing inputblip

This commit is contained in:
Torrie Fischer 2023-02-18 16:16:51 +01:00
parent f4828b2361
commit c351621d9d
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#include "InputBlip.h"
InputBlip::InputBlip()
: Figment("InputBlip")
{
}
void
InputBlip::handleEvent(const InputEvent& evt)
{
if (evt.intent != InputEvent::None) {
m_time = qadd8(m_time, 5);
}
}
void
InputBlip::loop()
{
if (m_time > 0) {
m_time--;
}
}
void
InputBlip::render(Display* dpy) const
{
if (m_time > 0) {
dpy->pixelAt(0) = CRGB(0, brighten8_video(ease8InOutApprox(m_time)), 0);
}
}
STATIC_ALLOC(InputBlip);
STATIC_TASK(InputBlip);

View File

@ -0,0 +1,13 @@
#pragma once
#include "../Figments/Figments.h"
#include "../Static.h"
class InputBlip: public Figment {
public:
InputBlip();
void handleEvent(const InputEvent& evt) override;
void loop() override;
void render(Display* dpy) const override;
private:
uint8_t m_time = 0;
};