Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
motion.hpp
Go to the documentation of this file.
1// motion — the small movements of the look, each a few lines where it is
2// drawn: a screen or a line that rises into place, a card that bows out, a
3// pill that slides to its new place, a chip that breathes once. All of them
4// time-based (aurore::getCPUTimeUsec: a slow frame skips ahead, a still frame
5// draws the end), none of them while effects::motion() says no (the lighter
6// effects, Reduced motion, the smoke test's still frames): then every helper
7// draws the end state at once, so the screens look the same at rest.
8//
9// A helper that moves a view adds a child to it (a box, drawn as nothing)
10// that advances the view's translation and alpha at each frame and goes
11// with the view: nothing to cancel, nothing left dangling when a tab is
12// replaced mid-movement.
13// Copyright (C) 2026 JigSawFr. GPLv3-or-later (see LICENSE.GPL).
14#pragma once
15
16#include <functional>
17#include <vector>
18#include <aurore.hpp>
19
20namespace motion
21{
26float progress(aurore::Time since, float duration_us);
28float ease_out(float t);
29float ease_in_out(float t);
30float back_out(float t);
31
35void reveal(aurore::View* view, float rise = 10.0f, int ms = 180, int delay_ms = 0);
38void reveal_all(const std::vector<aurore::View*>& views, float rise = 8.0f, int ms = 220, int stagger_ms = 35,
39 int limit = 8);
43void dismiss(aurore::View* view, std::function<void()> then, float rise = 8.0f, int ms = 200);
46void slide_from(aurore::View* view, float dx, float dy, int ms = 220);
48void breathe(aurore::View* view, float low = 0.45f, int ms = 700);
49} // namespace motion
Definition view.hpp:232
retro_time_t Time
Definition time.hpp:31
Definition motion.hpp:21
float ease_in_out(float t)
sine
float back_out(float t)
overshoots a little, then settles
void reveal_all(const std::vector< aurore::View * > &views, float rise=8.0f, int ms=220, int stagger_ms=35, int limit=8)
float progress(aurore::Time since, float duration_us)
float ease_out(float t)
Easings, 0..1 to 0..1.
void reveal(aurore::View *view, float rise=10.0f, int ms=180, int delay_ms=0)
void dismiss(aurore::View *view, std::function< void()> then, float rise=8.0f, int ms=200)
void slide_from(aurore::View *view, float dx, float dy, int ms=220)
void breathe(aurore::View *view, float low=0.45f, int ms=700)
view breathes once: to low alpha and back, over ms.
aurore::Time now()
Now, in µs (the clock every helper reads).