EachNodeAnim.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. import Main from "../Main";
  8. import UiM from "../manager/UiM";
  9. import LogUtil from "../utils/LogUtil";
  10. const { ccclass, property } = cc._decorator;
  11. @ccclass
  12. export default class EachNodeAnim extends cc.Component {
  13. @property([cc.Node])
  14. animList: cc.Node[] = [];
  15. private isAnim = false
  16. // LIFE-CYCLE CALLBACKS:
  17. // onLoad () {}
  18. start() {
  19. }
  20. startChildAnim() {
  21. if (this.isAnim) {
  22. return
  23. }
  24. this.isAnim = true
  25. let count = 0
  26. let array = new Array<cc.Node>()
  27. for (let i = 0; i < this.animList.length; i++) {
  28. array.push(this.animList[i])
  29. }
  30. this.schedule(() => {
  31. if (cc.isValid(array[count])) {
  32. let scale = array[count].scale
  33. LogUtil.logV("startChildAnim scale",count+" : "+scale)
  34. let changeRange = 0.4
  35. if(count== 0){
  36. changeRange = 0.4
  37. }else if(count== 1){
  38. changeRange = 0.08
  39. }else if(count == 2){
  40. changeRange = 0.3
  41. }
  42. array[count].runAction(cc.sequence(cc.scaleTo(0.15,scale+changeRange), cc.scaleTo(0.1, scale),cc.callFunc(()=>{
  43. LogUtil.logV("startChildAnim scale",count+" : "+scale)
  44. })))
  45. }
  46. count++
  47. if(count>= array.length ){
  48. this.isAnim = false
  49. }
  50. }, 0.1, array.length)
  51. }
  52. // update (dt) {}
  53. }