"use strict"; cc._RF.push(module, '106daW1o2xCeJ2PBGNeSVfY', 'TweenNormal'); // Script/new_20210323/TweenNormal.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EasingEnum = void 0; var EasingEnum; (function (EasingEnum) { EasingEnum[EasingEnum["quadIn"] = 0] = "quadIn"; EasingEnum[EasingEnum["quadOut"] = 1] = "quadOut"; EasingEnum[EasingEnum["quadInOut"] = 2] = "quadInOut"; EasingEnum[EasingEnum["cubicIn"] = 3] = "cubicIn"; EasingEnum[EasingEnum["cubicOut"] = 4] = "cubicOut"; EasingEnum[EasingEnum["cubicInOut"] = 5] = "cubicInOut"; EasingEnum[EasingEnum["quartIn"] = 6] = "quartIn"; EasingEnum[EasingEnum["quartOut"] = 7] = "quartOut"; EasingEnum[EasingEnum["quartInOut"] = 8] = "quartInOut"; EasingEnum[EasingEnum["quintIn"] = 9] = "quintIn"; EasingEnum[EasingEnum["quintOut"] = 10] = "quintOut"; EasingEnum[EasingEnum["quintInOut"] = 11] = "quintInOut"; EasingEnum[EasingEnum["sineIn"] = 12] = "sineIn"; EasingEnum[EasingEnum["sineOut"] = 13] = "sineOut"; EasingEnum[EasingEnum["sineInOut"] = 14] = "sineInOut"; EasingEnum[EasingEnum["expoIn"] = 15] = "expoIn"; EasingEnum[EasingEnum["expoOut"] = 16] = "expoOut"; EasingEnum[EasingEnum["expoInOut"] = 17] = "expoInOut"; EasingEnum[EasingEnum["circIn"] = 18] = "circIn"; EasingEnum[EasingEnum["circOut"] = 19] = "circOut"; EasingEnum[EasingEnum["circInOut"] = 20] = "circInOut"; EasingEnum[EasingEnum["elasticIn"] = 21] = "elasticIn"; EasingEnum[EasingEnum["elasticOut"] = 22] = "elasticOut"; EasingEnum[EasingEnum["elasticInOut"] = 23] = "elasticInOut"; EasingEnum[EasingEnum["backIn"] = 24] = "backIn"; EasingEnum[EasingEnum["backOut"] = 25] = "backOut"; EasingEnum[EasingEnum["backInOut"] = 26] = "backInOut"; EasingEnum[EasingEnum["bounceIn"] = 27] = "bounceIn"; EasingEnum[EasingEnum["bounceOut"] = 28] = "bounceOut"; EasingEnum[EasingEnum["bounceInOut"] = 29] = "bounceInOut"; EasingEnum[EasingEnum["smooth"] = 30] = "smooth"; EasingEnum[EasingEnum["fade"] = 31] = "fade"; })(EasingEnum = exports.EasingEnum || (exports.EasingEnum = {})); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var TweenNormal = /** @class */ (function (_super) { __extends(TweenNormal, _super); function TweenNormal() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.duration = 2; _this.startScale = 1; _this.targetScale = 1; // @property(cc.Vec2) // Pos1: cc.Vec2 = new cc.Vec2(0, 50); // @property(cc.Vec2) // Pos2: cc.Vec2 = new cc.Vec2(0, 0); // currentPos: cc.Vec2 = new cc.Vec2(0, 0); _this.intervalTime = 1; _this.isLoop = true; _this.easings = EasingEnum.smooth; _this.callback = null; return _this; } TweenNormal.prototype.onLoad = function () { this.Tweens(); }; /** * 播放缩放动画 */ TweenNormal.prototype.Tweens = function () { var _this = this; var tweens = cc.tween(); //, position: this.currentPos tweens.to(this.duration, { scale: this.targetScale }, { easing: EasingEnum[this.easings] }); tweens.call(function () { _this.node.setScale(_this.startScale); // console.log('缓动结束回调'); if (_this.callback) _this.callback(); }); (this.isLoop) ? cc.tween(this.node).repeatForever(tweens).start() : cc.tween(this.node).repeat(1, tweens).start(); }; __decorate([ property ], TweenNormal.prototype, "duration", void 0); __decorate([ property ], TweenNormal.prototype, "startScale", void 0); __decorate([ property ], TweenNormal.prototype, "targetScale", void 0); __decorate([ property ], TweenNormal.prototype, "intervalTime", void 0); __decorate([ property ], TweenNormal.prototype, "isLoop", void 0); __decorate([ property({ type: cc.Enum(EasingEnum) }) ], TweenNormal.prototype, "easings", void 0); TweenNormal = __decorate([ ccclass ], TweenNormal); return TweenNormal; }(cc.Component)); exports.default = TweenNormal; cc._RF.pop();