71041205-23cd-4e11-bfa7-fb106201d7ef.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. "use strict";
  2. cc._RF.push(module, '71041IFI81OEb+n+xBiAdfv', 'QRotation');
  3. // scripts/Framework/QRotation.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var QEasing_1 = require("./QEasing");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var QRotateAction = /** @class */ (function (_super) {
  28. __extends(QRotateAction, _super);
  29. function QRotateAction() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.delay = 0;
  32. _this.angle = 0;
  33. _this.duration = 0;
  34. _this.loop = false;
  35. _this.revert = false;
  36. _this._originAngle = 0;
  37. _this._tween = null;
  38. return _this;
  39. }
  40. QRotateAction.prototype.onLoad = function () {
  41. this._originAngle = this.node.angle;
  42. var delayTween = cc.tween().delay(this.delay);
  43. var actionTween = cc.tween();
  44. if (this.revert) {
  45. actionTween.by(this.duration / 2, { angle: this.angle }).by(this.duration / 2, { angle: -this.angle }, { easing: this._getEase() });
  46. }
  47. else {
  48. actionTween.by(this.duration, { angle: this.angle }, { easing: this._getEase() });
  49. }
  50. this._tween = cc.tween(this.node);
  51. this._tween.then(delayTween);
  52. this._tween.then(actionTween);
  53. if (this.loop) {
  54. this._tween.repeatForever();
  55. }
  56. };
  57. QRotateAction.prototype.onEnable = function () {
  58. this.node.angle = this._originAngle;
  59. this._tween.start();
  60. };
  61. __decorate([
  62. property()
  63. ], QRotateAction.prototype, "delay", void 0);
  64. __decorate([
  65. property({ tooltip: "初始角度,顺时针为负数" })
  66. ], QRotateAction.prototype, "angle", void 0);
  67. __decorate([
  68. property()
  69. ], QRotateAction.prototype, "duration", void 0);
  70. __decorate([
  71. property()
  72. ], QRotateAction.prototype, "loop", void 0);
  73. __decorate([
  74. property()
  75. ], QRotateAction.prototype, "revert", void 0);
  76. QRotateAction = __decorate([
  77. ccclass
  78. ], QRotateAction);
  79. return QRotateAction;
  80. }(QEasing_1.default));
  81. exports.default = QRotateAction;
  82. cc._RF.pop();