华诞画室作品,这是一个半成品
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

314 lines
6.4 KiB

2 years ago
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" conten="ie=edge">
  7. <title>华诞画室</title>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. main {
  14. height: 100%;
  15. width: 100%;
  16. overflow: scroll;
  17. scroll-snap-type: y mandatory;
  18. }
  19. .musicImg {
  20. width: 40px;
  21. position: fixed;
  22. z-index: 1;
  23. top: 2%;
  24. left: 85%;
  25. }
  26. .pageStyle {
  27. scroll-snap-align: center;
  28. height: 100%;
  29. width: 100%;
  30. position: relative;
  31. transition: 1s;
  32. }
  33. .page1 {
  34. background-image: url(img/bg.png);
  35. background-size: 100% 100%;
  36. }
  37. .caiDai {
  38. height: 235px;
  39. position: absolute;
  40. top: 55%;
  41. left: 8%;
  42. animation: BigtoSmall linear infinite 1s;
  43. }
  44. .tuoYuan {
  45. height: 60px;
  46. position: absolute;
  47. top: 48%;
  48. left: 52%;
  49. animation: BigtoSmall linear infinite;
  50. }
  51. .shouZhi {
  52. position: absolute;
  53. top: 55%;
  54. left: 40%;
  55. animation: chuo linear infinite 1s;
  56. }
  57. .page2 {
  58. background-image: url(img/bg2.png);
  59. background-size: 100% 100%;
  60. }
  61. .button-dongBi {
  62. width: 70px;
  63. position: absolute;
  64. top: 57%;
  65. left: 54%;
  66. }
  67. .tuoYuan2 {
  68. height: 25px;
  69. position: absolute;
  70. top: 57.5%;
  71. left: 60%;
  72. animation: BigtoSmall linear infinite 1s;
  73. }
  74. .shouZhi2 {
  75. width: 50px;
  76. position: absolute;
  77. top: 60%;
  78. left: 58%;
  79. animation: chuo linear infinite 1s;
  80. }
  81. .huaChuNiDe {
  82. width: 25px;
  83. position: absolute;
  84. top: 5%;
  85. left: 78%;
  86. }
  87. .guoQingZhuFu {
  88. width: 25px;
  89. position: absolute;
  90. top: 5%;
  91. left: 70%;
  92. }
  93. .page3 {
  94. background-image: url(img/未填色.png);
  95. background-size: 100% 100%;
  96. }
  97. .page3-black {
  98. width: 100%;
  99. height: 100%;
  100. background-image: url(img/灰度背景.png);
  101. }
  102. .dianJiTianSe {
  103. width: 300px;
  104. position: absolute;
  105. left: 10%;
  106. top: 30%;
  107. }
  108. .page4 {
  109. background-image: url(img/未填色.png);
  110. background-size: 100% 100%;
  111. }
  112. .wanChengBianSe {
  113. width: 100px;
  114. position: absolute;
  115. top: 80%;
  116. left: 20%;
  117. }
  118. .yiJianBianSe {
  119. width: 100px;
  120. position: absolute;
  121. top: 80%;
  122. left: 60%;
  123. }
  124. .page5 {
  125. background-image: url(./img/尾页.png);
  126. background-size: 100% 100%;
  127. }
  128. .page5-share {
  129. width: 100%;
  130. height: 100%;
  131. background-image: url(img/灰度背景.png);
  132. position: absolute;
  133. z-index: -1;
  134. }
  135. .xiongMaoTou {
  136. width: 250px;
  137. position: absolute;
  138. right: 0;
  139. }
  140. .chongWanYiCi {
  141. height: 75px;
  142. position: absolute;
  143. top: 85%;
  144. left: 15%;
  145. }
  146. .fenXiang {
  147. height: 75px;
  148. position: absolute;
  149. top: 85%;
  150. left: 68%;
  151. }
  152. @keyframes BigtoSmall {
  153. from {
  154. transform: scale(0.9);
  155. }
  156. 50% {
  157. transform: scale(1.1);
  158. }
  159. to {
  160. transform: scale(0.9);
  161. }
  162. }
  163. @keyframes chuo {
  164. from {
  165. transform: translate(5px, -5px);
  166. }
  167. 50% {
  168. transform: translate(0px, 0px);
  169. }
  170. to {
  171. transform: translate(5px, -5px);
  172. }
  173. }
  174. @keyframes zhuan {
  175. from {
  176. transform: rotate(0deg);
  177. }
  178. to {
  179. transform: rotate(360deg);
  180. }
  181. }
  182. </style>
  183. </head>
  184. <body>
  185. <main>
  186. <img class="musicImg" src="img/fu.png" />
  187. <audio id="bgm" loop="loop">
  188. <source src="media/BGM.mp3" type="audio/mp3" />
  189. </audio>
  190. <div class="pageStyle page1">
  191. <img class="caiDai" src="img/彩带.png" />
  192. <img class="tuoYuan" src="img/椭圆.png" onclick="turnPage(1)" />
  193. <img class="shouZhi" src="img/手指.png" />
  194. </div>
  195. <div class="pageStyle page2">
  196. <img class="button-dongBi" src="img/按钮-点击动笔.png" onclick="turnPage(2)" />
  197. <img class="tuoYuan2" src="img/椭圆.png" onclick="turnPage(2)" />
  198. <img class="shouZhi2" src="img/手指2.png" />
  199. <img class="huaChuNiDe" src="img/画出你的.png" />
  200. <img class="guoQingZhuFu" src="img/国庆祝福.png" />
  201. </div>
  202. <div class="pageStyle page3">
  203. <div class="page3-black">
  204. <img class="dianJiTianSe" src="img/点击空白处即可填色.png" onclick="turnPage(3)" />
  205. </div>
  206. </div>
  207. <div class="pageStyle page4 weiTianSe">
  208. <img class="wanChengBianSe" src="img/完成填色.png" onclick="wanChengTianSe(4)" />
  209. <img class="yiJianBianSe" src="img/一键变色.png" onclick="yiJianBianSe()" />
  210. </div>
  211. <div class="pageStyle page5">
  212. <img class="chongWanYiCi" src="img/重玩一次.png" onclick="turnPage(0)" />
  213. <img class="fenXiang" src="img/分享.png" onclick="fenXiang()" />
  214. <div class="page5-share" onclick="quXiaoFenXiang()">
  215. <img class="xiongMaoTou" src="img/熊猫头.png" />
  216. </div>
  217. </div>
  218. </main>
  219. <script type="text/javascript">
  220. //初始化适配高度
  221. var height = document.documentElement.clientHeight;
  222. if (height > 900) {
  223. alert("请使用手机端食用本作品");
  224. }
  225. document.body.style.height = height + 'px';
  226. //音乐播放
  227. var musicImg = document.querySelector(".musicImg");
  228. var bgm = document.querySelector("#bgm");
  229. musicImg.onclick = function() {
  230. if (bgm.paused) {
  231. bgm.play();
  232. musicImg.style.animation = "zhuan 4s linear infinite";
  233. musicImg.style.animationPlayState = "running";
  234. } else {
  235. bgm.pause();
  236. musicImg.style.animationPlayState = "paused";
  237. }
  238. }
  239. //翻页
  240. function turnPage(obj) {
  241. var pageStyle = document.querySelectorAll(".pageStyle")
  242. for (var i = 0; i < pageStyle.length; i++) {
  243. pageStyle[i].style.height = "0px";
  244. }
  245. pageStyle[obj].style.height = "100%";
  246. }
  247. function yiJianBianSe() {
  248. var page4 = document.querySelector(".page4");
  249. if (page4.className == "pageStyle page4 weiTianSe") {
  250. page4.style.backgroundImage = "url(img/已填色.png)";
  251. page4.className = "pageStyle page4 yiTianSe";
  252. } else {
  253. page4.style.backgroundImage = "url(img/未填色.png)";
  254. page4.className = "pageStyle page4 weiTianSe";
  255. }
  256. }
  257. function wanChengTianSe(obj) {
  258. var tainSe = document.querySelector(".yiTianSe");
  259. var tainSeState = tainSe == null ? true : false;
  260. if (tainSeState == false) {
  261. turnPage(obj);
  262. }
  263. }
  264. function fenXiang() {
  265. var shareBG = document.querySelector(".page5-share");
  266. shareBG.style.zIndex = "2";
  267. }
  268. function quXiaoFenXiang() {
  269. var shareBG = document.querySelector(".page5-share");
  270. shareBG.style.zIndex = "-1";
  271. }
  272. </script>
  273. </body>
  274. </html>