LoadingView.ts 666 B

123456789101112131415161718192021
  1. import { UICloseReason } from '@scripts/framework/ui/UILayer';
  2. import { UIView } from '@scripts/framework/ui/UIView';
  3. import { _decorator, Component, Node, Tween, tween } from 'cc';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('LoadingView')
  6. export class LoadingView extends UIView {
  7. @property(Node)
  8. circleNode: Node = null;
  9. protected onOpen(_params: unknown): void | Promise<void> {
  10. Tween.stopAllByTarget(this.circleNode);
  11. tween(this.circleNode).by(0.5, { angle: 50 }).repeatForever().start();
  12. }
  13. protected onClose(_reason: UICloseReason): void | Promise<void> {
  14. Tween.stopAllByTarget(this.circleNode);
  15. }
  16. }