Commit 163b615b authored by wjf's avatar wjf

l

parent 2fb1cffe
......@@ -6,13 +6,80 @@ import { Element } from "../class/Element";
import { Tool } from "../Tool";
import { ElementType } from "../enum/ElementType";
/**
* 情人节版本
*/
export class FesRedShootAni extends egret.DisplayObjectContainer {
light: LightingAni;
imageAni: ImageAni;
imageAniCon: egret.DisplayObjectContainer
constructor() {
super()
this.light = new LightingAni();
this.addChild(this.light);
var arr = []
for (var i = 1; i <= 10; i++) {
arr.push("fesEleSmallDis" + i + "_png");
}
this.imageAniCon = new egret.DisplayObjectContainer();
this.imageAni = new ImageAni(arr);
this.imageAniCon.addChild(this.imageAni);
this.addChild(this.imageAniCon);
this.imageAni.visible = false
}
reset() {
this.light.visible = true;
this.imageAni.visible = false;
this.light.scaleX = 0.2;
}
play(startP: number[], ele: Element, callback: Function) {
this.reset()
//算角度
var r = Tool.getForwardRotation(startP, [ele.x, ele.y])
this.light.rotation = r * 180 / Math.PI;
this.light.x = startP[0];
this.light.y = startP[1];
this.imageAniCon.x = ele.x;
this.imageAniCon.y = ele.y;
//247
var dis = Math.sqrt(
(startP[0] - ele.x) * (startP[0] - ele.x) +
(startP[1] - ele.y) * (startP[1] - ele.y)
)
var scaleX = dis / 247;
egret.Tween.get(this.light)
.to({ scaleX: scaleX, }, 400)
.call(() => {
ele.reset(ElementType.FESTIVALELE_SMALL);
ele.scaleX = ele.scaleY = 0.1
egret.Tween.get(ele)
.to({ scaleX: 1, scaleY: 1 }, 500, egret.Ease.backOut)
//回调
callback();
this.imageAni.visible = true;
this.imageAni.play(() => {
if (this.$parent) {
this.$parent.removeChild(this)
};
Pool.recover(RecoverName.FESREDSHOOT_ANI, this)
})
setTimeout(() => {
this.light.visible = false;
}, 200)
})
}
}
export const stepPosition: number[] = [125, 115];
/**
* 需要回调的
* 手动修改this.shoot.rotation=
*/
export class FesRedShootAni extends egret.DisplayObjectContainer {
/*export class FesRedShootAni extends egret.DisplayObjectContainer {
light: LightingAni;
imageAni: ImageAni;
imageAniCon: egret.DisplayObjectContainer
......@@ -75,7 +142,7 @@ export class FesRedShootAni extends egret.DisplayObjectContainer {
})
}
}
}*/
......
......@@ -121,8 +121,10 @@ function ani(b: egret.Bitmap) {
b.scaleX = b.scaleY = 1;
b.rotation = -90;
egret.Tween.get(b)
.wait(700)
.to({ scaleX: 0.33, scaleY: 0.33, alpha: 1 }, 700, egret.Ease.backOut)
egret.Tween.get(b)
.wait(700)
.to({ rotation: 0 }, 700, egret.Ease.backOut)
}
//暂时只有一个就用40,和mainscene里的festivalIndex保持一致
......
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