2019-05-29 22:49:54 +00:00
|
|
|
#include "effect_animation.h"
|
|
|
|
#include "functions.h"
|
|
|
|
|
2019-06-05 04:25:40 +00:00
|
|
|
AnimationEffect::AnimationEffect(AnimationData* anim, CRGB* bg, int x, int y) {
|
|
|
|
this->animation_data = anim;
|
|
|
|
this->bg_color = bg;
|
|
|
|
this->xOffset = x;
|
|
|
|
this->yOffset = y;
|
2019-05-29 22:49:54 +00:00
|
|
|
}
|
|
|
|
|
2019-06-05 04:25:40 +00:00
|
|
|
void AnimationEffect::start() {
|
2019-06-07 04:07:29 +00:00
|
|
|
this->animation = new Animation(this->animation_data);
|
|
|
|
this->animation->setBgColor(this->bg_color);
|
|
|
|
this->animation->setOffsets(this->xOffset, this->yOffset);
|
2019-05-29 22:49:54 +00:00
|
|
|
}
|
2019-06-05 04:25:40 +00:00
|
|
|
|
|
|
|
void AnimationEffect::stop() {
|
|
|
|
delete this->animation;
|
2019-05-29 22:49:54 +00:00
|
|
|
}
|
2019-06-05 04:25:40 +00:00
|
|
|
|
|
|
|
void AnimationEffect::loop() {
|
|
|
|
this->animation->drawFrame();
|
|
|
|
this->animation->advance();
|
2019-05-29 22:49:54 +00:00
|
|
|
}
|