Skip to content
Snippets Groups Projects
user avatar
Jerome Humbert authored
Add two new methods to the `Tweenable<T>` trait:
- `set_elapsed(Duration)` sets the elapsed time of the tweenable. This
  is equivalent to `set_progress(duration().mul_f32(progress))`, with
  the added benefit of avoiding floating-point conversions and potential
  rounding errors resulting from it. `set_progress()` is now largely
  implemented in terms of and as a convenience wrapper to calling
  `set_elapsed()`.
- `elapsed()` which queries the elapsed time of the tweenable. This is
  equivalent to `duration().mul_f32(progress())`, again with better
  precision.

The elapsed API is the recommended way going forward to manipulate a
tweenable's time outside of the normal `tick()` flow. It supersedes the
progress API.

This change purposedly skips any discussion about what happens to
completion events when `set_progress()` or now `set_elpased()` is called
with a lower value than the current one to seek time back. This design
issue is logged as #60 and is still pending. The change also partially
addresses #31, but without removing any existing API or feature.
d295b91c
Name Last commit Last update