Show HN: Rust 中的 Perlin 噪声终端动画(60 FPS,Truecolor)
发布: (2026年2月15日 GMT+8 21:02)
3 分钟阅读
原文: Hacker News
Source: Hacker News
perlin-terminal
为你的终端带来精美的 Perlin 噪声动画。使用 24‑bit 真彩色并通过半块字符实现双倍垂直分辨率,呈现平滑流动的渐变。
功能
- 真彩色渲染 — 完整的 24‑bit RGB 渐变
- 双倍垂直分辨率 — 使用
▀半块字符在每个单元格渲染 2 像素 - 多种配色主题 — Ocean、Fire、Aurora、Matrix
- 平滑动画 — 多八度 Perlin 噪声实现自然流动的运动
- 60 FPS — 为流畅渲染进行优化
- 自适应 — 能优雅地处理终端尺寸变化
- 干净退出 —
Ctrl+C/Q/Esc可恢复终端状态
安装
cargo install --git https://github.com/denisepattenson/perlin-terminal
或从源码构建:
git clone https://github.com/denisepattenson/perlin-terminal
cd perlin-terminal
cargo build --release
./target/release/perlin-terminal
使用方法
# 默认 ocean 主题
perlin-terminal
# Fire 主题
perlin-terminal --theme fire
# 极光(Aurora)
perlin-terminal --theme aurora
# Matrix 风格的绿色
perlin-terminal --theme matrix
# 自定义噪声和速度
perlin-terminal --theme fire --scale 0.04 --speed 0.8
参数选项
| 参数 | 默认值 | 描述 |
|---|---|---|
-t, --theme | ocean | 配色主题:ocean、fire、aurora、matrix |
-s, --scale | 0.06 | 噪声尺度(数值越小视野越放大) |
--speed | 0.4 | 动画速度倍率 |
--fps | 60 | 目标帧率 |
--seed | 42 | Perlin 噪声种子 |
控制键
- Q 或 Esc — 退出
- Ctrl +C — 退出
主题
🌊 Ocean
深蓝 → 皇家蓝 → 青色 → 青绿。宁静而迷人。
🔥 Fire
黑色 → 深红 → 橙色 → 黄色 → 白色。宛如凝视余烬。
🌌 Aurora
紫色 → 青绿 → 绿色 → 粉红。终端中的北极光。
💚 Matrix
黑色 → 深绿 → 亮绿。你懂的。
要求
- 支持 24‑bit 真彩色的终端(大多数现代终端)
- Rust 1.70+
许可证
MIT
