Camera is now using Animate2 and it's mostly working, but there's a few more refactors needed.
This commit is contained in:
parent
46cc21ec7b
commit
364f66bffb
14 changed files with 106 additions and 62 deletions
46
ease2.cpp
46
ease2.cpp
|
|
@ -60,47 +60,47 @@ namespace ease2 {
|
|||
return Random::normal(0.5f, 0.1f);
|
||||
}
|
||||
|
||||
void move_shake(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
pos_out.x += std::lerp(tr.min_x, tr.max_x, tick);
|
||||
void move_shake(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
pos_out.x = std::lerp(tr.min_x, tr.max_x, tick) + (pos_out.x * relative);
|
||||
}
|
||||
|
||||
void move_bounce(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
pos_out.y -= std::lerp(tr.min_y, tr.max_y, tick);
|
||||
void move_bounce(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
pos_out.y = std::lerp(tr.min_y, tr.max_y, tick) + (pos_out.y * relative);
|
||||
}
|
||||
|
||||
void move_rush(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick);
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick);
|
||||
pos_out.y = pos_out.y - (pos_out.y * scale_out.y - pos_out.y);
|
||||
void move_rush(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick) + (scale_out.x * relative);
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick) + (scale_out.y * relative);
|
||||
pos_out.y = pos_out.y - (pos_out.y * scale_out.y - pos_out.y) + (pos_out.y * relative);
|
||||
}
|
||||
|
||||
void scale_squeeze(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick);
|
||||
void scale_squeeze(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick) + (scale_out.x * relative);
|
||||
}
|
||||
|
||||
void scale_squash(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick);
|
||||
void scale_squash(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick) + (scale_out.y * relative);
|
||||
}
|
||||
|
||||
void scale_stretch(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick);
|
||||
void scale_stretch(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.x = std::lerp(tr.min_x, tr.max_x, tick) + (scale_out.x * relative);
|
||||
}
|
||||
|
||||
void scale_grow(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick);
|
||||
void scale_grow(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.y = std::lerp(tr.min_y, tr.max_y, tick) + (scale_out.y * relative);
|
||||
}
|
||||
|
||||
void move_slide(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
pos_out.x += std::lerp(tr.min_x, tr.max_x, tick);
|
||||
pos_out.y += std::lerp(tr.min_y, tr.max_y, tick);
|
||||
void move_slide(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
pos_out.x = std::lerp(tr.min_x, tr.max_x, tick) + (pos_out.x * relative);
|
||||
pos_out.y = std::lerp(tr.min_y, tr.max_y, tick) + (pos_out.y * relative);
|
||||
}
|
||||
|
||||
void move_none(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
void move_none(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
}
|
||||
|
||||
void scale_only(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick) {
|
||||
scale_out.x = std::lerp(scale_out.x * tr.min_x, scale_out.x * tr.max_x, tick);
|
||||
scale_out.y = std::lerp(scale_out.y * tr.min_y, scale_out.y * tr.max_y, tick);
|
||||
void scale_only(Transform &tr, sf::Vector2f& pos_out, sf::Vector2f& scale_out, float tick, bool relative) {
|
||||
scale_out.x = std::lerp(scale_out.x * tr.min_x, scale_out.x * tr.max_x, tick) + (scale_out.x * relative);
|
||||
scale_out.y = std::lerp(scale_out.y * tr.min_y, scale_out.y * tr.max_y, tick) + (scale_out.y * relative);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, EaseFunc> map_of_easings{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue