#include "src/helpers/AnimatedVariable.hpp" #include #include #define IPC_SHAKE_START "shakestart" #define IPC_SHAKE_UPDATE "shakeupdate" #define IPC_SHAKE_END "shakeend" using namespace Hyprutils::Math; using namespace std::chrono; class CShake { public: CShake(); ~CShake(); /* calculates the new zoom factor for the current pos */ double update(Vector2D pos); private: /* tracks whether the current shake has already been announced in the ipc */ bool ipc = false; bool started = false; CAnimatedVariable zoom; steady_clock::time_point end; /* ringbuffer for last samples */ std::vector samples; /* we also store the distance for each sample to the last, so we do only compute this once */ std::vector samples_distance; int samples_index = 0; };