System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Vec3, Shake, _crd; function get_new_shake(startPos) { if (startPos === void 0) { startPos = new Vec3(0, 0, 0); } return new Shake(startPos); } _export("default", get_new_shake); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; Vec3 = _cc.Vec3; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "88adahxArtIPKhtXnEB29+o", "Shake", undefined); __checkObsolete__(['Vec3']); Shake = class Shake { constructor(startPos) { if (startPos === void 0) { startPos = new Vec3(0, 0, 0); } this.intensity = void 0; this.duration = void 0; this.shakePos = new Vec3(0, 0, 0); this.startPos = startPos; this.duration = 0; this.intensity = 0; } /**改变初起点*/ setStartPos(x, y) { this.startPos.x = x; this.startPos.y = y; } /**开始抖动 * duration 时间 * intensity 强度 */ start(duration, intensity) { if (duration === void 0) { duration = 0.3; } if (intensity === void 0) { intensity = 3.8; } this.duration = duration; this.intensity = intensity; } /**停止抖动*/ stop() { this.shakePos.x = this.startPos.x; this.shakePos.y = this.startPos.y; this.duration = 0; return this.shakePos; } getShakePos() { return this.shakePos; } action(dt) { if (this.duration > 0) { this.duration -= dt; if (this.duration <= 0) { return this.stop(); } else { var randomX = Math.random() * this.intensity - this.intensity * 0.5; var randomY = Math.random() * this.intensity - this.intensity * 0.5; this.shakePos.x = this.startPos.x + randomX; this.shakePos.y = this.startPos.y + randomY; return this.shakePos; } } return null; } }; _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=e512dc23403afb33626ea89a8cd4f5314eea8fae.js.map