diff --git a/src/vn.rs b/src/vn.rs index 0d4d065..1ab4e25 100644 --- a/src/vn.rs +++ b/src/vn.rs @@ -141,10 +141,14 @@ pub fn render_novel( let html = html! { div id="story-container" { div class="textbox-container" { - @for (index, scene) in scenes.iter().enumerate() { - div class="scene-section" data-section-index=(index) - style=(format!("display: {};", if index == 0 { "block" } else { "none" })) { - (maud::PreEscaped(scene)) + div class="scene-container" { + @for (index, scene) in scenes.iter().enumerate() { + div class="scene-section" data-section-index=(index) + style=(format!("display: {};", if index == 0 { "block" } else { "none" })) { + div class="scene-content" { + (maud::PreEscaped(scene)) + } + } } } @@ -219,16 +223,53 @@ pub fn render_novel( overflow: hidden; } - .textbox-content { + .scene-container { position: absolute; top: 0; left: 0; right: 0; bottom: 0; - display: flex; - flex-direction: column; - padding: 1rem; - justify-content: flex-end; + z-index: 1; + } + + .scene-content { + width: 100%; + height: 100%; + position: relative; + } + + .scene-section { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: none; + } + + .scene-section[style*='block'] { + display: flex !important; + align-items: center; + justify-content: center; + } + + .scene-section img { + width: 100%; + height: 100%; + object-fit: cover; + position: absolute; + top: 0; + left: 0; + } + + .textbox-content { + position: absolute; + bottom: 0; + left: 0; + right: 0; + z-index: 2; + background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 30%); + padding: 2rem; } .visual-novel-box {