Replace spinner with bouncing whale animation

This commit is contained in:
2026-05-31 19:50:57 +02:00
parent 837c34320e
commit 5a92bf8ed3
2 changed files with 20 additions and 14 deletions
+11
View File
@@ -0,0 +1,11 @@
import time, sys
width = 40; direction = 1; pos = 0; whales = ['🐋', '🐳']; frame = 0
for _ in range(80):
bar = [' '] * width
bar[pos] = whales[frame % 2]
sys.stdout.write('\r[' + ''.join(bar) + ']')
sys.stdout.flush()
pos += direction; frame += 1
if pos <= 0 or pos >= width - 1: direction *= -1
time.sleep(0.05)
print()
+9 -14
View File
@@ -600,24 +600,19 @@ fn draw_status_bar(f: &mut Frame, area: Rect, app: &AppState) {
f.render_widget(Paragraph::new(line), area);
}
// Spinner
// Whale spinner — bounces across the status bar
if app.spinner_active {
if let Some(start) = app.spinner_start {
let elapsed = start.elapsed().as_millis() as u64;
let frames = &["", "", "", "", "", "", "", "", "", ""];
let idx = ((elapsed / 80) % frames.len() as u64) as usize;
let spinner = Paragraph::new(Span::styled(
frames[idx],
Style::default().fg(Color::Cyan),
));
let bar_w = area.width.saturating_sub(4) as u64;
let period = bar_w.max(2) * 2;
let t = (elapsed / 80) % period;
let x = if t < bar_w { t } else { period - t };
let whale = if (elapsed / 160) % 2 == 0 { "🐋" } else { "🐳" };
let x_u16 = (x as u16).min(area.width.saturating_sub(8));
f.render_widget(
spinner,
Rect {
x: area.width.saturating_sub(4),
y: area.y,
width: 3,
height: 1,
},
Paragraph::new(Span::styled(whale, Style::default().fg(Color::Cyan))),
Rect { x: area.x + 2 + x_u16, y: area.y, width: 4, height: 1 },
);
}
}