Commit b7501c26 authored by zjz1994's avatar zjz1994

新元素动画调整

parent bc650908
......@@ -7206,8 +7206,15 @@ export default class MainScene extends Scene {
var p1 = new egret.Point(fromP[0],fromP[1]);
var p3 = new egret.Point(midx,midy);
var p2 = new egret.Point((p1.x-p3.x)/2+p3.x,p3.y);
var time1 = Math.ceil(egret.Point.distance(p1,p3)*2);
if(time1<300){
time1 = 300;
}else if(time1>500){
time1 = 500;
}
console.log("位移时间",time1);
foodani1.setData(mv,p1,p2,p3,this,this.playElfoodAni2,type,1);
foodani1.setData(mv,p1,p2,p3,this,this.playElfoodAni2,type,1,"ani1",time1);
// console.log(mv);
this.effectContainer.addChild(mv);
......@@ -7270,7 +7277,15 @@ export default class MainScene extends Scene {
p3.y = p3.y - foodhei/2 + addy;
var p2 = new egret.Point((p3.x-p1.x)/3+p1.x,(p3.y-p1.y)/3+p1.y);
foodani2.setData(mv,p1,p2,p3,mainscene,mainscene.playElfoodAni3,type,tscale);
var time1 = Math.ceil(egret.Point.distance(p1,p3)*2);
if(time1<300){
time1 = 300;
}else if(time1>500){
time1 = 500;
}
console.log("位移时间",time1);
foodani2.setData(mv,p1,p2,p3,mainscene,mainscene.playElfoodAni3,type,tscale,"ani2",time1);
}
//食物通关目标动画3段
playElfoodAni3(mv:any,type:ElementType,mainscene:MainScene){
......
......@@ -34,15 +34,33 @@ export default class foodAni{
}
setData(mv:any,p1:egret.Point,p2:egret.Point,p3:egret.Point,mainscene:MainScene,callback:any,type:ElementType,mscale:number){
setData(mv:any,p1:egret.Point,p2:egret.Point,p3:egret.Point,
mainscene:MainScene,callback:any,type:ElementType,mscale:number
,aniname:string,time1:number){
this.moveimg = mv;
this.movep1 = p1;
this.movec1 = p2;
this.movep2 = p3;
this.mscale = mscale;
egret.Tween.get(this).to({factor: 1}, 500).call(function(){
egret.Tween.get(this).to({factor: 1}, time1).call(function(){
callback&&callback(mv,type,mainscene);
});
if(aniname=="ani1"){
var stime1 = Math.floor(time1/4);
egret.Tween.get(mv).to({ scaleX: 0.9, scaleY: 1.1 }, stime1, egret.Ease.quadInOut).call(() => {
egret.Tween.get(mv).to({ scaleX: 1, scaleY: 1 }, stime1, egret.Ease.quadInOut).call(() => {
egret.Tween.get(mv).to({
scaleX: 0.9618,
scaleY: 1.0618
}, stime1, egret.Ease.quadInOut).call(() => {
egret.Tween.get(mv).to({
scaleX: 1,
scaleY: 1
}, stime1, egret.Ease.quadInOut)
});
})
});
}
}
}
\ No newline at end of file
......@@ -100,31 +100,31 @@ var a = {
};
// 取数据格式用,一般情况注释
(function exportFile(chapters: ChapterData[]) {
var obj = []
for (var i = 1; i < chapters.length; i++) {
var chapter: ChapterData = chapters[i]
var target: PassTargetData = chapter.passTarget
var a: any = {};
a["lev"] = i;
a["tar"] = [];
if (target.type == PassType.SCORE_TARGET) {
a["tar"].push({ "type": 1, "num": target.score })
} else {
for (var j = 0; j < target.elements.length; j++) {
var element = target.elements[j];
a["tar"].push({ "type": submitTran[element.type], "num": element.count })
}
}
// (function exportFile(chapters: ChapterData[]) {
// var obj = []
// for (var i = 1; i < chapters.length; i++) {
// var chapter: ChapterData = chapters[i]
// var target: PassTargetData = chapter.passTarget
// var a: any = {};
// a["lev"] = i;
// a["tar"] = [];
// if (target.type == PassType.SCORE_TARGET) {
// a["tar"].push({ "type": 1, "num": target.score })
// } else {
// for (var j = 0; j < target.elements.length; j++) {
// var element = target.elements[j];
// a["tar"].push({ "type": submitTran[element.type], "num": element.count })
// }
// }
if(!chapter.starScores || chapter.starScores.length <=0)
throw new Error('starScores未配置'+i)
a["one"] = chapter.starScores[0];
a["two"] = chapter.starScores[1];
a["three"] = chapter.starScores[2];
// if(!chapter.starScores || chapter.starScores.length <=0)
// throw new Error('starScores未配置'+i)
// a["one"] = chapter.starScores[0];
// a["two"] = chapter.starScores[1];
// a["three"] = chapter.starScores[2];
obj.push(a)
}
var file = new File([JSON.stringify(obj)], "cfg.json", { type: "text/plain;charset=utf-8" });
window["saveAs"](file);
})(chapters)
// obj.push(a)
// }
// var file = new File([JSON.stringify(obj)], "cfg.json", { type: "text/plain;charset=utf-8" });
// window["saveAs"](file);
// })(chapters)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment