UNPKG

@tomiaa/live2d

Version:
28 lines (27 loc) 634 B
import { randomInteger as r } from "@tomiaa/utils"; class l { /** * 播放指定动画 */ static playMotion(n, o) { n.motion(o); } /** * 处理点击动画 */ static handleClickAnimation(n, o) { const [a] = n.hitTest((o == null ? void 0 : o.offsetX) || 0, (o == null ? void 0 : o.offsetY) || 0), t = Object.keys( n.internalModel.motionManager.definitions ).filter((i) => i !== "login"); if (a) { const i = t.find((s) => s.includes(a)); i && n.motion(i); } else { const i = t[r(0, t.length - 1)]; i && n.motion(i); } } } export { l as AnimationManager };