Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
#include <chrono>
#include <iostream>
#include <random>
#include <thread>
auto main() -> int {
std::mt19937 gen{std::random_device()()};
std::uniform_real_distribution<float> dis{0.F, 1.F};
std::normal_distribution<float> nrm{0.5F, 1.5F};
progress_bar pba, pbb;
pba.set_min(0.F).set_max(1.F).set_width(20);
pbb.set_min(0.F).set_max(1.F).set_width(20);
using step_t = std::chrono::duration<float>;
step_t step{0.020F};
while(true) {
}
}
std::cout << pba.update(a.
update(step).get()).reformat().get()
<< pbb.update(b.
update(step).get()).reformat().get()
<< std::endl;
std::this_thread::sleep_for(step);
}
return 0;
}
static constexpr auto clamp(T x, Min min, Max max) noexcept
Clamps x to be between min and max.
Definition: functions.hpp:96
Common code is placed in this namespace.
Definition: eagine.hpp:21
Class representing a value animated between two points, with easing.
Definition: animated_value.hpp:20
auto update(F deltaT) -> auto &
Updates the transition factor by the specified amount.
Definition: animated_value.hpp:54
auto is_done() const noexcept -> bool
Indicates if the current transition factor is higher than current duration.
Definition: animated_value.hpp:60
auto set(T value, valid_if_positive< F > duration, S slope) -> auto &
Sets the next point to animate into, duration and sigmoid slope.
Definition: animated_value.hpp:31