From 3849252be9ee5a6b9ad6b31b0fe1a19767621baa Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 13:18:35 +0800 Subject: feat(desktop): 标题画面两秒确定性入场动画 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit entranceProgress 纯函数按帧计数(固定 60Hz 步长,禁实时时钟):黛瓦天际线自上 36px 落定、标题自下 24px 升起、水面带 2s 淡入、灯笼/面板同步;快照回归断言进度锚点(0/60/120/超时)与确定性;LV_AUTOPLAY_FLOW 标题停留 60 帧可直接采样入场过程。 --- src/LivingVillage.Desktop/Game.fs | 18 +++++++++++------- src/LivingVillage.Desktop/TitleScreen.fs | 6 ++++++ 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src/LivingVillage.Desktop') diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 9464c8b..51fa74d 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -595,19 +595,22 @@ type LivingVillageGame() as this = let y1 = if index = bandCount - 1 then height else y0 + bandHeight spriteBatch.Draw(pixel, Rectangle(0, y0, width, y1 - y0), Color(band.R, band.G, band.B))) layout.SkyBands - // Jiangnan skyline: eave tiles continuously, ridge tiles rising above them. + // Deterministic 2s entrance: skyline settles from above as the progress unwinds. + let entrance = TitleScreen.entranceProgress hudClock + let skylineDrop = int (36.0f * entrance) List.iteri (fun column slot -> let x = column * Sim.tilePixels let source = VillageArt.atlasTileRectangle slot if slot = fst TitleScreen.roofSlots then - spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, layout.RidgeY, Sim.tilePixels, Sim.tilePixels), source, Color.White) - spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, layout.EaveY, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle (snd TitleScreen.roofSlots), Color.White)) + spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, layout.RidgeY + skylineDrop, Sim.tilePixels, Sim.tilePixels), source, Color.White) + spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, layout.EaveY + skylineDrop, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle (snd TitleScreen.roofSlots), Color.White)) layout.RoofTileSlots // Water band drawn from the atlas water tile, reflecting the skyline above. + let waterColor = Color(150, 170, 178, int (255.0f * (1.0f - entrance))) for row in layout.WaterRows do for x in 0 .. Sim.tilePixels .. width - 1 do - spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, row, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle TitleScreen.waterSlot, Color(150, 170, 178)) + spriteBatch.Draw(artTextures.TileAtlas, Rectangle(x, row, Sim.tilePixels, Sim.tilePixels), VillageArt.atlasTileRectangle TitleScreen.waterSlot, waterColor) // Lantern glows along the water bank. let lanternColor, lanternHalo = TitleScreen.lanternColors @@ -617,9 +620,10 @@ type LivingVillageGame() as this = spriteBatch.Draw(pixel, Rectangle(lx - 1, ly - 7, 4, 2), Color(90, 60, 40)) spriteBatch.Draw(pixel, Rectangle(lx - 2, ly + 5, 6, 2), Color(90, 60, 40)) - // Title: large CJK atlas glyphs with a soft shadow for readability. - PixelText.draw spriteBatch pixel cjkAtlas (layout.TitleX + 4) (layout.TitleY + 4) layout.TitleScale (Color(12, 20, 28)) layout.TitleText - PixelText.draw spriteBatch pixel cjkAtlas layout.TitleX layout.TitleY layout.TitleScale (Color(235, 246, 232)) layout.TitleText + // Title rises into place as the entrance progress unwinds. + let titleLift = int (24.0f * entrance) + PixelText.draw spriteBatch pixel cjkAtlas (layout.TitleX + 4) (layout.TitleY + titleLift + 4) layout.TitleScale (Color(12, 20, 28)) layout.TitleText + PixelText.draw spriteBatch pixel cjkAtlas layout.TitleX (layout.TitleY + titleLift) layout.TitleScale (Color(235, 246, 232)) layout.TitleText // Menu panel floats over the lower half; translucent so the scene layers stay visible. spriteBatch.Draw(pixel, Rectangle(panelX, panelY, panelWidth, panelHeight), Color(11, 19, 27, 200)) diff --git a/src/LivingVillage.Desktop/TitleScreen.fs b/src/LivingVillage.Desktop/TitleScreen.fs index c05e472..0dcd693 100644 --- a/src/LivingVillage.Desktop/TitleScreen.fs +++ b/src/LivingVillage.Desktop/TitleScreen.fs @@ -82,6 +82,12 @@ module TitleScreen = let waterSlot = waterTileSlot let roofSlots = roofRidgeSlot, roofEaveSlot + /// Deterministic 2s entrance at the fixed 60Hz step: 1.0 = elements fully parked + /// off-screen at start, 0.0 = settled. Pure function of the frame counter. + let entranceProgress (frameCount: int64) : float32 = + if frameCount >= 120L then 0.0f + else 1.0f - float32 frameCount / 120.0f + let layout (viewportWidth: int) (viewportHeight: int) : TitleLayout = let width = max 320 viewportWidth let height = max 240 viewportHeight -- cgit v1.2.3