asset_default.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="template:media-width" content="1024">
  6. <meta name="template:media-height" content="1024">
  7. <style>
  8. html {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. body {
  13. margin: 0;
  14. padding: 0;
  15. width: 1080px;
  16. height: 1920px;
  17. font-family: 'PingFang SC', 'Source Han Sans', 'Microsoft YaHei', sans-serif;
  18. overflow: hidden;
  19. }
  20. .page-container {
  21. width: 1080px;
  22. height: 1920px;
  23. position: relative;
  24. overflow: hidden;
  25. }
  26. /* 1. Background Media Layer (背景媒体层)
  27. - For image assets: displays the image
  28. - For video assets: hidden (video is composited in later step)
  29. */
  30. .background-layer {
  31. position: absolute;
  32. top: 0;
  33. left: 0;
  34. width: 100%;
  35. height: 100%;
  36. z-index: 0;
  37. }
  38. .background-layer img {
  39. width: 100%;
  40. height: 100%;
  41. object-fit: contain;
  42. display: block;
  43. }
  44. /* Hide background layer when no image (video mode) */
  45. .background-layer:empty {
  46. display: none;
  47. }
  48. /* 2. Gradient Overlay (渐变遮罩)
  49. Ensures text readability regardless of background brightness
  50. Top: Darker for Title
  51. Middle: Transparent for Media visibility
  52. Bottom: Darker for Subtitles
  53. */
  54. .gradient-overlay {
  55. position: absolute;
  56. top: 0;
  57. left: 0;
  58. width: 100%;
  59. height: 100%;
  60. z-index: 1;
  61. background: linear-gradient(to bottom,
  62. rgba(0, 0, 0, 0.6) 0%,
  63. rgba(0, 0, 0, 0.1) 25%,
  64. rgba(0, 0, 0, 0.1) 60%,
  65. rgba(0, 0, 0, 0.8) 100%);
  66. }
  67. /* 3. Content Layer (内容层) */
  68. .content-layer {
  69. position: relative;
  70. z-index: 2;
  71. width: 100%;
  72. height: 100%;
  73. padding: 120px 80px 0px 80px;
  74. /* Top, Right, Bottom, Left */
  75. box-sizing: border-box;
  76. display: flex;
  77. flex-direction: column;
  78. justify-content: flex-start;
  79. color: #ffffff;
  80. }
  81. /* Title Styling */
  82. .video-title {
  83. font-size: 80px;
  84. font-weight: 700;
  85. line-height: 1.2;
  86. text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  87. margin-bottom: 40px;
  88. text-align: center;
  89. }
  90. /* Hide title when empty */
  91. .video-title:empty {
  92. display: none;
  93. }
  94. /* Flex spacer to push subtitle to bottom */
  95. .spacer {
  96. flex-grow: 1;
  97. }
  98. /* Narration/Subtitle Styling */
  99. .subtitle-wrapper {
  100. margin-bottom: 60px;
  101. }
  102. .text {
  103. font-size: 52px;
  104. font-weight: 500;
  105. line-height: 1.6;
  106. text-align: center;
  107. text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  108. backdrop-filter: blur(4px);
  109. }
  110. </style>
  111. </head>
  112. <body>
  113. <div class="page-container">
  114. <!-- Background Media Layer
  115. - For image assets: contains <img> tag
  116. - For video assets: empty (hidden by CSS)
  117. -->
  118. <div class="background-layer" id="bg-layer">
  119. <!-- Image will be inserted here for image assets only -->
  120. </div>
  121. <!-- Shadow Overlay for Text Readability -->
  122. <div class="gradient-overlay"></div>
  123. <!-- Main Content -->
  124. <div class="content-layer">
  125. <!-- Top Section: Title -->
  126. <div class="video-title">
  127. {{title}}
  128. </div>
  129. <!-- Spacer pushes content apart -->
  130. <div class="spacer"></div>
  131. <!-- Bottom Section: Narration/Text -->
  132. <div class="subtitle-wrapper">
  133. <div class="text">{{text}}</div>
  134. </div>
  135. </div>
  136. </div>
  137. <script>
  138. // Conditionally add image if provided
  139. (function () {
  140. var imageUrl = "{{image}}";
  141. var bgLayer = document.getElementById('bg-layer');
  142. // Only add img tag if image URL is provided and not empty
  143. if (imageUrl && imageUrl.trim() !== "" && imageUrl !== "None") {
  144. var img = document.createElement('img');
  145. img.src = imageUrl;
  146. img.alt = "Background";
  147. bgLayer.appendChild(img);
  148. }
  149. // Otherwise, bg-layer stays empty and gets hidden by CSS
  150. })();
  151. </script>
  152. </body>
  153. </html>