diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 00:08:15 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 00:08:15 +0800 |
| commit | d85cce460fd7fbb8854fb11ba547be1baf576de7 (patch) | |
| tree | 2b96531615cc6171a5cd269cc767de68419dda04 /src/LivingVillage.Desktop/LaunchScreen.fs | |
| parent | 4f700fc2c33fcf32ccb6c8fc8d3b5320d51a6db8 (diff) | |
| download | living-village-d85cce460fd7fbb8854fb11ba547be1baf576de7.tar.gz | |
feat(desktop): P16 启动画面淡入(Esc/空格跳过)+ 开始界面收敛三项(开始/读档/退出)+ CJK 补字 238
Diffstat (limited to 'src/LivingVillage.Desktop/LaunchScreen.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/LaunchScreen.fs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/LaunchScreen.fs b/src/LivingVillage.Desktop/LaunchScreen.fs new file mode 100644 index 0000000..0977777 --- /dev/null +++ b/src/LivingVillage.Desktop/LaunchScreen.fs @@ -0,0 +1,32 @@ +namespace LivingVillage.Desktop + +/// 启动画面:固定的 60Hz 步进下,全部为帧计数的纯函数,确定性可复现。 +/// 标题淡入(revealProgress)、整屏暗幕退场(veilAlpha),Esc/空格可随时跳过。 +module LaunchScreen = + + let durationFrames = 150L + let fadeInFrames = 45L + let title = "江南水乡" + let subtitle = "Living Village" + let skipHint = "ESC 或 空格 跳过" + + let private clamp01 (value: float32) : float32 = + if value < 0.0f then 0.0f + elif value > 1.0f then 1.0f + else value + + /// 0 = 完全未显示,1 = 完全显现。帧计数纯函数。 + let revealProgress (frame: int64) : float32 = + if frame <= 0L then 0.0f + else clamp01 (float32 frame / float32 fadeInFrames) + + /// 整屏暗幕:起手 1,随进程退到 0(1 -> 0)。 + let veilAlpha (frame: int64) : float32 = + if frame <= 0L then 1.0f + elif frame >= durationFrames then 0.0f + else 1.0f - clamp01 (float32 frame / float32 durationFrames) + + let isComplete (frame: int64) : bool = frame >= durationFrames + + /// Esc 或 空格 触发跳过(调用方用“按下沿”结果,不做按键状态判定)。 + let skipRequested (escapePressed: bool) (spacePressed: bool) : bool = escapePressed || spacePressed |
