LoadingView.ts 766 B

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