ede9a97a-da2f-4d11-8135-f8441c1ac161.js 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. "use strict";
  2. cc._RF.push(module, 'ede9al62i9NEYE1+EQcGsFh', 'QScaleAction');
  3. // scripts/Framework/QScaleAction.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 QScaleAction = /** @class */ (function (_super) {
  28. __extends(QScaleAction, _super);
  29. function QScaleAction() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.delay = 0;
  32. _this.fromScale = cc.Vec2.ZERO;
  33. _this.targetScale = cc.Vec2.ZERO;
  34. _this.duration = 0;
  35. _this.loop = false;
  36. _this.revert = false;
  37. _this._tween = null;
  38. return _this;
  39. }
  40. QScaleAction.prototype.onLoad = function () {
  41. this.node.scaleX = this.fromScale.x;
  42. this.node.scaleY = this.fromScale.y;
  43. var delayTween = cc.tween();
  44. delayTween.delay(this.delay);
  45. var actionTween = cc.tween();
  46. if (this.revert) {
  47. actionTween.to(this.duration * 0.5, { scaleX: this.targetScale.x, scaleY: this.targetScale.y }, { easing: this._getEase() });
  48. actionTween.to(this.duration * 0.5, { scaleX: this.fromScale.x, scaleY: this.fromScale.y }, { easing: this._getEase() });
  49. }
  50. else {
  51. actionTween.to(this.duration, { scaleX: this.targetScale.x, scaleY: this.targetScale.y }, { easing: this._getEase() });
  52. }
  53. this._tween = cc.tween(this.node);
  54. this._tween.then(delayTween);
  55. this._tween.then(actionTween);
  56. if (this.loop) {
  57. this._tween.repeatForever();
  58. }
  59. };
  60. QScaleAction.prototype.onEnable = function () {
  61. this.node.scaleX = this.fromScale.x;
  62. this.node.scaleY = this.fromScale.y;
  63. this._tween.start();
  64. };
  65. __decorate([
  66. property()
  67. ], QScaleAction.prototype, "delay", void 0);
  68. __decorate([
  69. property()
  70. ], QScaleAction.prototype, "fromScale", void 0);
  71. __decorate([
  72. property(cc.Vec2)
  73. ], QScaleAction.prototype, "targetScale", void 0);
  74. __decorate([
  75. property()
  76. ], QScaleAction.prototype, "duration", void 0);
  77. __decorate([
  78. property()
  79. ], QScaleAction.prototype, "loop", void 0);
  80. __decorate([
  81. property()
  82. ], QScaleAction.prototype, "revert", void 0);
  83. QScaleAction = __decorate([
  84. ccclass
  85. ], QScaleAction);
  86. return QScaleAction;
  87. }(QEasing_1.default));
  88. exports.default = QScaleAction;
  89. cc._RF.pop();