|
@@ -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();
|
|
|
}
|
|
|
}
|
|
|
|