@tomiaa/live2d
Version:
2 lines (1 loc) • 1.29 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@tomiaa/utils"),d=require("../icons.js"),s=o.createNamespacs("live2d");class p{static createLoading(t){const e=document.createElement("i");return e.innerHTML=d.loadingSvg,e.classList.add(s.e("loading")),t.appendChild(e),e}static createControls(t,e,r,l){const n=document.createElement("div");n.classList.add(s.e("control"));const i=document.createElement("i");i.innerHTML=d.collapseSvg,i.setAttribute("data-tip","收起"),i.addEventListener("click",l),n.appendChild(i);const a=document.createElement("i");a.innerHTML=d.switchPersonSvg,a.setAttribute("data-tip","切换人物"),a.addEventListener("click",e),n.appendChild(a);const c=document.createElement("i");return c.innerHTML=d.switchClothingSvg,c.setAttribute("data-tip","更换服装"),c.addEventListener("click",r),n.appendChild(c),t.appendChild(n),{elControl:n,elSwitchPerson:a,elSwitchClothing:c,elCollapse:i}}static createExpandButton(t){const e=document.createElement("div");return e.classList.add(s.e("expand")),e.innerHTML=d.expandSvg,e.setAttribute("data-tip","展开"),e.addEventListener("click",t),document.body.appendChild(e),e}static updateSwitchClothingVisibility(t,e){t&&(t.style.display=e?"block":"none")}}exports.UICreator=p;