System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Vec3, Shake, _crd; function get_new_shake(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 = 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 = 0.3, 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 { const randomX = Math.random() * this.intensity - this.intensity * 0.5; const 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=7404a8ee135932a387eac99bfb33951576fe8b67.js.map