2021-09-13 15:53:43 +03:00
|
|
|
//
|
|
|
|
// Created by Иван Ильин on 29.01.2021.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ENGINE_AROTATE_H
|
|
|
|
#define ENGINE_AROTATE_H
|
|
|
|
|
|
|
|
#include "Animation.h"
|
2021-10-09 13:41:12 +03:00
|
|
|
#include "../Object.h"
|
2021-09-13 15:53:43 +03:00
|
|
|
|
2021-10-12 20:18:56 +03:00
|
|
|
class ARotate final : public Animation {
|
2021-09-13 15:53:43 +03:00
|
|
|
private:
|
2021-10-28 16:58:02 +03:00
|
|
|
const std::weak_ptr<Object> _object;
|
|
|
|
const Vec3D _rotationValue;
|
2021-10-02 20:36:07 +03:00
|
|
|
|
2021-10-28 16:58:02 +03:00
|
|
|
void update() override {
|
2021-11-09 22:54:20 +03:00
|
|
|
auto obj = _object.lock();
|
|
|
|
|
|
|
|
if (obj == nullptr) {
|
2021-10-28 16:58:02 +03:00
|
|
|
stop();
|
|
|
|
return;
|
|
|
|
}
|
2021-09-13 15:53:43 +03:00
|
|
|
|
2021-11-09 22:54:20 +03:00
|
|
|
obj->rotate(_rotationValue * dprogress());
|
2021-10-28 16:58:02 +03:00
|
|
|
}
|
2021-10-31 11:39:08 +03:00
|
|
|
|
2021-10-28 16:58:02 +03:00
|
|
|
public:
|
2021-10-31 11:39:08 +03:00
|
|
|
ARotate(std::weak_ptr<Object> object, const Vec3D &r, double duration = 1, LoopOut looped = LoopOut::None,
|
|
|
|
InterpolationType interpolationType = InterpolationType::Bezier)
|
2021-10-31 22:11:04 +03:00
|
|
|
: Animation(duration, looped, interpolationType), _object(object), _rotationValue(r) {
|
2021-09-13 15:53:43 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //INC_3DZAVR_AROTATE_H
|