ES-DE/src/animations/LambdaAnimation.h
Aloshi 7e9b20fac5 Added a fade in from black for ViewController.
Added LambdaAnimation (which lets you use a lambda for the apply method).
Useful for simple one-off animations.
Added animation slots - only one animation can play per slot.  This way
you can have two animations run at the same time.
2013-12-12 21:17:59 -06:00

21 lines
384 B
C++

#pragma once
#include "Animation.h"
class LambdaAnimation : public Animation
{
public:
LambdaAnimation(const std::function<void(float t)>& func, int duration) : mFunction(func), mDuration(duration) {}
int getDuration() const override { return mDuration; }
void apply(float t) override
{
mFunction(t);
}
private:
std::function<void(float t)> mFunction;
int mDuration;
};