feat(logo): timeline lineal de 7 fases amb glitch tail i durades al YAML
This commit is contained in:
1 parent
7d5a4cee8e
commit
f10671d9c0
7 files changed
+204
-76
No files matched your search
@@ -50,6 +50,8 @@ namespace Effects {
|
||||
burst_remaining_ms_ = 0;
|
||||
burst_y_norm_ = 0.0F;
|
||||
burst_dx_ = 0;
|
||||
tail_started_ = false;
|
||||
tail_remaining_ms_ = 0;
|
||||
}
|
||||
|
||||
void ScanReveal::tick(int delta_ms) {
|
||||
@@ -63,9 +65,13 @@ namespace Effects {
|
||||
burst_remaining_ms_ = std::max(0, burst_remaining_ms_ - delta_ms);
|
||||
}
|
||||
|
||||
// 3) Spawn d'un nou burst (només durant el scan, no al flash).
|
||||
// 3) Spawn d'un nou burst. Permès durant el scan i durant el
|
||||
// glitch tail post-flash; bloquejat exactament durant el
|
||||
// flash perquè aquell és un punt visual de tancament net.
|
||||
// Probabilitat per frame ≈ (per_sec/1000) · delta_ms.
|
||||
if (burst_remaining_ms_ == 0 && elapsed_ms_ < params_.duration_ms && params_.vhs_burst_per_sec > 0 && params_.vhs_burst_duration_ms > 0) {
|
||||
const bool TAIL_ACTIVE = tail_started_ && tail_remaining_ms_ > 0;
|
||||
const bool SCAN_ONGOING = elapsed_ms_ < params_.duration_ms;
|
||||
if (burst_remaining_ms_ == 0 && (SCAN_ONGOING || TAIL_ACTIVE) && params_.vhs_burst_per_sec > 0 && params_.vhs_burst_duration_ms > 0) {
|
||||
const float P = (static_cast<float>(params_.vhs_burst_per_sec) / 1000.0F) * static_cast<float>(delta_ms);
|
||||
std::uniform_real_distribution<float> dist01(0.0F, 1.0F);
|
||||
if (dist01(rng_) < P) {
|
||||
@@ -86,6 +92,17 @@ namespace Effects {
|
||||
if (flash_remaining_ms_ > 0) {
|
||||
flash_remaining_ms_ = std::max(0, flash_remaining_ms_ - delta_ms);
|
||||
}
|
||||
|
||||
// 5) Glitch tail: arranca un sol cop quan el scan ha acabat i el
|
||||
// flash s'ha esgotat. Si no hi havia flash configurat, també
|
||||
// arranca tot just acabar el scan.
|
||||
if (!tail_started_ && elapsed_ms_ >= params_.duration_ms && flash_remaining_ms_ <= 0 && params_.tail_glitch_ms > 0) {
|
||||
tail_started_ = true;
|
||||
tail_remaining_ms_ = params_.tail_glitch_ms;
|
||||
}
|
||||
if (tail_remaining_ms_ > 0) {
|
||||
tail_remaining_ms_ = std::max(0, tail_remaining_ms_ - delta_ms);
|
||||
}
|
||||
}
|
||||
|
||||
auto ScanReveal::isActive() const -> bool {
|
||||
@@ -94,8 +111,12 @@ namespace Effects {
|
||||
|
||||
auto ScanReveal::isFinished() const -> bool {
|
||||
if (params_.duration_ms <= 0) { return true; }
|
||||
// Acabat = scan al final + flash exhaurit (o sense flash).
|
||||
return elapsed_ms_ >= params_.duration_ms && flash_remaining_ms_ <= 0;
|
||||
// Acabat = scan al final + flash exhaurit + glitch tail
|
||||
// exhaurit (o sense tail configurat).
|
||||
const bool SCAN_DONE = elapsed_ms_ >= params_.duration_ms;
|
||||
const bool FLASH_DONE = flash_remaining_ms_ <= 0;
|
||||
const bool TAIL_DONE = (params_.tail_glitch_ms <= 0) || (tail_started_ && tail_remaining_ms_ <= 0);
|
||||
return SCAN_DONE && FLASH_DONE && TAIL_DONE;
|
||||
}
|
||||
|
||||
void ScanReveal::render(const Surface& src, int x, int y) const {
|
||||
@@ -118,15 +139,21 @@ namespace Effects {
|
||||
const int TIME_BUCKET = elapsed_ms_ / JITTER_TIME_BUCKET_MS;
|
||||
const int BURST_Y_PX = static_cast<int>(burst_y_norm_ * static_cast<float>(H));
|
||||
const bool BURST_ACTIVE = burst_remaining_ms_ > 0;
|
||||
// Durant el glitch tail post-flash, BAND_TOP queda just damunt
|
||||
// del peu del logo, fet que (amb el codi de jitter que segueix)
|
||||
// generaria jitter residual a les últimes files. Aquí el
|
||||
// suprimim explícitament: el tail només viu de bursts VHS.
|
||||
const bool TAIL_ACTIVE = tail_started_ && tail_remaining_ms_ > 0;
|
||||
|
||||
// Render fila a fila (només files revelades).
|
||||
for (int row = 0; row <= BAND_BOT && row < H; ++row) {
|
||||
int dx = 0;
|
||||
|
||||
// Jitter de banda: amplitud màxima a la banda, falloff
|
||||
// lineal cap als marges del radi de glitch.
|
||||
// lineal cap als marges del radi de glitch. Inactiu durant
|
||||
// el glitch tail (no hi ha banda).
|
||||
const int DIST_TO_BAND = std::abs(row - BAND_TOP);
|
||||
if (params_.glitch_band_radius_px > 0 && DIST_TO_BAND <= params_.glitch_band_radius_px && params_.glitch_amplitude_px > 0) {
|
||||
if (!TAIL_ACTIVE && params_.glitch_band_radius_px > 0 && DIST_TO_BAND <= params_.glitch_band_radius_px && params_.glitch_amplitude_px > 0) {
|
||||
const float FALLOFF = 1.0F - (static_cast<float>(DIST_TO_BAND) / static_cast<float>(params_.glitch_band_radius_px));
|
||||
const float JIT = rowJitter(row, TIME_BUCKET);
|
||||
dx += static_cast<int>(std::lround(
|
||||
|
||||
Reference in new issue
Block a user