Decided that it's better to adjust the ease_rate manually/visually rather than try to math it. That's what the animator tool is for.
This commit is contained in:
parent
ca335d21e5
commit
7d79e75651
2 changed files with 11 additions and 6 deletions
|
|
@ -4,8 +4,12 @@
|
|||
#include "dbc.hpp"
|
||||
#include "rand.hpp"
|
||||
|
||||
constexpr float SUB_FRAME_SENSITIVITY = 0.999f;
|
||||
|
||||
namespace animate2 {
|
||||
std::vector<sf::IntRect> Animate2::calc_frames() {
|
||||
dbc::check($sequence.frames.size() == $sequence.durations.size(), "$sequence.frames.size() != $sequence.durations.size()");
|
||||
|
||||
std::vector<sf::IntRect> frames;
|
||||
|
||||
for(int frame_i : $sequence.frames) {
|
||||
|
|
@ -54,10 +58,11 @@ namespace animate2 {
|
|||
if($sequence.timer.getElapsedTime() >= duration) {
|
||||
$sequence.timer.restart();
|
||||
$sequence.current++;
|
||||
if($sequence.subframe > 0.9) $sequence.subframe = 0.0f;
|
||||
if($sequence.subframe > SUB_FRAME_SENSITIVITY) $sequence.subframe = 0.0f;
|
||||
frame_change = true;
|
||||
} else {
|
||||
$sequence.subframe = std::lerp($sequence.subframe, 1.0, $sequence.timer.DELTA * $transform.ease_rate);
|
||||
|
||||
fmt::println("subframe: {}, alpha: {}", $sequence.subframe, $sequence.timer.alpha);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue