feat(animasi): T-0.4 spike lolos — ticker 30 FPS + toast harmonica, CPU idle 2.75% (F-026 awal)
This commit is contained in:
1 parent
b8d2595ca9
commit
e5d5dba023
11 files changed
+501
-12
No files matched your search
+2
-2
@@ -66,7 +66,7 @@ tia hadir sebagai **satu binary mandiri (single static binary)** yang fleksibel
|
||||
| **Config** | go-yaml v3 | `gopkg.in/yaml.v3` | Baca/tulis config, diatur lewat layar Pengaturan di TUI (tanpa framework CLI) |
|
||||
| **Audio Engine** | Oto v3 | `github.com/ebitengine/oto/v3` | Pure-Go audio player (`CGO_ENABLED=0`), PulseAudio/PipeWire/ALSA fallback |
|
||||
| **Audio Assets** | Kenney Interface Sounds | CC0 1.0 Universal | Aset audio open-source tanpa royalti, WAV 44.1kHz mono embedded (<2MB) |
|
||||
| **Animation Engine**| Harmonica v2 | `charm.land/harmonica/v2` | Fisika pegas (spring physics) & timer ticker 30 FPS untuk animasi TUI |
|
||||
| **Animation Engine**| Harmonica | `github.com/charmbracelet/harmonica` (v0.2.0) | Fisika pegas (spring physics) & timer ticker 30 FPS untuk animasi TUI |
|
||||
| **CLI Dispatcher** | Native Go Router | Go standard library | Router ringan untuk mode CLI pendamping (`tia-love convert`, `tia-love ps`, dll) |
|
||||
|
||||
### Docker Interaction Strategy: Hybrid
|
||||
@@ -300,7 +300,7 @@ tia hadir sebagai **satu binary mandiri (single static binary)** yang fleksibel
|
||||
5. **Animated Sparklines:** Grafik telemetri CPU & Memory yang mengalir halus secara real-time.
|
||||
- **Acceptance Criteria:**
|
||||
- Framerate dibatasi maksimal 30 FPS untuk menjaga efisiensi daya dan CPU (< 3% idle CPU usage).
|
||||
- Ditenagai oleh `charm.land/harmonica/v2` untuk fisika transisi dan `tea.Tick` untuk timer event.
|
||||
- Ditenagai oleh `github.com/charmbracelet/harmonica` (spring physics) untuk fisika transisi dan `tea.Tick` untuk timer event.
|
||||
- Mode *Reduced Motion / Non-Animated*: opsi di layar Pengaturan untuk mematikan animasi bagi pengguna yang menginginkan tampilan statis atau berada di koneksi SSH dengan bandwidth sangat rendah.
|
||||
|
||||
#### F-027: Dashboard Beranda Keren (Home Dashboard View)
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
# Spike T-0.4 — Animasi ASCII 30 FPS + Toast (harmonica)
|
||||
|
||||
> Status: ✅ **LOLOS** · Tanggal: 2026-10-15 · Mesin: Linux (PipeWire aktif), terminal pty 120×40
|
||||
|
||||
## Tujuan (PRD Phase 0)
|
||||
|
||||
Prototipe animasi ASCII 30 FPS + toast slide-in, dan buktikan CPU idle < 3% (F-026).
|
||||
|
||||
## Cara menjalankan ulang
|
||||
|
||||
```bash
|
||||
# Laju tick headless (target 30 fps):
|
||||
TIA_ANIM_SPIKE=1 go test ./internal/ui/animation/ -run TestTickerRate -v -count=1
|
||||
|
||||
# CPU + bandwidth render di pty (fase anim ON vs reduced-motion OFF):
|
||||
python3 scripts/measure-cpu.py ./tia-love 8
|
||||
```
|
||||
|
||||
Interaktif: `make run` → `[t]` toast (slide-in/out + auto-dismiss 2.5 dtk + klik = tutup),
|
||||
`[a]` toggle reduced-motion, logo shimmer berjalan terus.
|
||||
|
||||
## Hasil
|
||||
|
||||
| Metrik | Target | Hasil |
|
||||
|---|---|---|
|
||||
| Laju tick | 30 fps | **29.1 fps** (59 tick / 2.024 dtk — jitter timer wajar) |
|
||||
| CPU fase animasi ON (shimmer tiap frame + toast) | < 3% (F-026) | **2.75%** ✅ |
|
||||
| CPU fase reduced-motion (ticker berhenti) | — | **0.50%** |
|
||||
| Output terminal fase ON | — | **9.1 KB/s** ≈ 310 B/frame (120×40) → diff renderer terbukti |
|
||||
|
||||
## Keputusan implementasi
|
||||
|
||||
- **Ticker**: `tea.Tick` (30 FPS) di-rearm tiap `TickMsg`, dengan **ID sesi** — saat loop
|
||||
di-restart (reduced-motion on/off) tick basi otomatis diabaikan; tick yang masih
|
||||
terjadwal tidak boleh menghidupkan ulang loop (bug ditemukan & ditambal saat spike).
|
||||
- **Spring**: `github.com/charmbracelet/harmonica` **v0.2.0** — *catatan koreksi PRD:*
|
||||
`charm.land/harmonica/v2` tidak ada; `charm.land/harmonica` ada tapi men-declare module
|
||||
path `github.com/charmbracelet/harmonica`, jadi import resmi = jalur github.
|
||||
- **Toast** (`internal/ui/components/toast.go`): tinggi tetap 4 baris (layout tidak melompat),
|
||||
slide via spring (damping 0.7), horizontal center, auto-dismiss `hold` 2.5 dtk.
|
||||
- **Logo shimmer** (`internal/ui/animation/logo.go`): kilau berjalan dengan interpolasi warna
|
||||
RGB per karakter (dim `overlay1` → bright `pink`), jarak sirkular — murah, tanpa aset.
|
||||
|
||||
## Temuan
|
||||
|
||||
1. CPU 2.75% masih **di bawah** target 3% tapi tipis — di hardware lambat bisa melewati.
|
||||
Mitigasi yang sudah ada & menyusul: reduced-motion (terbukti 0.5%), dan nanti ticker
|
||||
di-skip saat konten tidak berubah/tidak terlihat (Phase 1).
|
||||
2. Diff renderer (Cursed Renderer) efisien: hanya ~310 B/frame keluar walau layar 120×40.
|
||||
3. Jitter tick (29.1 vs 30) berasal dari penjadwalan timer + 1 frame ekstra saat quit;
|
||||
untuk animasi UI tidak terasa.
|
||||
|
||||
## Batasan (jujur)
|
||||
|
||||
- Angka CPU spesifik mesin ini; belum diuji di hardware low-end / terminal lambat (SSH).
|
||||
- Belum uji truecolor → 256/16 warna fallback (masuk kerja theme Phase 1).
|
||||
- Toast versi spike belum mendukung antrean (toast queue), hover-pause, dan klik-untuk-navigasi
|
||||
(F-025 penuh) — itu Phase 1.
|
||||
Reference in new issue
Block a user