summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/LaunchScreen.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LivingVillage.Desktop/LaunchScreen.fs')
-rw-r--r--src/LivingVillage.Desktop/LaunchScreen.fs32
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