run.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <style>
  2. .bg-box {
  3. position: absolute;
  4. top: 0;
  5. left: 0;
  6. width: 100%;
  7. }
  8. .bg-box .close {
  9. position: fixed;
  10. top: 15px;
  11. right: 15px;
  12. z-index: 997;
  13. width: 36px;
  14. }
  15. .bg-box .bg {
  16. height: 100%;
  17. width: 100%;
  18. position: fixed;
  19. z-index: 996;
  20. top: 0;
  21. left: 0;
  22. }
  23. .bg-box .entry {
  24. position: absolute;
  25. z-index: 997;
  26. width: 120px;
  27. padding: 1rem 1rem;
  28. color: #222;
  29. background-color: #d6982e;
  30. margin: 0 auto;
  31. top: 40rem;
  32. right: 0;
  33. left: 0;
  34. border-radius: 20px;
  35. font-weight: bold;
  36. font-size: 16px;
  37. }
  38. .bubbly-button {
  39. font-family: 'Helvetica', 'Arial', sans-serif;
  40. display: inline-block;
  41. font-size: 1em;
  42. padding: 1em 2em;
  43. margin-top: 100px;
  44. margin-bottom: 60px;
  45. -webkit-appearance: none;
  46. appearance: none;
  47. background-color: #d6982e;
  48. color: #fff;
  49. border-radius: 4px;
  50. border: none;
  51. cursor: pointer;
  52. position: relative;
  53. transition: transform ease-in 0.1s, box-shadow ease-in 0.25s;
  54. box-shadow: 0 2px 25px rgb(255, 89, 0);
  55. }
  56. .bubbly-button:focus {
  57. outline: 0;
  58. }
  59. .bubbly-button:before, .bubbly-button:after {
  60. position: absolute;
  61. content: '';
  62. display: block;
  63. width: 140%;
  64. height: 100%;
  65. left: -20%;
  66. z-index: -1000;
  67. transition: all ease-in-out 0.5s;
  68. background-repeat: no-repeat;
  69. }
  70. .bubbly-button:before {
  71. display: none;
  72. top: -75%;
  73. background-image: radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, transparent 20%, #d6982e 20%, transparent 30%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, transparent 10%, #d6982e 15%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%);
  74. background-size: 10% 10%, 20% 20%, 15% 15%, 20% 20%, 18% 18%, 10% 10%, 15% 15%, 10% 10%, 18% 18%;
  75. }
  76. .bubbly-button:after {
  77. display: none;
  78. bottom: -75%;
  79. background-image: radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, transparent 10%, #d6982e 15%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%), radial-gradient(circle, #d6982e 20%, transparent 20%);
  80. background-size: 15% 15%, 20% 20%, 18% 18%, 20% 20%, 15% 15%, 10% 10%, 20% 20%;
  81. }
  82. .bubbly-button:active {
  83. transform: scale(0.9);
  84. background-color: #d6982e;
  85. box-shadow: 0 2px 25px rgb(255, 89, 0);
  86. }
  87. .bubbly-button.animate:before {
  88. display: block;
  89. animation: topBubbles ease-in-out 0.75s forwards;
  90. }
  91. .bubbly-button.animate:after {
  92. display: block;
  93. animation: bottomBubbles ease-in-out 0.75s forwards;
  94. }
  95. @keyframes topBubbles {
  96. 0% {
  97. background-position: 5% 90%, 10% 90%, 10% 90%, 15% 90%, 25% 90%, 25% 90%, 40% 90%, 55% 90%, 70% 90%;
  98. }
  99. 50% {
  100. background-position: 0% 80%, 0% 20%, 10% 40%, 20% 0%, 30% 30%, 22% 50%, 50% 50%, 65% 20%, 90% 30%;
  101. }
  102. 100% {
  103. background-position: 0% 70%, 0% 10%, 10% 30%, 20% -10%, 30% 20%, 22% 40%, 50% 40%, 65% 10%, 90% 20%;
  104. background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
  105. }
  106. }
  107. @keyframes bottomBubbles {
  108. 0% {
  109. background-position: 10% -10%, 30% 10%, 55% -10%, 70% -10%, 85% -10%, 70% -10%, 70% 0%;
  110. }
  111. 50% {
  112. background-position: 0% 80%, 20% 80%, 45% 60%, 60% 100%, 75% 70%, 95% 60%, 105% 0%;
  113. }
  114. 100% {
  115. background-position: 0% 90%, 20% 90%, 45% 70%, 60% 110%, 75% 80%, 95% 70%, 110% 10%;
  116. background-size: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
  117. }
  118. }
  119. </style>
  120. <div class="bg-box">
  121. <img id="close" class="close" onclick="switchVoice()" style="display: none;" src="__CDN__/assets/shop/img/index/voice-close.png" alt="">
  122. <img id="open" class="close" onclick="switchVoice()" src="__CDN__/assets/shop/img/index/voice.png" alt="">
  123. <img id="bg" class="bg" style="display: none;" src="__CDN__/assets/shop/img/index/run.jpg" alt="">
  124. <audio id="audio" src="__CDN__/assets/shop/mp3/bgmusic.mp3" autoplay controls style="display: none;"></audio>
  125. <button id="entry" class="entry bubbly-button" style="display: none;" onClick="entry()">进入</button>
  126. </div>
  127. <script src="__CDN__/assets/shop/js/jquery.min.js"></script>
  128. <script type="text/javascript">
  129. $(function () {
  130. var loadRun = sessionStorage.getItem('cha.loadRun')
  131. loadRun = typeof (loadRun) != 'undefined' && loadRun != null ? loadRun : false;
  132. console.log(loadRun)
  133. if (!loadRun) {
  134. $("#app").hide();
  135. $("#bg").show();
  136. $("#entry").show();
  137. // guiRun();
  138. }else{
  139. switchVoice();
  140. //$(".p5Canvas").hide();
  141. }
  142. // 按钮效果
  143. var classname = document.getElementsByClassName("bubbly-button");
  144. for (var i = 0; i < classname.length; i++) {
  145. classname[i].addEventListener('click', animateButton, false);
  146. }
  147. })
  148. /**
  149. * 按钮事件
  150. */
  151. function animateButton(e) {
  152. e.preventDefault;
  153. e.target.classList.remove('animate');
  154. e.target.classList.add('animate');
  155. setTimeout(function(){
  156. e.target.classList.remove('animate');
  157. },700);
  158. }
  159. /**
  160. * 控制声音
  161. */
  162. function switchVoice(){
  163. var audio = document.getElementById('audio');
  164. if (audio.paused) {
  165. $(audio).attr('controls', true);
  166. audio.play();
  167. $("#open").show();
  168. $("#close").hide();
  169. $(".p5Canvas").hide();
  170. } else {
  171. $(audio).removeAttr('controls');
  172. audio.pause();
  173. $("#open").hide();
  174. $("#close").show();
  175. $(".p5Canvas").show();
  176. }
  177. }
  178. /**
  179. * 进入
  180. */
  181. function entry() {
  182. var audio = document.getElementById('audio');
  183. if (audio.paused) {
  184. $("")
  185. $(audio).attr('controls', true);
  186. audio.play();
  187. } else {
  188. $(audio).removeAttr('controls');
  189. audio.pause();
  190. }
  191. //return false;
  192. sessionStorage.setItem('cha.loadRun', true)
  193. setTimeout(function(){
  194. $("#bg").hide(200);
  195. $("#app").show();
  196. $("#entry").hide();
  197. }, 800)
  198. }
  199. </script>