22 lines
886 B
TypeScript
22 lines
886 B
TypeScript
const { ccclass } = cc._decorator;
|
|
|
|
/** Attach to a dedicated node. Hide or destroy the node to stop the spinner. */
|
|
@ccclass
|
|
export default class BrownLoadingSpinner extends cc.Component {
|
|
onLoad() {
|
|
this.node.setContentSize(60, 60);
|
|
const graphics = this.node.addComponent(cc.Graphics);
|
|
graphics.lineWidth = 8;
|
|
graphics.strokeColor = new cc.Color(137, 88, 29);
|
|
graphics.arc(0, 0, 25, 0, Math.PI * 1.5, true); graphics.stroke();
|
|
graphics.strokeColor = new cc.Color(205, 165, 111);
|
|
graphics.arc(0, 0, 25, Math.PI * 1.5, Math.PI * 2, true); graphics.stroke();
|
|
}
|
|
onEnable() {
|
|
cc.Tween.stopAllByTarget(this.node);
|
|
cc.tween(this.node).by(.8, { angle: -360 }).repeatForever().start();
|
|
}
|
|
onDisable() { cc.Tween.stopAllByTarget(this.node); }
|
|
onDestroy() { cc.Tween.stopAllByTarget(this.node); }
|
|
}
|