Tweeny 4.1.0
A Tweening library for modern C++
Loading...
Searching...
No Matches

◆ complete

detail::event::complete_t complete {}
inlineconstexpr

Event triggered when the animation is at completion.

Fires whenever progress() is >= 1.0 (100%) after a step(), seek(), or jump() call. This means the callback will fire every time the tween is navigated to a completed state, not just the first time.

Common use cases:

  • Cleaning up resources after animation
  • Chaining animations sequentially
  • Triggering completion callbacks
  • Transitioning to next state
  • Playing sound effects or particle effects at end
Note
The callback fires every time the tween is at completion (progress >= 1.0). If you step to completion, then back, then forward to completion again, it will fire both times. Use response::unsubscribe if you want one-shot behavior.
auto tween = tweeny::from(0).to(100).during(60U).build();
printf("Animation at completion: %d\n", t.peek());
return tweeny::event::response::unsubscribe; // One-shot callback
});
tween.step(60); // Fires complete callback
tween.step(-10); // Now progress < 1.0
tween.step(10); // Would fire again, but we unsubscribed
auto step(int32_t frames) -> tween_value_t
Advances or rewinds the animation by a frame delta.
auto on(detail::event::step_t, Callback &&cb) -> void
Registers a callback for step() events.
A tween represents an animation between keyframes.
Definition tween.h:68
tweeny_builder< true, FirstValue, RemainingValues... > to(const FirstValue &firstComponent, const RemainingValues &... remainingComponents) &
Adds a target keyframe to the tween.
Definition tweeny.h:109
tweeny_builder & during(FrameCountsType... frame_counts)
Specifies per-component frame durations for the last keyframe segment.
Definition tweeny.h:245
constexpr detail::event::complete_t complete
Event triggered when the animation is at completion.
Definition event.h:174
@ unsubscribe
Unsubscribe after this callback.
Definition detail/event.h:116
tweeny_builder< false, FirstValue, RemainingValues... > from(FirstValue firstComponent, RemainingValues... remainingComponents)
Creates a new tween builder starting from the specified value(s).
Definition tweeny.h:347
See also
step For frame-by-frame events during animation
response::unsubscribe For one-shot completion handlers