pitrix/src/effect_animation.cpp

25 lines
608 B
C++

#include "effect_animation.h"
#include "functions.h"
AnimationEffect::AnimationEffect(AnimationData* anim, CRGB* bg, int x, int y) {
this->animation_data = anim;
this->bg_color = bg;
this->xOffset = x;
this->yOffset = y;
}
void AnimationEffect::start() {
this->animation = new Animation(this->animation_data);
this->animation->setBgColor(this->bg_color);
this->animation->setOffsets(this->xOffset, this->yOffset);
}
void AnimationEffect::stop() {
delete this->animation;
}
void AnimationEffect::loop() {
this->animation->drawFrame();
this->animation->advance();
}