2020-04-13 11:24:53 +00:00
|
|
|
#include "animatable.h"
|
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
using namespace base;
|
|
|
|
|
|
|
|
namespace eng {
|
|
|
|
|
2020-09-17 22:03:21 +00:00
|
|
|
void Animatable::Translate(const Vector2& pos) {
|
|
|
|
position_ += pos;
|
2020-04-13 11:24:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Animatable::Scale(const Vector2& scale) {
|
2020-09-17 22:03:21 +00:00
|
|
|
scale_ = scale;
|
2020-04-13 11:24:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Animatable::Scale(float scale) {
|
2020-09-17 22:03:21 +00:00
|
|
|
scale_ = {scale, scale};
|
2020-04-13 11:24:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Animatable::Rotate(float angle) {
|
|
|
|
theta_ += angle;
|
|
|
|
rotation_.x = sin(theta_);
|
|
|
|
rotation_.y = cos(theta_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Animatable::SetTheta(float theta) {
|
|
|
|
theta_ = theta;
|
|
|
|
rotation_.x = sin(theta_);
|
|
|
|
rotation_.y = cos(theta_);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace eng
|