소스 검색

音效修改

sunyadv 5 년 전
부모
커밋
cea0617354
2개의 변경된 파일58개의 추가작업 그리고 41개의 파일을 삭제
  1. 4 1
      minigame/WebContent/index.html
  2. 54 40
      minigame/WebContent/js/main.js

+ 4 - 1
minigame/WebContent/index.html

@@ -103,7 +103,10 @@
         </div>
     </div>
 
-	<img id="cover" style="width: 100%;height: 103%;position: absolute;top: 0;left: 0;z-index: 99999;display: none" src="./img/cover.png" onclick="hiddenCover()">
+    <div id="cover" style="width: 100%;height: 103%;position: absolute;top: 0;left: 0;z-index: 99999;display: none;background: rgba(0,0,0,0.2)" onclick="hiddenCover()">
+        <img style="width: 100%;height: 100%;" src="./img/cover.png">
+    </div>
+
 
     <div class="secret-box">
         <img src="./img/poster/secret1.png" id="secret">

+ 54 - 40
minigame/WebContent/js/main.js

@@ -109,7 +109,7 @@ function handleComplete(evt, comp) {
         $(".cut-mode2").show();
         setTimeout(function(){  $(".cut-mode2").hide(); }, 1500);
         $(".cut-mode2").on("touchend",function(){
-            $(this).hide();  
+            $(this).hide();
         })
 
         $(".move-mode2").on("touchend",function(){
@@ -160,22 +160,32 @@ function handleComplete(evt, comp) {
 
 
     function ballAnim(dom) {
+        var video = "";
+        if(dishIndex == 0){
+            video = createjs.Sound.play("soup");//播放
+        }else if(dishIndex == 1){
+            video = createjs.Sound.play("soup");//播放
+        }
+        video.volume = 0.4;
+        setTimeout(function(){
+            video.paused = true;
+        }, 3500);
         var anim = new TimelineMax({ repeat: -1 });
         anim.to(dom, 0.15, { rotation: "-=15", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "+=30", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "-=30", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "+=30", ease: Power0.easeIn })
-        .to(dom, 0.15, { rotation: "-=15", ease: Power0.easeIn });
+            .to(dom, 0.3, { rotation: "+=30", ease: Power0.easeIn })
+            .to(dom, 0.3, { rotation: "-=30", ease: Power0.easeIn })
+            .to(dom, 0.3, { rotation: "+=30", ease: Power0.easeIn })
+            .to(dom, 0.15, { rotation: "-=15", ease: Power0.easeIn });
         return anim;
     }
 
     function materialAnim(dom, x, y, callback) {
         var anim = new TimelineMax({ onComplete: callback });
         anim.to(dom, 0.5, { x: "+=" + x, y: "+=" + y, ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "-=25", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "+=25", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "-=25", ease: Power0.easeIn })
-        .to(dom, 0.3, { rotation: "+=25", ease: Power0.easeIn });
+            .to(dom, 0.3, { rotation: "-=25", ease: Power0.easeIn })
+            .to(dom, 0.3, { rotation: "+=25", ease: Power0.easeIn })
+            .to(dom, 0.3, { rotation: "-=25", ease: Power0.easeIn })
+            .to(dom, 0.3, { rotation: "+=25", ease: Power0.easeIn });
         return anim;
     }
 
@@ -187,35 +197,35 @@ function handleComplete(evt, comp) {
         }
         var anim = new TimelineMax({ delay:0.8});
         anim.to(dom, 0.4, { alpha: 1, ease: Power0.easeIn })
-        .to(dom, 1, { scale: 1, ease: Power0.easeIn })
+            .to(dom, 1, { scale: 1, ease: Power0.easeIn })
         return anim;
     }
     function bowlAnim(callback) {
         var anim = new TimelineMax({ onComplete: callback, delay: 0.3 });
         anim.to(exportRoot.plate, 0.5, { y: "-=370", ease: Power0.easeIn })
-        .to(exportRoot.bowl, 0.5, { alpha: 1, ease: Power0.easeIn });
+            .to(exportRoot.bowl, 0.5, { alpha: 1, ease: Power0.easeIn });
         return anim;
     }
 
     function proAnim(callback) {
         var anim = new TimelineMax({ onComplete: callback, delay: 0.5 });
         anim.to(exportRoot.pro.proImg, 0.5, { rotation: "-=25", ease: Power0.easeIn })
-        .to(exportRoot.pro.oil_icon1, 0.3, {alpha:1})
-        .to(exportRoot.pro.oil_icon2, 0.2, {alpha:1})
-        .to(exportRoot.pro.proImg, 1, {})
-        .to(exportRoot.pro, 0.3, { alpha: 0, ease: Power0.easeIn })
-        .to(exportRoot.pro, 1, {})
+            .to(exportRoot.pro.oil_icon1, 0.3, {alpha:1})
+            .to(exportRoot.pro.oil_icon2, 0.2, {alpha:1})
+            .to(exportRoot.pro.proImg, 1, {})
+            .to(exportRoot.pro, 0.3, { alpha: 0, ease: Power0.easeIn })
+            .to(exportRoot.pro, 1, {})
         return anim;
     }
     function oilIconAnim() {
         oilAnim();
-        var video = "" , noice = "";
+        var video = "" , noice = "" , soup = "";
         if(dishIndex == 0){
             noice = createjs.Sound.play("hsr");//播放
             video = createjs.Sound.play("oil");//播放
         }else if(dishIndex == 1){
             noice = createjs.Sound.play("qcdf");//播放
-            video = createjs.Sound.play("soup");//播放
+            soup = createjs.Sound.play("soup");//播放
         }else if(dishIndex == 2){
             noice = createjs.Sound.play("swy");//播放
         }else{
@@ -224,7 +234,11 @@ function handleComplete(evt, comp) {
         }
         noice.volume = 1;
         video.volume = 0.2;
-        setTimeout(function(){ video.paused = true; }, 4500);
+        soup.volume = 0.3;
+        setTimeout(function(){
+            video.paused = true;
+            soup.paused = true;
+        }, 4500);
 
         var anim = new TimelineMax({ repeat:10,delay:1});
         anim.to(exportRoot.pro.oil_icon2, 0.3, {y:"+=100",alpha:0})
@@ -234,7 +248,7 @@ function handleComplete(evt, comp) {
     function btnAnim(dom){
         var anim = new TimelineMax({ repeat:-1 });
         anim.to(dom, 0.3, { scale: "+=0.1", ease: Power0.easeIn })
-        .to(dom, 0.3, { scale: "-=0.1", ease: Power0.easeIn })
+            .to(dom, 0.3, { scale: "-=0.1", ease: Power0.easeIn })
         return anim;
     }
     function fadeInAnim(dom){
@@ -317,12 +331,12 @@ function handleComplete(evt, comp) {
     ]
     // 红烧肉的位置
     var hsr_iconArr = [{
-            x: exportRoot.plate.x + exportRoot.plate.hsr_icon1.x,
-            y: exportRoot.plate.y + exportRoot.plate.hsr_icon1.y,
-            width: 202,
-            height: 129,
-            isClear: false
-        },
+        x: exportRoot.plate.x + exportRoot.plate.hsr_icon1.x,
+        y: exportRoot.plate.y + exportRoot.plate.hsr_icon1.y,
+        width: 202,
+        height: 129,
+        isClear: false
+    },
         {
             x: exportRoot.plate.x + exportRoot.plate.hsr_icon2.x,
             y: exportRoot.plate.y + exportRoot.plate.hsr_icon2.y,
@@ -347,12 +361,12 @@ function handleComplete(evt, comp) {
     ];
     // 青菜豆腐的位置
     var qcdf_iconArr = [{
-            x: exportRoot.plate.x + exportRoot.plate.qcdf_icon1.x,
-            y: exportRoot.plate.y + exportRoot.plate.qcdf_icon1.y,
-            width: 169,
-            height: 320,
-            isClear: false
-        },
+        x: exportRoot.plate.x + exportRoot.plate.qcdf_icon1.x,
+        y: exportRoot.plate.y + exportRoot.plate.qcdf_icon1.y,
+        width: 169,
+        height: 320,
+        isClear: false
+    },
         {
             x: exportRoot.plate.x + exportRoot.plate.qcdf_icon2.x,
             y: exportRoot.plate.y + exportRoot.plate.qcdf_icon2.y,
@@ -730,7 +744,7 @@ function handleComplete(evt, comp) {
         var x, y, z, last_x = 0,
             last_y = 0,
             last_z = 0;
-		var createTime = false;
+        var createTime = false;
 
         function deviceMotionHandler(eventData) {
             var acceleration = eventData.accelerationIncludingGravity;
@@ -744,10 +758,10 @@ function handleComplete(evt, comp) {
                 var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000;
                 if (speed > SHAKE_THRESHOLD) {
                     if(!createTime) {
-						createTime = true;
-						var video = createjs.Sound.play("shake");//播放
-						setTimeout(function(){ video.paused = true;createTime = false; }, 2500);
-					}
+                        createTime = true;
+                        var video = createjs.Sound.play("shake");//播放
+                        setTimeout(function(){ video.paused = true;createTime = false; }, 2500);
+                    }
                     $(".shake-mode2").hide();
                     $(".shake-mode").show();
                     shake_cnt++;
@@ -766,7 +780,7 @@ function handleComplete(evt, comp) {
                             if(document.location.href.indexOf('type') == -1){
                                 var href = document.location.href + (document.location.href.indexOf('?') > -1?'&':'?') + "type=" + chooseType + "&food=" + dishIndex;
                                 history.pushState("", "Title", href);
-                        	}
+                            }
 
                             if(dishIndex == 0){
                                 exportRoot.pot.hsr.gotoAndStop(3);
@@ -813,7 +827,7 @@ function getInfo() {
     var ua = navigator.userAgent.toLowerCase();
     var isMobile = false;
     if (!!navigator.userAgent.match(/AppleWebKit.*Mobile.*/)) {
-    	isMobile = true;
+        isMobile = true;
         if (ua.match(/MicroMessenger/i) == "micromessenger") {
             type = 0;
             url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
@@ -901,7 +915,7 @@ function getInfo() {
 
         init();
         if (isMobile && !window.ifDebug) {
-        	getMsg();
+            getMsg();
         }
 
     }