2021-09-13 15:53:43 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 29.01.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ENGINE_ATRANSLATE_H
|
|
|
|
#define ENGINE_ATRANSLATE_H
|
|
|
|
|
|
|
|
#include "Animation.h"
|
2021-10-09 13:41:12 +03:00
|
|
|
#include "../Object.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
|
|
|
|
class ATranslate : public Animation {
|
|
|
|
private:
|
2021-10-02 20:36:07 +03:00
|
|
|
std::shared_ptr<Object> _object;
|
|
|
|
|
2021-09-13 15:53:43 +03:00
|
|
|
Point4D value;
|
|
|
|
public:
|
2021-10-02 20:36:07 +03:00
|
|
|
ATranslate(std::shared_ptr<Object> object, const Point4D& t, double duration = 1, LoopOut looped = LoopOut::None, InterpolationType interpolationType = InterpolationType::bezier) {
|
|
|
|
_object = object;
|
2021-09-13 15:53:43 +03:00
|
|
|
_duration = duration;
|
|
|
|
_looped = looped;
|
|
|
|
_intType = interpolationType;
|
|
|
|
|
|
|
|
value = t;
|
|
|
|
}
|
|
|
|
|
2021-10-02 20:36:07 +03:00
|
|
|
bool update() override {
|
|
|
|
_object->translate(value * _dp);
|
2021-09-13 15:53:43 +03:00
|
|
|
return updateState();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //INC_3DZAVR_ATRANSLATE_H
|