106da5b5-a36c-4278-9d8f-04635e4957d8.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. "use strict";
  2. cc._RF.push(module, '106daW1o2xCeJ2PBGNeSVfY', 'TweenNormal');
  3. // Script/new_20210323/TweenNormal.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 (Object.prototype.hasOwnProperty.call(b, 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. exports.EasingEnum = void 0;
  26. var EasingEnum;
  27. (function (EasingEnum) {
  28. EasingEnum[EasingEnum["quadIn"] = 0] = "quadIn";
  29. EasingEnum[EasingEnum["quadOut"] = 1] = "quadOut";
  30. EasingEnum[EasingEnum["quadInOut"] = 2] = "quadInOut";
  31. EasingEnum[EasingEnum["cubicIn"] = 3] = "cubicIn";
  32. EasingEnum[EasingEnum["cubicOut"] = 4] = "cubicOut";
  33. EasingEnum[EasingEnum["cubicInOut"] = 5] = "cubicInOut";
  34. EasingEnum[EasingEnum["quartIn"] = 6] = "quartIn";
  35. EasingEnum[EasingEnum["quartOut"] = 7] = "quartOut";
  36. EasingEnum[EasingEnum["quartInOut"] = 8] = "quartInOut";
  37. EasingEnum[EasingEnum["quintIn"] = 9] = "quintIn";
  38. EasingEnum[EasingEnum["quintOut"] = 10] = "quintOut";
  39. EasingEnum[EasingEnum["quintInOut"] = 11] = "quintInOut";
  40. EasingEnum[EasingEnum["sineIn"] = 12] = "sineIn";
  41. EasingEnum[EasingEnum["sineOut"] = 13] = "sineOut";
  42. EasingEnum[EasingEnum["sineInOut"] = 14] = "sineInOut";
  43. EasingEnum[EasingEnum["expoIn"] = 15] = "expoIn";
  44. EasingEnum[EasingEnum["expoOut"] = 16] = "expoOut";
  45. EasingEnum[EasingEnum["expoInOut"] = 17] = "expoInOut";
  46. EasingEnum[EasingEnum["circIn"] = 18] = "circIn";
  47. EasingEnum[EasingEnum["circOut"] = 19] = "circOut";
  48. EasingEnum[EasingEnum["circInOut"] = 20] = "circInOut";
  49. EasingEnum[EasingEnum["elasticIn"] = 21] = "elasticIn";
  50. EasingEnum[EasingEnum["elasticOut"] = 22] = "elasticOut";
  51. EasingEnum[EasingEnum["elasticInOut"] = 23] = "elasticInOut";
  52. EasingEnum[EasingEnum["backIn"] = 24] = "backIn";
  53. EasingEnum[EasingEnum["backOut"] = 25] = "backOut";
  54. EasingEnum[EasingEnum["backInOut"] = 26] = "backInOut";
  55. EasingEnum[EasingEnum["bounceIn"] = 27] = "bounceIn";
  56. EasingEnum[EasingEnum["bounceOut"] = 28] = "bounceOut";
  57. EasingEnum[EasingEnum["bounceInOut"] = 29] = "bounceInOut";
  58. EasingEnum[EasingEnum["smooth"] = 30] = "smooth";
  59. EasingEnum[EasingEnum["fade"] = 31] = "fade";
  60. })(EasingEnum = exports.EasingEnum || (exports.EasingEnum = {}));
  61. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  62. var TweenNormal = /** @class */ (function (_super) {
  63. __extends(TweenNormal, _super);
  64. function TweenNormal() {
  65. var _this = _super !== null && _super.apply(this, arguments) || this;
  66. _this.duration = 2;
  67. _this.startScale = 1;
  68. _this.targetScale = 1;
  69. // @property(cc.Vec2)
  70. // Pos1: cc.Vec2 = new cc.Vec2(0, 50);
  71. // @property(cc.Vec2)
  72. // Pos2: cc.Vec2 = new cc.Vec2(0, 0);
  73. // currentPos: cc.Vec2 = new cc.Vec2(0, 0);
  74. _this.intervalTime = 1;
  75. _this.isLoop = true;
  76. _this.easings = EasingEnum.smooth;
  77. _this.callback = null;
  78. return _this;
  79. }
  80. TweenNormal.prototype.onLoad = function () {
  81. this.Tweens();
  82. };
  83. /**
  84. * 播放缩放动画
  85. */
  86. TweenNormal.prototype.Tweens = function () {
  87. var _this = this;
  88. var tweens = cc.tween();
  89. //, position: this.currentPos
  90. tweens.to(this.duration, { scale: this.targetScale }, { easing: EasingEnum[this.easings] });
  91. tweens.call(function () {
  92. _this.node.setScale(_this.startScale);
  93. // console.log('缓动结束回调');
  94. if (_this.callback)
  95. _this.callback();
  96. });
  97. (this.isLoop) ? cc.tween(this.node).repeatForever(tweens).start() : cc.tween(this.node).repeat(1, tweens).start();
  98. };
  99. __decorate([
  100. property
  101. ], TweenNormal.prototype, "duration", void 0);
  102. __decorate([
  103. property
  104. ], TweenNormal.prototype, "startScale", void 0);
  105. __decorate([
  106. property
  107. ], TweenNormal.prototype, "targetScale", void 0);
  108. __decorate([
  109. property
  110. ], TweenNormal.prototype, "intervalTime", void 0);
  111. __decorate([
  112. property
  113. ], TweenNormal.prototype, "isLoop", void 0);
  114. __decorate([
  115. property({ type: cc.Enum(EasingEnum) })
  116. ], TweenNormal.prototype, "easings", void 0);
  117. TweenNormal = __decorate([
  118. ccclass
  119. ], TweenNormal);
  120. return TweenNormal;
  121. }(cc.Component));
  122. exports.default = TweenNormal;
  123. cc._RF.pop();