Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
lampda::modes::anims::fadein::GravityFadeIn< MaxParticles > Struct Template Reference

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.
 

Detailed Description

template<size_t MaxParticles = 20>
struct lampda::modes::anims::fadein::GravityFadeIn< MaxParticles >

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.

Parameters
MaxParticlesMaximum number of particles falling at the same time (throughput limit)

Member Function Documentation

◆ update_progress_rate()

template<size_t MaxParticles = 20>
void lampda::modes::anims::fadein::GravityFadeIn< MaxParticles >::update_progress_rate ( auto &  ctx,
const float  expectedProgress 
)
inline

Update the drop rate.

Parameters
[in]expectedProgressCurrent progress, from 0 to 1 (may start at any value)

The documentation for this struct was generated from the following file: