ui::KeyFrame¶
Header: winui/ui/Animation.hpp.
One key frame: a value at a time (milliseconds from the animation's start). Build one with the named factories, so kind and easing agree.
Example:
const std::vector<ui::KeyFrame> frames{
ui::KeyFrame::linear(0ms, 0.0f),
ui::KeyFrame::eased(300ms, 1.0f, ui::CubicEase{}),
ui::KeyFrame::discrete(600ms, 0.5f),
ui::KeyFrame::spline(900ms, 1.0f, ui::CubicBezier{0.8f, 0.0f, 0.2f, 1.0f}),
};
auto element = std::make_unique<ui::RectangleControl>();
element->start_animation(ui::AnimatedProperty::Opacity, ui::KeyFrameAnimation{.key_frames = frames});
time¶
Key time from the animation's start.
value¶
The value reached at time.
kind¶
How the segment ending at this frame interpolates.
easing¶
The segment's curve for Spline (a CubicBezier) and Easing; ignored otherwise.
linear¶
Interpolates linearly from the previous value.
discrete¶
Holds the previous value, then jumps to value at time.
spline¶
Interpolates along the cubic Bézier spline.
eased¶
Interpolates along easing.