浏览代码

调料菜单那部分需要进行确认

351035557@qq.com 5 年之前
父节点
当前提交
7996bc9638
共有 2 个文件被更改,包括 304 次插入228 次删除
  1. 156 152
      minigame/WebContent/index.html
  2. 148 76
      minigame/WebContent/js/main.js

+ 156 - 152
minigame/WebContent/index.html

@@ -1,153 +1,157 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0,minimal-ui">
-    <meta name="renderer" content="webkit">
-    <meta http-equiv="X-UA-Compatible" content="IE=Edge,Chrome=1">
-    <meta name="screen-orientation" content="portrait" /> <!-- uc强制竖屏 -->
-    <meta name="x5-orientation" content="portrait" />  <!-- QQ强制竖屏 -->
-    <meta name="apple-mobile-web-app-capable" content="yes" />
-    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
-    <meta name="format-detection" content="telphone=no" />
-    <meta name="format-detection" content="email=no" />
-    <title>贝蒂斯厨房</title>
-    <script src="./js/flexiable.js"></script>
-    <link rel="stylesheet" type="text/css" href="./css/animate.min.css?v=1">
-    <link rel="stylesheet" type="text/css" href="./css/main.css?v=1">
-    <script src="https://cdn.bootcss.com/SoundJS/1.0.2/soundjs.min.js"></script>
-  </head>
-<body onload="getInfo()">
-    <!-- loading -->
-    <div class="loading">
-        <div class="curtain-box">
-            <div class="txt rubberBand time6 iteration">
-                <img src="./img/loading/loading_txt.png">
-            </div>
-            <div class="loading-bar">
-                <p class="load-txt">远方快递正在为您准备美食...<span id="loadingTxt">80</span>%</p>
-                <div class="bar">
-                    <span id="loadingBar">
-                        <i class="icon-load"></i>
-                    </span>
-                </div>
-            </div>
-        </div>
-    </div>
-    <!-- 主内容 -->
-    <div class="warp">
-        <!-- 选择菜 -->
-        <div class="select-dish-box">
-            <img src="./img/menu_tt.png" class="tt fadeIn time4 animated js-an">
-            <div class="list">
-                <div class="item bounceIn time3 animated js-an delay3">
-                    <img src="./img/menu1.png">
-                </div>
-                <div class="item bounceIn time3 animated js-an delay4">
-                    <img src="./img/menu2.png">
-                </div>
-                <div class="item bounceIn time3 animated js-an delay5">
-                    <img src="./img/menu3.png">
-                </div>
-                <div class="item bounceIn time3 animated js-an delay6">
-                    <img src="./img/menu4.png">
-                </div>
-            </div>
-            <div class="confirm anim-btn"></div>
-        </div>
-        <!-- 游戏 -->
-        <div class="game-box">
-            <canvas id="canvas" width="640" height="1040"></canvas>
-        </div>
-    </div>
-    <!-- 海报 -->
-    <div class="poster-mode">
-        <img src="./img/logo.png" class="logo">
-        <img src="./img/poster/hsr.png" class="poster-img" id="poster">
-        <div class="leads-box">
-            <img src="./img/poster/headOil.png" class="pro">
-            <div class="form-group">
-                <input id="nameInput" type="text" placeholder="我想把这道菜送给TA">
-				<div id="nameText" class='msg' style='display:none;'></div>
-            </div>
-            <div class="form-group">
-                <input id="textInput" type="text" placeholder="我想对TA说">
-				<div id="text" class='msg' style='display:none;'></div>
-            </div>
-            <div class="user-info">
-                <div class="headimg-box">
-                    <img src="./img/headimg.png">
-                </div>
-                <p>微信昵称</p>
-            </div>
-            <!-- <div class="submit" onclick='saveText()'> -->
-                <!-- <img src="./img/share_btn.png"> -->
-            <!-- </div> -->
-        </div>
-        <div class="qrcode-box">
-            <!-- <img src="./img/poster/qrcode.jpg"> -->
-			<img src="./img/poster/ewm.png">
-            <p>扫码为他做菜</p>
-        </div>
-        <div class="replay-btn">
-            <img src="./img/replay_btn.png">
-        </div>
-        <!-- <div class="secret-btn"> -->
-            <!-- <img src="./img/secret_btn.png"> -->
-        <!-- </div> -->
-		<div class="secret-btn" onclick='saveText()'>
-            <img src="./img/share_btn.png">
-        </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 class="secret-box">
-        <img src="./img/poster/secret1.png" id="secret">
-    </div>
-
-    <!-- 摇一摇提示 -->
-    <div class="shake-mode">
-        <div class="shake-dialog">
-            <!-- <img src="./img/shake_fire.png"> -->
-            <div class="fire anim-fire" id="fire"></div>
-            <img src="./img/shake_icon.png" class="icon">
-            <img src="./img/shake_txt.png" class="txt">
-        </div>
-    </div>
-    <script src="./js/jquery.min.js"></script>
-    <script src="./js/create.js"></script>
-    <script src="./js/tweenmax.js"></script>
-    <script src="./js/wechat.js"></script>
-    <script src="./assets.js"></script>
-    <script src="./js/main.js"></script>
-    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
-    <script>
-        // 判断微信分享
-        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
-            // 发送给好友
-            WeixinJSBridge.on('menu:share:appmessage', function(argv){
-                // alert('发送给好友')
-                setTimeout(function(){
-                    window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
-                }, 6000);
-
-            });
-            // 分享到朋友圈
-            WeixinJSBridge.on('menu:share:timeline', function(argv){
-                // alert('分享到朋友圈')
-                setTimeout(function(){
-                    window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
-                }, 6000);
-
-            });
-        }, false);
-
-        // 判断微博分享
-        document.addEventListener('WeiboJSBridgeReady', function onBridgeReady() {
-
-        }, false);
-    </script>
-</body>
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0,minimal-ui">
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=Edge,Chrome=1">
+    <meta name="screen-orientation" content="portrait" /> <!-- uc强制竖屏 -->
+    <meta name="x5-orientation" content="portrait" />  <!-- QQ强制竖屏 -->
+    <meta name="apple-mobile-web-app-capable" content="yes" />
+    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
+    <meta name="format-detection" content="telphone=no" />
+    <meta name="format-detection" content="email=no" />
+    <title>贝蒂斯厨房</title>
+    <script src="./js/flexiable.js"></script>
+    <link rel="stylesheet" type="text/css" href="./css/animate.min.css?v=1">
+    <link rel="stylesheet" type="text/css" href="./css/main.css?v=1">
+    <script src="https://cdn.bootcss.com/SoundJS/1.0.2/soundjs.min.js"></script>
+</head>
+<body onload="getInfo()">
+    <!-- loading -->
+    <div class="loading">
+        <div class="curtain-box">
+            <div class="txt rubberBand time6 iteration">
+                <img src="./img/loading/loading_txt.png">
+            </div>
+            <div class="loading-bar">
+                <p class="load-txt">远方快递正在为您准备美食<span id="loadingTxt">80</span>%</p>
+                <div class="bar">
+                    <span id="loadingBar">
+                        <i class="icon-load"></i>
+                    </span>
+                </div>
+            </div>
+        </div>
+    </div>
+    <!-- 主内容 -->
+    <div class="warp">
+        <!-- 选择菜 -->
+        <div class="select-dish-box">
+            <img src="./img/menu_tt.png" class="tt fadeIn time4 animated js-an">
+            <div class="list">
+                <div class="item bounceIn time3 animated js-an delay3">
+                    <img src="./img/menu1.png">
+                </div>
+                <div class="item bounceIn time3 animated js-an delay4">
+                    <img src="./img/menu2.png">
+                </div>
+                <div class="item bounceIn time3 animated js-an delay5">
+                    <img src="./img/menu3.png">
+                </div>
+                <div class="item bounceIn time3 animated js-an delay6">
+                    <img src="./img/menu4.png">
+                </div>
+            </div>
+            <div class="confirm anim-btn"></div>
+        </div>
+        <!-- 游戏 -->
+        <div class="game-box">
+            <canvas id="canvas" width="640" height="1040"></canvas>
+        </div>
+    </div>
+    <!-- 海报 -->
+    <div class="poster-mode">
+        <img src="./img/logo.png" class="logo">
+        <img src="./img/poster/hsr.png" class="poster-img" id="poster">
+        <div class="leads-box">
+            <img src="./img/poster/headOil.png" class="pro">
+            <div class="form-group">
+                <input id="nameInput" type="text" placeholder="我想把这道菜送给TA">
+				<div id="nameText" class='msg' style='display:none;'></div>
+            </div>
+            <div class="form-group">
+                <input id="textInput" type="text" placeholder="我想对TA说">
+				<div id="text" class='msg' style='display:none;'></div>
+            </div>
+            <div class="user-info">
+                <div class="headimg-box">
+                    <img src="./img/headimg.png">
+                </div>
+                <p>微信昵称</p>
+            </div>
+            <!-- <div class="submit" onclick='saveText()'> -->
+                <!-- <img src="./img/share_btn.png"> -->
+            <!-- </div> -->
+        </div>
+        <div class="qrcode-box">
+            <!-- <img src="./img/poster/qrcode.jpg"> -->
+            <img src="./img/poster/ewm.png">
+            <p>扫码为他做菜</p>
+        </div>
+        <div class="replay-btn">
+            <img src="./img/replay_btn.png">
+        </div>
+        <!-- <div class="secret-btn"> -->
+            <!-- <img src="./img/secret_btn.png"> -->
+        <!-- </div> -->
+        <div class="secret-btn" onclick='saveText()'>
+            <img src="./img/share_btn.png">
+        </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 class="secret-box">
+        <img src="./img/poster/secret1.png" id="secret">
+    </div>
+
+    <!-- 摇一摇提示 -->
+    <div class="shake-mode2">
+        <img src="./img/wait_shake.png">
+    </div>
+
+    <div class="shake-mode">
+        <div class="shake-dialog">
+            <!-- <img src="./img/shake_fire.png"> -->
+            <div class="fire anim-fire js-an" id="fire"></div>
+            <img src="./img/shake_icon.png" class="icon">
+            <img src="./img/shake_txt.png" class="txt">
+        </div>
+    </div>
+    <script src="./js/jquery.min.js"></script>
+    <script src="./js/create.js"></script>
+    <script src="./js/tweenmax.js"></script>
+    <script src="./js/wechat.js"></script>
+    <script src="./assets.js"></script>
+    <script src="./js/main.js"></script>
+    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
+    <script>
+        // 判断微信分享
+        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
+            // 发送给好友
+            WeixinJSBridge.on('menu:share:appmessage', function(argv){
+                // alert('发送给好友')
+                setTimeout(function(){
+                    window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
+                }, 6000);
+
+            });
+            // 分享到朋友圈
+            WeixinJSBridge.on('menu:share:timeline', function(argv){
+                // alert('分享到朋友圈')
+                setTimeout(function(){
+                    window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
+                }, 6000);
+
+            });
+        }, false);
+
+        // 判断微博分享
+        document.addEventListener('WeiboJSBridgeReady', function onBridgeReady() {
+
+        }, false);
+    </script>
+</body>
 </html>

+ 148 - 76
minigame/WebContent/js/main.js

@@ -29,8 +29,6 @@ for (i=0; i < params.length ; i++){
     var aParam = params[i].split('=');
     URLParams[aParam[0]] = aParam[1];
 }
-
-
 function init() {
     createjs.Sound.play("bgm", {loop: -1});
     var comp = AdobeAn.getComposition("5529E26743974F469545223C44E61D22");
@@ -73,6 +71,66 @@ function handleComplete(evt, comp) {
     });
 
 
+    var dishIndex = 0;
+    $(".select-dish-box .item").on("click", function() {
+        $(this).addClass("active").siblings().removeClass("active");
+        $(".select-dish-box .confirm").show();
+    })
+    $(".select-dish-box .confirm").on("click", function() {
+        if (!$(".select-dish-box .item").hasClass("active")) {
+            alert("请选择你要做的菜")
+            return false;
+        }
+        dishIndex = $(".select-dish-box .item.active").index();
+        $(".select-dish-box").hide();
+        $(".game-box").show();
+
+        // 判断是哪个菜
+        if(dishIndex == 0){
+            exportRoot.plate.hsr_icon1.alpha = 1;
+            exportRoot.plate.hsr_icon2.alpha = 1;
+            exportRoot.plate.hsr_icon3.alpha = 1;
+            exportRoot.plate.hsr_icon4.alpha = 1;
+    var comp = AdobeAn.getComposition("5529E26743974F469545223C44E61D22");
+    var lib = comp.getLibrary();
+    var loader = new createjs.LoadQueue(false);
+    loader.addEventListener("fileload", function(evt) { handleFileLoad(evt, comp) });
+    loader.addEventListener("complete", function(evt) { handleComplete(evt, comp) });
+    loader.addEventListener("progress", loadProgressHandler);
+    var lib = comp.getLibrary();
+    loader.loadManifest(lib.properties.manifest);
+    createjs.MotionGuidePlugin.install();
+    createjs.Touch.enable(stage);
+}
+
+function handleFileLoad(evt, comp) {
+    var loadingimages = comp.getImages();
+    if (evt && (evt.item.type == "image")) {
+        loadingimages[evt.item.id] = evt.result;
+    }
+}
+
+function loadProgressHandler(event) {
+    var num = Math.floor(event.progress * 100);
+    $("#loadingTxt").text(num);
+    $("#loadingBar").css("width", num + '%');
+}
+
+function handleComplete(evt, comp) {
+    //This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage.
+    var lib = comp.getLibrary();
+    var ss = comp.getSpriteSheet();
+    var queue = evt.target;
+    var ssMetadata = lib.ssMetadata;
+    for (i = 0; i < ssMetadata.length; i++) {
+        ss[ssMetadata[i].name] = new createjs.SpriteSheet({ "images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames })
+    }
+    var exportRoot = new lib.assets();
+    $(".loading").fadeOut(function(){
+        $(".select-dish-box").find(".animated").removeClass("js-an");
+    });
+
+
     var dishIndex = 0;
     $(".select-dish-box .item").on("click", function() {
         $(this).addClass("active").siblings().removeClass("active");
@@ -122,10 +180,10 @@ function handleComplete(evt, comp) {
         window.location.href = "http://wx.ttkuaiban.com/minigame/";
         //location.reload()
     })
-    // $(".secret-btn").on("click",function(){
+    //$(".secret-btn").on("click",function(){
     //saveText();
-    //$(".secret-box").fadeIn();
-    // })
+    //    $(".secret-box").fadeIn();
+    //})
     $(".secret-box").on("click",function(){
         $(".secret-box").fadeOut();
     })
@@ -134,20 +192,20 @@ function handleComplete(evt, comp) {
     function ballAnim(dom) {
         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;
     }
 
@@ -159,24 +217,24 @@ 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() {
@@ -199,7 +257,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){
@@ -207,6 +265,19 @@ function handleComplete(evt, comp) {
         anim.to(dom, 0.4, { alpha: 1, ease: Power0.easeIn })
         return anim;
     }
+    function menuIconInAnim(dom){
+        var anim = new TimelineMax({ });
+        if(!dom.icon5){
+            dom.icon5 = exportRoot.btn2;
+        }
+        anim.to(dom.icon1, 0.3, { alpha: 1, ease: Power0.easeIn })
+            .to(dom.icon2, 0.3, { alpha: 1, ease: Power0.easeIn })
+            .to(dom.icon3, 0.3, { alpha: 1, ease: Power0.easeIn })
+            .to(dom.icon4, 0.3, { alpha: 1, ease: Power0.easeIn })
+            .to(dom.icon5, 0.3, { alpha: 1, ease: Power0.easeIn })
+            .to(exportRoot.btn2, 0.4, { alpha: 1, ease: Power0.easeIn })
+        return anim;
+    }
 
     function materialEnterAnim(dom,delay){
         dom.scale = 0.1;
@@ -260,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,
@@ -290,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,
@@ -467,15 +538,13 @@ function handleComplete(evt, comp) {
 
             oilIconAnim();
             proAnim(function() {
-
-                exportRoot.btn2.alpha = 1;
                 btnAnim(exportRoot.btn2);
                 if(dishIndex == 0){
-                    fadeInAnim(exportRoot.pot.hsr);
+                    menuIconInAnim(exportRoot.pot.hsr);
                 }else if(dishIndex == 1){
-                    fadeInAnim(exportRoot.pot.qcdf);
+                    menuIconInAnim(exportRoot.pot.qcdf);
                 }else if(dishIndex == 3){
-                    fadeInAnim(exportRoot.pot.ymc);
+                    menuIconInAnim(exportRoot.pot.ymc);
                 }
             });
         })
@@ -486,16 +555,15 @@ function handleComplete(evt, comp) {
             materialEnterAnim(exportRoot.blackboard.material1,0.2);
             materialEnterAnim(exportRoot.blackboard.material2,0.4);
             materialEnterAnim(exportRoot.blackboard.material3,0.6);
+            exportRoot.ball1.alpha = 1;
 
+            ballAnim(exportRoot.ball1);
         })
 
         exportRoot.blackboard.material1.addEventListener("mousedown", function() {
             exportRoot.blackboard.material1.removeAllEventListeners();
             exportRoot.blackboard.material2.removeAllEventListeners();
             exportRoot.blackboard.material3.removeAllEventListeners();
-            exportRoot.ball1.alpha = 1;
-            ballAnim(exportRoot.ball1);
-            chooseType = 3;
             $(".poster-mode").addClass("poster-bg3");
             materialAnim(exportRoot.blackboard.material1, 300, 180, function() {
                 exportRoot.blackboard.material1.x -=300;
@@ -508,9 +576,6 @@ function handleComplete(evt, comp) {
             exportRoot.blackboard.material1.removeAllEventListeners();
             exportRoot.blackboard.material2.removeAllEventListeners();
             exportRoot.blackboard.material3.removeAllEventListeners();
-            exportRoot.ball2.alpha = 1;
-            ballAnim(exportRoot.ball2);
-            chooseType = 2;
             $(".poster-mode").addClass("poster-bg2");
             materialAnim(exportRoot.blackboard.material2, 120, 180, function() {
                 exportRoot.blackboard.material2.x -=120;
@@ -523,10 +588,6 @@ function handleComplete(evt, comp) {
             exportRoot.blackboard.material1.removeAllEventListeners();
             exportRoot.blackboard.material2.removeAllEventListeners();
             exportRoot.blackboard.material3.removeAllEventListeners();
-            console.log(exportRoot.ball3)
-            exportRoot.ball3.alpha = 1;
-            ballAnim(exportRoot.ball3);
-            chooseType = 1;
             $(".poster-mode").addClass("poster-bg1");
             materialAnim(exportRoot.blackboard.material3, -30, 180, function() {
                 exportRoot.blackboard.material3.x +=30;
@@ -577,13 +638,14 @@ function handleComplete(evt, comp) {
 
 
     function shakeInit() {
+        var shake_cnt = 0;
+        $(".shake-mode2").show();
         if (window.DeviceMotionEvent) {
             window.addEventListener('devicemotion', deviceMotionHandler, false);
         } else {
             alert('您的手机不支持摇一摇功能!');
         }
 
-
         //获取加速度信息
         //通过监听上一步获取到的x, y, z 值在一定时间范围内的变化率,进行设备是否有进行晃动的判断。
         //而为了防止正常移动的误判,需要给该变化率设置一个合适的临界值。
@@ -604,36 +666,41 @@ function handleComplete(evt, comp) {
                 z = acceleration.z;
                 var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000;
                 if (speed > SHAKE_THRESHOLD) {
-                    $(".shake-mode").show();
-                    setTimeout(function(){
-                        window.removeEventListener('devicemotion', deviceMotionHandler, false);
-                        exportRoot.pot.hsr.play();
-                        exportRoot.btn3.alpha = 1;
-                        btnAnim(exportRoot.btn3);
-                        exportRoot.btn3.addEventListener("mousedown",function(){
+                    $(".shake-mode2").hide();
+                    shake_cnt++;
+                    if(shake_cnt>2){
+                        setTimeout(function(){
+                            window.removeEventListener('devicemotion', deviceMotionHandler, false);
+                            exportRoot.pot.hsr.play();
+                            // exportRoot.btn3.alpha = 1;
+                            // btnAnim(exportRoot.btn3);
+                            // exportRoot.btn3.addEventListener("mousedown",function(){
+                            //     exportRoot.btn3.removeAllEventListeners();
+                            //     $(".poster-mode").fadeIn();
+                            // })
+
+
+                            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(1);
+                            }else if(dishIndex == 1){
+                                exportRoot.pot.qcdf.gotoAndStop(1);
+                            }else if(dishIndex == 2){
+                                exportRoot.bowl.oil.alpha = 0;
+                                exportRoot.plate['swy_icon1'].gotoAndStop(2);
+                            }else{
+                                exportRoot.pot.ymc.gotoAndStop(1);
+                            }
+                            $(".shake-mode").fadeOut();
                             exportRoot.btn3.removeAllEventListeners();
                             $(".poster-mode").fadeIn();
-                        })
-
-
-                        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(1);
-                        }else if(dishIndex == 1){
-                            exportRoot.pot.qcdf.gotoAndStop(1);
-                        }else if(dishIndex == 2){
-                            exportRoot.bowl.oil.alpha = 0;
-                            exportRoot.plate['swy_icon1'].gotoAndStop(2);
-                        }else{
-                            exportRoot.pot.ymc.gotoAndStop(1);
-                        }
-                        $(".shake-mode").fadeOut();
-                    },3000)
+                        },3000)
 
+                    }
                     //dosomething
                     $("#fire").addClass("anim-time");
                 }else{
@@ -642,6 +709,11 @@ function handleComplete(evt, comp) {
                 last_x = x;
                 last_y = y;
                 last_z = z;
+
+                // 开始火的动画
+                $("#fire").removeClass("js-an");
+                $(".shake-dialog .icon").hide();
+                $(".shake-dialog .txt").hide();
             }
         }