Skip to content
Snippets Groups Projects
  1. Mar 08, 2023
  2. Nov 16, 2022
    • Jerome Humbert's avatar
      Take `impl Into<RepeatCount>` for easier usage (#78) · 38082690
      Jerome Humbert authored
      Change the signature of `Tween::with_repeat_count()` to take an `impl
      Into<RepeatCount>` instead of a `RepeatCount` value, to make it easier
      to configure the `Tween`.
      
      Implement for `RepeatCount`:
      - `From<u32>` for an actual count, yielding `RepeatCount::Finite(value)`
      - `From<Duration>` for a duration "count", yielding
        `RepeatCount::For(value)`
      38082690
  3. Nov 15, 2022
  4. Nov 14, 2022
  5. Nov 09, 2022
    • Jerome Humbert's avatar
      Add completion event/callback on `Delay<T>` (#73) · e6bdbbce
      Jerome Humbert authored
      Change `Delay` into `Delay<T>`, and add support for raising a completion
      event or callback.
      
      Bug: #69
      e6bdbbce
    • Jerome Humbert's avatar
      Fix `bevy_text` plugin registration (#72) · e1f74a2c
      Jerome Humbert authored
      Fix registration of the `component_animator_system::<Text>` in the
      `TweeningPlugin` to depend on the new `bevy_text` feature, and not on
      the `bevy_ui` one.
      e1f74a2c
    • Jerome Humbert's avatar
      Fix incorrect change detection triggering (#71) · a3fecb10
      Jerome Humbert authored
      Ensure change detection on components and assets is only triggered when
      an animator effectively modifies said component or asset, and not
      invariably just by the simple fact of the animator ticking each frame.
      
      This change modifies the signature of the `component_animator_system()`
      and `asset_animator_system()` public functions to directly consume a
      `ResMut<Events<TweenCompleted>>` instead of an
      `EventWriter<TweenCompleted>`, to work around some internal limitations.
      
      It also publicly exposes a new `Targetable` trait used to work around
      the impossibility to retrieve a `Mut<T>` from a `Mut<Assets<T>>`.
      Instead, the trait provides an "target dereferencing" method
      `target_mut()` which dereferences the target component or asset, and
      triggers its change detection. The trait is implemented for all
      components via the `ComponentTarget` object, and for all assets via the
      `AssetTarget` object. The 3 types described here are publicly exposed to
      workaround some Bevy limitations, and because the trait appears in the
      public `Tweenable<T>` API. However users are discouraged from taking
      strong dependencies on those, as they will be removed once Bevy provides
      a way to achieve this conditionaly dereferencing without this
      workaround.
      
      Fixes #33
      a3fecb10
  6. Nov 06, 2022
  7. Oct 02, 2022
    • Jerome Humbert's avatar
      Add elapsed API (#67) · d295b91c
      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
    • Jerome Humbert's avatar
      Add `assert_approx_eq!()` testing macro (#66) · dd6ac741
      Jerome Humbert authored
      Clarify testing code and potential assertions message with the use of a
      new `assert_approx_eq!()` macro for `f32` equality check with a
      tolerance. The macro leverages `abs_diff_eq()` but produces a better
      assertion message in case of failure. It also allows skipping the
      tolerance parameter to use the default of `1e-5`, which is the
      "standard" tolerance to use for progress and other small-ish values that
      are expected to be equal but might be slightly off due to rounding
      errors.
      
      This change ignores the complications of testing for floating-point
      equality in a generic way, which is too complex, and instead restrict
      the usage to values like progress (range [0:1]) and other small position
      values around the origin.
      dd6ac741
    • shuo's avatar
      Add an example of menu hover animation (#59) · 15c5bdbd
      shuo authored
      15c5bdbd
  8. Oct 01, 2022
    • Jerome Humbert's avatar
      Add more tests (#65) · eeec3713
      Jerome Humbert authored
      Add some tests to fill gaps for:
      - `UiPositionLens`
      - `Animator::set_tweenable()` and `AssetAnimator::set_tweenable()`
      - `Sequence::from_single()`
      - `Delay`'s `then()`, `times_completed()`, and `set_progress()`
      eeec3713
    • Jerome Humbert's avatar
      Fix animator speed feature (#63) · 4c2f49da
      Jerome Humbert authored
      Fix the animator speed applying, which got broken as part of the
      refactor of #44.
      
      Add a `speed()` getter to both `Animator<T>` and `AssetAnimator<T>`.
      
      Add some simple test for speed, but this is not enough to make sure the
      feature doesn't regress, so logged #62 to follow-up with a proper
      regression test.
      
      Fixes #61
      4c2f49da
  9. Sep 29, 2022
  10. Sep 28, 2022
    • Jerome Humbert's avatar
      Fix repeat mode broken after first iteration (#57) · 175c8b74
      Jerome Humbert authored
      Fix the repeat mode being broken after the first iteration due to
      `AnimClock::progress()` reporting a progress greater than `1.`, which was
      breaking the logic of `Tween` and `Lens`.
      
      Also fix `Tween::rewind()` not restoring the original tween direction when
      using a repeat strategy of `RepeatStrategy::MirroredRepeat`.
      
      Fixes #42
      175c8b74
  11. Sep 27, 2022
  12. Sep 21, 2022
  13. Aug 12, 2022
  14. Aug 06, 2022
  15. Aug 04, 2022
  16. Aug 03, 2022
    • Jerome Humbert's avatar
      Fix build (#40) · 722b62ec
      Jerome Humbert authored
      722b62ec
    • Gyrobifastigium's avatar
    • Alex Saveau's avatar
      Support running an animation N times (#19) · 6a871576
      Alex Saveau authored
      Remove `TweeningType` and split its functionalities between a new `RepeatCount`
      controlling the number of repeats of an animation on one hand, and
      `RepeatStrategy` controlling the way an animation restarts after a loop ended
      on the other hand. This allows more granular control on the type of playback.
      
      Remove the `tweening_type` parameter from `Tween<T>::new()` and replace it with
      builder methods `with_repeat_count()` and `with_repeat_strategy()`.
      
      Remove `is_looping()` from all tweenables, which was not implemented for most
      of them anyway.
      6a871576
  17. Jul 10, 2022
  18. Jun 14, 2022
  19. Jun 01, 2022
  20. May 31, 2022
  21. May 17, 2022
Loading