mirror of
https://git.allpurposem.at/mat/WiggleWobble.git
synced 2025-12-23 13:01:28 +01:00
33 lines
746 B
C++
33 lines
746 B
C++
#ifndef WW_WOBBLYWINDOW_H
|
|
#define WW_WOBBLYWINDOW_H
|
|
|
|
#include "renderpasses.h"
|
|
|
|
#include <hyprland/src/Compositor.hpp>
|
|
#include <hyprutils/math/Vector2D.hpp>
|
|
|
|
class CWobblyWindow {
|
|
struct SParticle {
|
|
Vector2D position;
|
|
Vector2D velocity;
|
|
};
|
|
|
|
Time::steady_tp m_lastTime {Time::steadyNow()};
|
|
|
|
public:
|
|
// static wobble parameters
|
|
static inline float s_springStrength = 500.f;
|
|
static inline float s_dampingStrength = 12.f;
|
|
static inline float s_drag = 0.4f;
|
|
|
|
std::vector<SParticle> m_particles;
|
|
std::vector<Vector2D> m_targetPositions;
|
|
std::optional<Vector2D> m_grabPosition {std::nullopt};
|
|
Vector2D m_windowMovement;
|
|
|
|
CWobblyWindow();
|
|
|
|
bool step(Time::steady_tp time);
|
|
};
|
|
#endif
|