CanmeraScrpts.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
  7. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class CanmeraScrpts extends cc.Component {
  10. Character: cc.Node = null;//人物节点
  11. protected onLoad(): void {
  12. let Mask = this.node.getChildByName("Mask")
  13. Mask.active=true
  14. }
  15. protected lateUpdate(dt: number): void {
  16. this?.node?.setPosition(this?.Character?.position.x, this?.Character?.position.y + 567)
  17. }
  18. BronAni() {
  19. let Mask = this.node.getChildByName("Mask")
  20. cc.tween(Mask)
  21. .to(0, { opacity: 255 })
  22. .to(2, { opacity: 0 }, { easing: 'fadeOut' })
  23. .call(() => {
  24. Mask.destroy()
  25. })
  26. .start()
  27. }
  28. }