// SPDX-License-Identifier: MIT // // ES-DE Frontend // LambdaAnimation.h // // Custom animations, expressed as lambdas. // #ifndef ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H #define ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H #include "animations/Animation.h" #include class LambdaAnimation : public Animation { public: LambdaAnimation(const std::function& func, int duration) : mFunction {func} , mDuration {duration} { } virtual ~LambdaAnimation() = default; int getDuration() const override { return mDuration; } void apply(float t) override { mFunction(t); } private: std::function mFunction; int mDuration; }; #endif // ES_CORE_ANIMATIONS_LAMBDA_ANIMATION_H