|
Lamp-Da 0.1
A compact lantern project
|
Reveal an animation with falling pixels. More...
#include <fadein.hpp>
Public Member Functions | |
| void | reset (auto &ctx) |
| void | loop (auto &ctx) |
| void | update_progress_rate (auto &ctx, const float expectedProgress) |
| Update the drop rate. | |
Protected Member Functions | |
| float | estimated_progress (auto &ctx) const |
| Progress estimated "now", including the fall duration so that pixels land on time. | |
| void | complete (auto &ctx) |
| void | spawn_pending (auto &ctx) |
| Spawn the particles needed to follow the estimated progress. | |
| bool | spawn_one (auto &ctx) |
| bool | is_candidate (auto &ctx, uint16_t x, int16_t y) |
| A masked pixel not already targeted by another particle. | |
| bool | pick_target (auto &ctx, uint32_t &targetId) |
| Pick a random target in the lowest line that still has free pixels. | |
| bool | land_if_arrived (auto &ctx, const size_t slot, const Particle &p) |
| Unmask the target and remove the particle once it has reached the target height. | |
Reveal an animation with falling pixels.
The whole lamp starts masked. Particles spawn at the top, fall, and unmask the pixel they land on. Landing targets are picked line by line from the bottom to the top (random inside the line), so the reveal rises uniformly: no empty column, no clump higher than one line. The spawn rate follows the (extrapolated) progress, and the lamp is fully unmasked when progress reaches 1.
| MaxParticles | Maximum number of particles falling at the same time (throughput limit) |
|
inline |
Update the drop rate.
| [in] | expectedProgress | Current progress, from 0 to 1 (may start at any value) |