TipMap.ts 797 B

123456789101112131415161718192021222324
  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. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class TipMap extends cc.Component {
  10. protected start(): void {
  11. this.node.scale = 0;
  12. this.node.opacity = 0;
  13. cc.tween(this.node)
  14. .to(0.3, { scale: 1, opacity: 255 })
  15. .delay(0.5)
  16. .to(0.3, { scale: 0, opacity: 0 })
  17. .call(() => {
  18. this.node.removeFromParent();
  19. })
  20. .start();
  21. }
  22. }