commit 1a7c829df70e72426f5a25ef94b563975aee57e4 Author: TermiNexus Date: Wed Jul 15 21:24:12 2026 +0800 初次上传 diff --git a/DesktopPet.py b/DesktopPet.py new file mode 100644 index 0000000..574fe8a --- /dev/null +++ b/DesktopPet.py @@ -0,0 +1,511 @@ +# -*- coding: utf-8 -*- +""" +2333娘桌宠 +基于 tkinter 的透明窗口桌面宠物,无需第三方依赖。 +- 左键拖动移动 +- 双击:开心跳跃 + "2333!" 气泡 +- 右键:弹出菜单(说话 / 切换表情 / 置顶 / 退出) +- 自动呼吸、眨眼、偶尔随机吐槽 +""" + +import math +import random +import sys +import tkinter as tk + +# ============== 颜色配置 ============== +COLOR_BG = '#FF00FF' # 透明色(纯品红,绘制中不使用) +COLOR_HAIR = '#00AEEC' # B站蓝 +COLOR_HAIR_DARK = '#0090C8' +COLOR_HAIR_LIGHT = '#5FC8F2' +COLOR_SKIN = '#FFE6D5' +COLOR_SKIN_SHADOW = '#FAD0BC' +COLOR_BLUSH = '#FF9FB2' +COLOR_EYE = '#2EA9DF' +COLOR_EYE_DARK = '#1B7FB8' +COLOR_WHITE = '#FFFFFF' +COLOR_DRESS = '#F2FAFF' +COLOR_DRESS_BLUE = '#00AEEC' +COLOR_DRESS_DARK = '#0090C8' +COLOR_MOUTH = '#C8485A' +COLOR_MOUTH_INNER = '#FF8A9A' +COLOR_TONGUE = '#FFB6C1' +COLOR_ACCENT = '#FB7299' # B站粉 +COLOR_DARK = '#3A3A3A' +COLOR_SCREEN = '#1E2233' # 额头成像仪屏幕 + +# ============== 画布尺寸 ============== +WIDTH = 240 +HEIGHT = 310 +CX = WIDTH // 2 +FRAME_MS = 33 # ~30fps + +# ============== 随机吐槽语 ============== +IDLE_MESSAGES = [ + '2333~', '哈哈哈~', '干杯!(´・ω・`)', '哔哩哔哩☆', '今天也要元气满满哦!', + '戳我干嘛 (`ε´)', '最喜欢姐姐了~', '需要充电...zzZ', '2233娘最强!', + '233333333', '再看就把你吃掉!', '帮我插个插座?', '咕~ 咕~', + '今天视频审核完了吗?', '点击这里投喂电池 →', +] + + +class DesktopPet: + """2333娘桌宠主类""" + + def __init__(self, blocking=True, on_exit=None): + """blocking=True 时调用 mainloop 阻塞;False 时由外部驱动 root.update()。 + on_exit: 退出时的回调(用于通知调用者恢复)。""" + self._blocking = blocking + self._on_exit = on_exit + self._exited = False + self.root = tk.Tk() + self.root.title('2333娘') + # 初始位置:屏幕右下角 + sx = self.root.winfo_screenwidth() - WIDTH - 30 + sy = self.root.winfo_screenheight() - HEIGHT - 80 + self.root.geometry(f'{WIDTH}x{HEIGHT}+{sx}+{sy}') + self.root.overrideredirect(True) + self.root.attributes('-topmost', True) + self.root.config(bg=COLOR_BG) + try: + self.root.attributes('-transparentcolor', COLOR_BG) + except tk.TclError: + pass + + self.canvas = tk.Canvas( + self.root, width=WIDTH, height=HEIGHT, + bg=COLOR_BG, highlightthickness=0, bd=0 + ) + self.canvas.pack() + + # ----- 动画状态 ----- + self.t = 0.0 + self.dt = FRAME_MS / 1000.0 + self.bob_y = 0.0 + self.jump_y = 0.0 + self.jump_vel = 0.0 + + # 眨眼 + self.blink_phase = 0.0 # 0=睁眼;>0=正在眨眼 + self.next_blink = random.uniform(2.0, 5.0) + self.eye_open = 1.0 + + # 表情与说话 + self.expression = 'laugh' # laugh / happy / shy / wink + self.speech_text = '' + self.speech_timer = 0.0 + self.idle_countdown = random.uniform(6.0, 12.0) + + # 拖动 + self._drag_dx = 0 + self._drag_dy = 0 + self._dragging = False + + # 互动粒子(爱心/星星) + self.particles = [] # list of dict + + self._build_menu() + self._bind_events() + self._schedule_idle_speech() + self._tick() + if self._blocking: + self.root.mainloop() + + # ================= 菜单 ================= + def _build_menu(self): + self.menu = tk.Menu(self.root, tearoff=0) + self.menu.add_command(label='说句话 (2333~)', command=self._say_random) + self.menu.add_separator() + self.menu.add_command(label='表情:大笑', command=lambda: self._set_expr('laugh')) + self.menu.add_command(label='表情:开心', command=lambda: self._set_expr('happy')) + self.menu.add_command(label='表情:害羞', command=lambda: self._set_expr('shy')) + self.menu.add_command(label='表情:眨眼', command=lambda: self._set_expr('wink')) + self.menu.add_separator() + self.menu.add_command(label='跳一下!', command=self._jump) + self.menu.add_command(label='置顶 / 取消置顶', command=self._toggle_topmost) + self.menu.add_separator() + self.menu.add_command(label='Live2D 模式 ✨', command=self._switch_to_live2d) + self.menu.add_separator() + self.menu.add_command(label='退出 (。•́︿•̀。)', command=self._quit) + + # ================= 事件绑定 ================= + def _bind_events(self): + self.canvas.bind('', self._on_press) + self.canvas.bind('', self._on_drag) + self.canvas.bind('', self._on_release) + self.canvas.bind('', self._on_right) + self.canvas.bind('', self._on_double) + self.root.bind('', lambda e: self._quit()) + + # ----- 鼠标交互 ----- + def _on_press(self, e): + self._dragging = True + self._drag_dx = e.x_root - self.root.winfo_x() + self._drag_dy = e.y_root - self.root.winfo_y() + + def _on_drag(self, e): + if self._dragging: + x = e.x_root - self._drag_dx + y = e.y_root - self._drag_dy + self.root.geometry(f'+{x}+{y}') + + def _on_release(self, e): + self._dragging = False + + def _on_right(self, e): + try: + self.menu.tk_popup(e.x_root, e.y_root) + finally: + self.menu.grab_release() + + def _on_double(self, e): + self._jump() + self._say('2333!') + + # ----- 菜单动作 ----- + def _set_expr(self, expr): + self.expression = expr + self._say({'laugh': '2333~', 'happy': '嘿嘿~', 'shy': '呜...>//<', 'wink': '★~'}[expr]) + + def _say(self, text): + self.speech_text = text + self.speech_timer = 2.4 + + def _say_random(self): + self._say(random.choice(IDLE_MESSAGES)) + + def _jump(self): + if self.jump_y == 0 and self.jump_vel == 0: + self.jump_vel = -13.0 + + def _toggle_topmost(self): + self.root.attributes('-topmost', not self.root.attributes('-topmost')) + + def _switch_to_live2d(self): + """切换回 Live2D 模式(非阻塞模式下通知调用者恢复)""" + self._do_exit() + + def _do_exit(self): + """统一退出处理""" + if self._exited: + return + self._exited = True + try: + self.root.destroy() + except Exception: + pass + if self._on_exit: + self._on_exit() + elif self._blocking: + sys.exit(0) + + def _quit(self): + self._do_exit() + + def _schedule_idle_speech(self): + # 用随机定时器在 _tick 中处理,这里不需要额外线程 + pass + + # ================= 主循环 ================= + def _tick(self): + self.t += self.dt + + # 呼吸浮动 + self.bob_y = math.sin(self.t * 2.2) * 3.0 + + # 跳跃物理 + if self.jump_y < 0 or self.jump_vel < 0: + self.jump_vel += 1.1 # 重力 + self.jump_y += self.jump_vel + if self.jump_y >= 0: + self.jump_y = 0.0 + self.jump_vel = 0.0 + + # 眨眼计时 + if self.blink_phase == 0.0: + self.next_blink -= self.dt + if self.next_blink <= 0: + self.blink_phase = 0.0001 + else: + self.blink_phase += self.dt + # 0~0.05 闭眼,0.05~0.13 闭着,0.13~0.20 睁眼 + p = self.blink_phase + if p < 0.05: + self.eye_open = 1.0 - (p / 0.05) + elif p < 0.13: + self.eye_open = 0.0 + elif p < 0.20: + self.eye_open = (p - 0.13) / 0.07 + else: + self.eye_open = 1.0 + self.blink_phase = 0.0 + self.next_blink = random.uniform(2.5, 6.5) + self.eye_open = max(0.0, min(1.0, self.eye_open)) + + # wink 表情强制一只眼闭着 + if self.expression == 'wink': + self._wink_left_open = True + + # 说话气泡计时 + if self.speech_timer > 0: + self.speech_timer -= self.dt + if self.speech_timer <= 0: + self.speech_text = '' + + # 随机吐槽 + self.idle_countdown -= self.dt + if self.idle_countdown <= 0: + self.idle_countdown = random.uniform(10.0, 20.0) + if not self.speech_text and random.random() < 0.7: + self._say(random.choice(IDLE_MESSAGES)) + + # 粒子更新 + self._update_particles() + + self._draw() + self.root.after(FRAME_MS, self._tick) + + # ================= 绘制 ================= + def _draw(self): + c = self.canvas + c.delete('all') + oy = self.bob_y + self.jump_y + + self._draw_hair_back(oy) + self._draw_body(oy) + self._draw_face(oy) + self._draw_forehead_device(oy) + self._draw_blush(oy) + self._draw_eyes(oy) + self._draw_mouth(oy) + self._draw_hair_front(oy) + self._draw_ahoge(oy) + self._draw_particles() + self._draw_speech(oy) + + # ----- 后侧头发 ----- + def _draw_hair_back(self, oy): + c = self.canvas + # 大块蓝色后发 + c.create_oval(CX - 96, 36 + oy, CX + 96, 196 + oy, fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=2) + # 两侧散发 + c.create_oval(CX - 100, 120 + oy, CX - 60, 230 + oy, fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=2) + c.create_oval(CX + 60, 120 + oy, CX + 100, 230 + oy, fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=2) + + # ----- 脸 ----- + def _draw_face(self, oy): + c = self.canvas + c.create_oval(CX - 80, 44 + oy, CX + 80, 196 + oy, fill=COLOR_SKIN, outline=COLOR_SKIN_SHADOW, width=2) + + # ----- 额头成像仪(33娘特征)----- + def _draw_forehead_device(self, oy): + c = self.canvas + cx, cy = CX, 80 + oy + # 外圈 + c.create_oval(cx - 16, cy - 16, cx + 16, cy + 16, fill=COLOR_DRESS_BLUE, outline=COLOR_DRESS_DARK, width=2) + # 屏幕 + c.create_oval(cx - 11, cy - 11, cx + 11, cy + 11, fill=COLOR_SCREEN, outline='') + # 屏幕上的小光点(呼吸) + glow = 0.5 + 0.5 * math.sin(self.t * 3) + col = self._mix(COLOR_HAIR_LIGHT, COLOR_WHITE, glow) + c.create_oval(cx - 4, cy - 4, cx + 4, cy + 4, fill=col, outline='') + + # ----- 腮红 ----- + def _draw_blush(self, oy): + c = self.canvas + alpha = 1.0 + if self.expression == 'shy': + alpha = 1.4 + col = self._mix(COLOR_SKIN, COLOR_BLUSH, min(1.0, 0.6 * alpha)) + c.create_oval(CX - 58, 138 + oy, CX - 28, 156 + oy, fill=col, outline='') + c.create_oval(CX + 28, 138 + oy, CX + 58, 156 + oy, fill=col, outline='') + + # ----- 眼睛 ----- + def _draw_eyes(self, oy): + c = self.canvas + lex, rex = CX - 34, CX + 34 + ey = 120 + oy + open_f = self.eye_open + + wink = (self.expression == 'wink') + left_open = open_f + right_open = 0.0 if wink else open_f + + for (ex, op) in ((lex, left_open), (rex, right_open)): + if op > 0.15: + self._draw_open_eye(ex, ey, op) + else: + # 闭眼弧线 + c.create_arc(ex - 14, ey - 6, ex + 14, ey + 8, start=20, extent=140, + style='arc', outline=COLOR_DARK, width=2.5) + + def _draw_open_eye(self, ex, ey, op): + c = self.canvas + # 眼白 + ry = 22 * op + c.create_oval(ex - 16, ey - ry, ex + 16, ey + ry, fill=COLOR_WHITE, outline=COLOR_DARK, width=1.5) + # 虹膜 + ir = 12 + c.create_oval(ex - ir, ey - ir, ex + ir, ey + ir, fill=COLOR_EYE, outline='') + # 瞳孔 + c.create_oval(ex - 6, ey - 6, ex + 6, ey + 6, fill=COLOR_DARK, outline='') + # 高光 + c.create_oval(ex - 9, ey - 9, ex - 3, ey - 3, fill=COLOR_WHITE, outline='') + c.create_oval(ex + 3, ey + 2, ex + 7, ey + 6, fill=COLOR_WHITE, outline='') + + # ----- 嘴 ----- + def _draw_mouth(self, oy): + c = self.canvas + mx, my = CX, 158 + oy + expr = self.expression + if expr == 'laugh': + # 大笑:张开嘴 + w = 20 + 3 * math.sin(self.t * 8) + c.create_oval(mx - w, my - 6, mx + w, my + 14, fill=COLOR_MOUTH_INNER, outline=COLOR_MOUTH, width=2) + # 舌头 + c.create_oval(mx - 10, my + 2, mx + 10, my + 14, fill=COLOR_TONGUE, outline='') + # 上唇线 + c.create_arc(mx - w, my - 12, mx + w, my + 6, start=200, extent=140, style='arc', outline=COLOR_MOUTH, width=2) + elif expr == 'happy': + # 微笑弧 + c.create_arc(mx - 14, my - 8, mx + 14, my + 10, start=20, extent=140, style='arc', outline=COLOR_MOUTH, width=2.5) + elif expr == 'shy': + # 小抿嘴 + c.create_line(mx - 8, my, mx + 8, my, fill=COLOR_MOUTH, width=2.5, smooth=True) + c.create_arc(mx - 6, my - 4, mx + 6, my + 4, start=200, extent=140, style='arc', outline=COLOR_MOUTH, width=2) + else: # wink + c.create_arc(mx - 12, my - 6, mx + 12, my + 12, start=20, extent=140, style='arc', outline=COLOR_MOUTH, width=2.5) + + # ----- 前侧头发(刘海)----- + def _draw_hair_front(self, oy): + c = self.canvas + # 头顶发盖 + c.create_oval(CX - 86, 30 + oy, CX + 86, 120 + oy, fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=2) + # 刘海锯齿 + bang_pts = [] + tips = [ + (CX - 80, 96), (CX - 64, 70), (CX - 48, 96), + (CX - 30, 74), (CX - 12, 98), (CX + 6, 76), + (CX + 24, 96), (CX + 44, 72), (CX + 62, 96), + (CX + 80, 78), + ] + top_y = 44 + oy + # 沿头顶弧线生成上沿 + for i, (tx, ty) in enumerate(tips): + bang_pts.append((tx, ty + oy)) + # 用多边形画几缕刘海 + for i in range(0, len(tips) - 1, 2): + x1, y1 = tips[i] + x2, y2 = tips[i + 1] + xm, ym = (x1 + x2) / 2, max(y1, y2) + 18 + c.create_polygon(x1, top_y, x1, y1 + oy, xm, ym + oy, x2, y2 + oy, x2, top_y, + fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=1.5) + # 两侧鬓发 + c.create_polygon(CX - 86, 60 + oy, CX - 92, 170 + oy, CX - 64, 150 + oy, CX - 60, 70 + oy, + fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=1.5) + c.create_polygon(CX + 86, 60 + oy, CX + 92, 170 + oy, CX + 64, 150 + oy, CX + 60, 70 + oy, + fill=COLOR_HAIR, outline=COLOR_HAIR_DARK, width=1.5) + + # ----- 呆毛 ----- + def _draw_ahoge(self, oy): + c = self.canvas + sway = math.sin(self.t * 3) * 4 + # 一根弯曲呆毛 + c.create_line(CX, 30 + oy, CX - 6 + sway, 6 + oy, CX + 6 + sway, 2 + oy, + fill=COLOR_HAIR_DARK, width=4, smooth=True, capstyle='round') + + # ----- 身体 / 裙子 ----- + def _draw_body(self, oy): + c = self.canvas + # 脖子 + c.create_rectangle(CX - 14, 186 + oy, CX + 14, 210 + oy, fill=COLOR_SKIN, outline=COLOR_SKIN_SHADOW, width=1.5) + # 裙子上半(白色) + c.create_polygon(CX - 44, 210 + oy, CX + 44, 210 + oy, CX + 54, 270 + oy, CX - 54, 270 + oy, + fill=COLOR_DRESS, outline=COLOR_DRESS_DARK, width=2) + # 蓝色领结/缎带 + c.create_polygon(CX - 24, 206 + oy, CX + 24, 206 + oy, CX + 18, 224 + oy, CX - 18, 224 + oy, + fill=COLOR_DRESS_BLUE, outline=COLOR_DRESS_DARK, width=1.5) + c.create_oval(CX - 6, 208 + oy, CX + 6, 220 + oy, fill=COLOR_ACCENT, outline='') + # 裙摆蓝色边 + c.create_polygon(CX - 54, 262 + oy, CX + 54, 262 + oy, CX + 58, 276 + oy, CX - 58, 276 + oy, + fill=COLOR_DRESS_BLUE, outline=COLOR_DRESS_DARK, width=1.5) + # 手臂 + c.create_oval(CX - 60, 214 + oy, CX - 40, 250 + oy, fill=COLOR_DRESS, outline=COLOR_DRESS_DARK, width=1.5) + c.create_oval(CX + 40, 214 + oy, CX + 60, 250 + oy, fill=COLOR_DRESS, outline=COLOR_DRESS_DARK, width=1.5) + # 手 + c.create_oval(CX - 62, 244 + oy, CX - 44, 262 + oy, fill=COLOR_SKIN, outline=COLOR_SKIN_SHADOW, width=1.5) + c.create_oval(CX + 44, 244 + oy, CX + 62, 262 + oy, fill=COLOR_SKIN, outline=COLOR_SKIN_SHADOW, width=1.5) + + # ----- 粒子(爱心)----- + def _spawn_hearts(self, n=6): + for _ in range(n): + self.particles.append({ + 'x': CX + random.uniform(-30, 30), + 'y': 110 + random.uniform(-10, 10), + 'vx': random.uniform(-1.2, 1.2), + 'vy': random.uniform(-2.5, -1.0), + 'life': 1.0, + 'size': random.uniform(8, 14), + }) + + def _update_particles(self): + for p in self.particles: + p['x'] += p['vx'] + p['y'] += p['vy'] + p['vy'] += 0.04 + p['life'] -= self.dt * 0.8 + self.particles = [p for p in self.particles if p['life'] > 0] + + def _draw_particles(self): + c = self.canvas + for p in self.particles: + s = p['size'] * max(0.2, p['life']) + x, y = p['x'], p['y'] + c.create_text(x, y, text='♥', font=('Segoe UI Symbol', int(s)), fill=COLOR_ACCENT) + + # ----- 说话气泡 ----- + def _draw_speech(self, oy): + if not self.speech_text: + return + c = self.canvas + text = self.speech_text + font = ('微软雅黑', 12, 'bold') + # 估算宽度 + w = max(70, len(text) * 14 + 26) + h = 36 + x = CX + y = 6 + oy + # 气泡圆角矩形 + pad = 8 + c.create_rectangle(x - w / 2, y, x + w / 2, y + h, fill=COLOR_WHITE, outline=COLOR_ACCENT, width=2) + # 尾巴 + c.create_polygon(x - 8, y + h - 1, x + 8, y + h - 1, x, y + h + 12, + fill=COLOR_WHITE, outline=COLOR_ACCENT, width=2) + # 遮掉尾巴上沿的边线 + c.create_line(x - 7, y + h, x + 7, y + h, fill=COLOR_WHITE, width=3) + c.create_text(x, y + h / 2 + 1, text=text, fill=COLOR_ACCENT, font=font) + + # ================= 工具 ================= + @staticmethod + def _mix(c1, c2, t): + """简单颜色线性混合,t in [0,1]""" + t = max(0.0, min(1.0, t)) + + def parse(h): + h = h.lstrip('#') + return int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16) + + r1, g1, b1 = parse(c1) + r2, g2, b2 = parse(c2) + r = int(r1 + (r2 - r1) * t) + g = int(g1 + (g2 - g1) * t) + b = int(b1 + (b2 - b1) * t) + return f'#{r:02x}{g:02x}{b:02x}' + + def _on_double_click_heart(self): + """双击时额外撒爱心(供扩展)""" + self._spawn_hearts(8) + + +if __name__ == '__main__': + DesktopPet() diff --git a/Live2DPet.py b/Live2DPet.py new file mode 100644 index 0000000..6236580 --- /dev/null +++ b/Live2DPet.py @@ -0,0 +1,735 @@ +# -*- coding: utf-8 -*- +""" +2333娘 Live2D 桌宠 +基于 live2d-py (v2cpp) + PyQt5 的透明窗口 Live2D 桌面宠物。 +使用 2233live2d 模型(Cubism 2 格式:.moc / .mtn / model.json)。 +- 左键拖动移动窗口;松开(未拖动)= 触发点击动作 +- 右键:菜单(随机动作 / 随机表情 / 切换角色·服装 / 置顶 / 退出) +- 鼠标移动:视线跟随 +- 滚轮:缩放 +- 自动眨眼、呼吸、空闲随机动作 +- 透明区域点击穿透(动态切换 Win32 WS_EX_TRANSPARENT + glReadPixels 检测像素 alpha) +""" + +import ctypes +import os +import random +import sys +import glob + +import live2d.v2 as live2d +from OpenGL import GL +from PyQt5.QtCore import Qt, QTimer, QPoint +from PyQt5.QtGui import QCursor, QImage, QSurfaceFormat +from PyQt5.QtWidgets import ( + QApplication, QLabel, QMenu, QMessageBox, QOpenGLWidget, QVBoxLayout, QWidget, +) + +# ============== Monkey-patch: 预乘 alpha 纹理 + 修正 shader ============== +# 匹配 HTML 版本的渲染方式:纹理上传时预乘 alpha,shader 不再做预乘 +# 修复 mipmap 边缘颜色渗透导致的边线问题 +from PIL import Image as _PILImage, ImageChops as _ImageChops +from live2d.v2.platform_manager import PlatformManager as _PlatformManager +from live2d.v2.core.graphics.draw_param_opengl import DrawParamOpenGL as _DrawParamOpenGL +import OpenGL.GL as _gl + + +def _PatchedLoadTexture(self, live2DModel, no, path): + """预乘 alpha 的纹理加载,匹配 WebGL 的 UNPACK_PREMULTIPLY_ALPHA_WEBGL""" + image = _PILImage.open(path) + if image.mode != 'RGBA': + image = image.convert("RGBA") + # 预乘 alpha:RGB = RGB * alpha / 255 + r, g, b, a = image.split() + a_rgb = _PILImage.merge("RGB", (a, a, a)) + rgb = _PILImage.merge("RGB", (r, g, b)) + rgb_pm = _ImageChops.multiply(rgb, a_rgb) + image = _PILImage.merge("RGBA", (*rgb_pm.split(), a)) + image_data = image.tobytes() + width, height = image.size + _gl.glEnable(_gl.GL_TEXTURE_2D) + texture = _gl.glGenTextures(1) + _gl.glBindTexture(_gl.GL_TEXTURE_2D, texture) + _gl.glTexImage2D( + _gl.GL_TEXTURE_2D, 0, _gl.GL_RGBA, width, height, 0, _gl.GL_RGBA, _gl.GL_UNSIGNED_BYTE, image_data + ) + _gl.glTexParameteri(_gl.GL_TEXTURE_2D, _gl.GL_TEXTURE_MIN_FILTER, _gl.GL_LINEAR_MIPMAP_NEAREST) + _gl.glTexParameteri(_gl.GL_TEXTURE_2D, _gl.GL_TEXTURE_MAG_FILTER, _gl.GL_LINEAR) + _gl.glGenerateMipmap(_gl.GL_TEXTURE_2D) + _gl.glBindTexture(_gl.GL_TEXTURE_2D, 0) + live2DModel.setTexture(no, texture) + + +_PlatformManager.loadTexture = _PatchedLoadTexture + +# 修改 shader 去掉预乘行(因为纹理已预乘,避免双重预乘) +_OriginalDrawParamInit = _DrawParamOpenGL.__init__ + + +def _PatchedDrawParamInit(self, version): + _OriginalDrawParamInit(self, version) + self.aM = self.aM.replace("smpColor.rgb = smpColor.rgb * smpColor.a;", "") + self.aJ = self.aJ.replace("col_formask.rgb = col_formask.rgb * col_formask.a;", "") + + +_DrawParamOpenGL.__init__ = _PatchedDrawParamInit +# ============== Monkey-patch 结束 ============== + +# ============== 路径与配置 ============== +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +MODEL_DIR = os.path.join(SCRIPT_DIR, "model") + +# 角色目录(22 / 33) +CHARACTERS = ["22", "33"] + +ALPHA_THRESHOLD = 10 # 像素 alpha < 此值视为透明(可穿透) + + +def ScanModelFiles(): + """扫描 model/ 下所有角色目录的 model.*.json,返回 {(角色, 服装名): 路径}""" + result = {} + for char in CHARACTERS: + char_dir = os.path.join(MODEL_DIR, char) + if not os.path.isdir(char_dir): + continue + for path in glob.glob(os.path.join(char_dir, "model.*.json")): + fname = os.path.basename(path) # model.default.json + costume = fname[len("model."):-len(".json")] # default + result[(char, costume)] = path + return result + + +# 服装中文名映射(常见的几个) +COSTUME_CN = { + "default": "默认", + "2016.xmas.1": "2016圣诞(1)", + "2016.xmas.2": "2016圣诞(2)", + "2017.cba-normal": "2017应援(普)", + "2017.cba-super": "2017应援(超)", + "2017.newyear": "2017新年", + "2017.school": "2017校服", + "2017.summer.normal.1": "2017夏装(普1)", + "2017.summer.normal.2": "2017夏装(普2)", + "2017.summer.super.1": "2017夏装(超1)", + "2017.summer.super.2": "2017夏装(超2)", + "2017.tomo-bukatsu.high": "2017社团(高)", + "2017.tomo-bukatsu.low": "2017社团(低)", + "2017.valley": "2017山谷", + "2017.vdays": "2017情人节", + "2018.bls-summer": "2018BLS夏", + "2018.bls-winter": "2018BLS冬", + "2018.lover": "2018恋人", + "2018.spring": "2018春装", +} + +DEFAULT_KEY = ("22", "default") + +WIN_W = 450 +WIN_H = 650 +DRAG_THRESHOLD = 5 # 像素,超过则判定为拖动 +DRAG_SCALE = 0.4 # 视线跟随缩放比例(0=不动, 1=全幅跟随),减小转头幅度 + +# 随机字幕(2333娘风格台词) +SUBTITLES = [ + "2333~", "主人好呀!", "今天也元气满满呢!", "陪我玩一会儿嘛~", + "嘻嘻嘻~", "想吃饭团了...", "主人在看什么呀?", "摸鱼中,请勿打扰~", + "困了...Zzz", "今天直播看了吗?", "投币点赞收藏~", "主人最可爱了!", + "哔哩哔哩干杯!", "悄悄摸一下~", "诶嘿嘿~", "要不要一起看番?", + "我的发卡好看吗?", "尾巴给你摸一下~", "今天也要好好吃饭哦", +] +SUBTITLE_INTERVAL = (15000, 30000) # 字幕随机间隔(毫秒) +SUBTITLE_DURATION = 6000 # 字幕显示时长(毫秒) + + +class SubtitleBubble(QWidget): + """字幕气泡:独立透明窗口,显示在桌宠上方""" + + BUBBLE_QSS = """ + QLabel { + background: rgba(35, 35, 42, 220); + color: #e8e8ec; + padding: 10px 20px; + border-radius: 14px; + font-family: "Microsoft YaHei", "微软雅黑", sans-serif; + font-size: 15px; + } + """ + + def __init__(self): + super().__init__() + self.setWindowFlags( + Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool + ) + self.setAttribute(Qt.WA_TranslucentBackground, True) + self.setAttribute(Qt.WA_ShowWithoutActivating, True) + layout = QVBoxLayout(self) + layout.setContentsMargins(0, 0, 0, 0) + self.label = QLabel() + self.label.setStyleSheet(self.BUBBLE_QSS) + layout.addWidget(self.label) + self.hide() + self.hide_timer = QTimer(self) + self.hide_timer.setSingleShot(True) + self.hide_timer.timeout.connect(self.hide) + + def show_text(self, text, pos): + """在指定位置显示字幕,一段时间后自动隐藏""" + self.label.setText(text) + self.label.adjustSize() + self.adjustSize() + self.move(pos) + self.show() + self.hide_timer.start(SUBTITLE_DURATION) + + +class Live2DPet(QOpenGLWidget): + """Live2D 桌宠主窗口""" + + def __init__(self, model_path: str): + super().__init__() + self.setWindowFlags( + Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool + ) + self.setAttribute(Qt.WA_TranslucentBackground, True) + self.setAttribute(Qt.WA_AlwaysStackOnTop, True) + self.setMouseTracking(True) + self.resize(WIN_W, WIN_H) + self.setWindowTitle("2333娘 Live2D 桌宠") + + # 初始位置:屏幕右下角 + screen = QApplication.primaryScreen().geometry() + self.move(screen.width() - WIN_W - 40, screen.height() - WIN_H - 90) + + # 模型状态 + self.model_path = model_path + self.model = None + self.scale = 1.05 + self.offset_y = 0.1 # 模型竖直偏移 + self._model_cache = ScanModelFiles() # 缓存模型列表,避免每次右键扫描 + self._menu = None # 预创建菜单缓存,避免首次右键卡顿 + self._desktop_pet = None # 搞笑模式 DesktopPet 实例 + self._tk_timer = None # 驱动 tkinter 事件的定时器 + self._alpha_mask = None # 缓存窗口 alpha 通道,用于点击穿透判定 + self._alpha_frame = 0 # alpha mask 更新帧计数 + self._click_through_state = None # 缓存当前 WS_EX_TRANSPARENT 状态 + + # 拖动 / 点击判定 + self._drag_offset = None + self._press_pos = None + self._moved = False + + # 渲染定时器(~60fps)+ 全局鼠标跟踪 + self.render_timer = QTimer(self) + self.render_timer.timeout.connect(self._tick) + self.render_timer.start(16) + + # 空闲随机动作定时器 + self.idle_timer = QTimer(self) + self.idle_timer.timeout.connect(self._idle_action) + self._reset_idle_timer() + + # 随机字幕气泡 + self.bubble = SubtitleBubble() + self.subtitle_timer = QTimer(self) + self.subtitle_timer.setSingleShot(True) + self.subtitle_timer.timeout.connect(self._show_subtitle) + self.subtitle_timer.start(random.randint(*SUBTITLE_INTERVAL)) + + # ============== 渲染 + 全局鼠标跟踪 + 点击穿透 ============== + def _tick(self): + """每帧:全局鼠标位置跟踪视线 + alpha mask 更新 + 点击穿透检测 + 触发重绘""" + global_pos = QCursor.pos() + local = self.mapFromGlobal(global_pos) + # 视线跟随(非拖动状态) + if self.model and self._drag_offset is None: + try: + cx, cy = self.width() / 2, self.height() / 2 + dx = (local.x() - cx) * DRAG_SCALE + cx + dy = (local.y() - cy) * DRAG_SCALE + cy + self.model.Drag(dx, dy) + except Exception: + pass + # 每 6 帧用 grabFramebuffer 更新一次 alpha mask(glReadPixels 在 v2 下失败) + self._alpha_frame += 1 + if self._alpha_frame >= 6: + self._alpha_frame = 0 + try: + img = self.grabFramebuffer() + if img is not None and not img.isNull(): + img = img.convertToFormat(QImage.Format_RGBA8888) + ptr = img.constBits() + ptr.setsize(img.byteCount()) + raw = bytes(ptr) + self._alpha_mask = bytes(raw[i] for i in range(3, len(raw), 4)) + except Exception: + self._alpha_mask = None + # 点击穿透检测:透明像素 → 穿透;不透明像素 / 拖动中 / 窗口外 → 不穿透 + if self._drag_offset is not None: + self._set_click_through(False) + elif 0 <= local.x() < self.width() and 0 <= local.y() < self.height(): + self._set_click_through(self._is_pixel_transparent(local.x(), local.y())) + else: + self._set_click_through(False) + self.update() + + # ============== OpenGL 生命周期 ============== + def initializeGL(self): + live2d.glInit() + self._load_model(self.model_path) + + def resizeGL(self, w, h): + if self.model: + self.model.Resize(w, h) + self._apply_transform() + + def paintGL(self): + live2d.clearBuffer() + if self.model: + self.model.Update() + self.model.Draw() + + def _load_model(self, path: str): + self.makeCurrent() + try: + self.model = live2d.LAppModel() + self.model.LoadModelJson(path) + self.model.SetAutoBlinkEnable(True) + self.model.SetAutoBreathEnable(True) + self.model.Resize(self.width(), self.height()) + self._apply_transform() + # 进场 idle + try: + self.model.StartRandomMotion("idle", live2d.MotionPriority.IDLE) + except Exception: + pass + finally: + self.doneCurrent() + + def _apply_transform(self): + if not self.model: + return + try: + self.model.SetScale(self.scale) + except Exception: + pass + try: + self.model.SetOffset(0, self.offset_y) + except Exception: + pass + + # ============== 透明区域点击穿透 ============== + # Win32 常量 + GWL_EXSTYLE = -20 + WS_EX_TRANSPARENT = 0x00000020 + + def _set_click_through(self, through: bool): + """动态设置 WS_EX_TRANSPARENT,让透明区域点击穿透到桌面。 + 带状态缓存,仅在状态变化时调用 Win32 API,避免每帧开销。""" + if self._click_through_state == through: + return + try: + hwnd = int(self.winId()) + ex = ctypes.windll.user32.GetWindowLongW(hwnd, self.GWL_EXSTYLE) + if through: + ex |= self.WS_EX_TRANSPARENT + else: + ex &= ~self.WS_EX_TRANSPARENT + ctypes.windll.user32.SetWindowLongW(hwnd, self.GWL_EXSTYLE, ex) + self._click_through_state = through + except Exception: + pass + + def _is_pixel_transparent(self, x: int, y: int) -> bool: + """从缓存的 alpha mask 中查询 (x, y) 是否透明""" + if not self.model: + return True + if self._alpha_mask is None: + return False # 无缓存时不穿透(避免误穿透导致无法交互) + w, h = self.width(), self.height() + if x < 0 or x >= w or y < 0 or y >= h: + return True + # OpenGL y 轴向上,窗口 y 轴向下,需翻转 + gl_y = h - 1 - y + idx = gl_y * w + x + if idx < len(self._alpha_mask): + return self._alpha_mask[idx] < ALPHA_THRESHOLD + return False + + # ============== 交互 ============== + def mousePressEvent(self, e): + if e.button() == Qt.LeftButton: + self._press_pos = e.globalPos() + self._drag_offset = e.globalPos() - self.frameGeometry().topLeft() + self._moved = False + elif e.button() == Qt.RightButton: + self._show_menu(e.globalPos()) + + def mouseMoveEvent(self, e): + # 拖动窗口(视线跟随由 _tick 全局处理) + if self._drag_offset is not None and self._press_pos is not None: + if (e.globalPos() - self._press_pos).manhattanLength() > DRAG_THRESHOLD: + self._moved = True + self.move(e.globalPos() - self._drag_offset) + + def mouseReleaseEvent(self, e): + if e.button() == Qt.LeftButton: + if not self._moved and self.model: + # 视为点击模型 → 触发动作 + try: + self.model.StartRandomMotion("tap_body", live2d.MotionPriority.NORMAL) + except Exception: + try: + self.model.StartRandomMotion("idle", live2d.MotionPriority.IDLE) + except Exception: + pass + self._drag_offset = None + self._press_pos = None + self._moved = False + + def wheelEvent(self, e): + delta = e.angleDelta().y() + if delta > 0: + self.scale = min(self.scale * 1.08, 3.0) + else: + self.scale = max(self.scale / 1.08, 0.3) + self._apply_transform() + self.update() + + def leaveEvent(self, e): + # 鼠标离开窗口时无需处理(_tick 全局跟踪会继续跟随) + pass + + def keyPressEvent(self, e): + if e.key() == Qt.Key_Escape: + QApplication.quit() + + def showEvent(self, e): + super().showEvent(e) + # 窗口显示后预创建菜单,触发字体/QSS 首次加载,避免首次右键卡顿 + if self._menu is None: + self._build_menu() + + # ============== 菜单 ============== + MENU_QSS = """ + QMenu { + background: rgba(35, 35, 42, 245); + border: 1px solid rgba(120, 120, 140, 60); + border-radius: 10px; + padding: 6px; + color: #e8e8ec; + font-family: "Microsoft YaHei", "微软雅黑", sans-serif; + font-size: 15px; + } + QMenu::item { + padding: 7px 28px 7px 22px; + border-radius: 6px; + margin: 1px 4px; + } + QMenu::item:selected { + background: rgba(86, 122, 232, 200); + color: #ffffff; + } + QMenu::item:checked { + background: rgba(86, 232, 144, 80); + color: #ffffff; + } + QMenu::item:checked:selected { + background: rgba(86, 232, 144, 160); + } + QMenu::separator { + height: 1px; + background: rgba(255, 255, 255, 35); + margin: 5px 10px; + } + QMessageBox { + background: rgba(35, 35, 42, 245); + border: 1px solid rgba(120, 120, 140, 60); + border-radius: 10px; + font-family: "Microsoft YaHei", "微软雅黑", sans-serif; + } + QMessageBox QLabel { + color: #e8e8ec; + font-family: "Microsoft YaHei", "微软雅黑", sans-serif; + font-size: 15px; + } + QPushButton { + background: rgba(86, 122, 232, 200); + color: #ffffff; + border: none; + border-radius: 5px; + padding: 6px 18px; + font-family: "Microsoft YaHei", "微软雅黑", sans-serif; + } + QPushButton:hover { + background: rgba(106, 142, 252, 230); + } + """ + + def _build_menu(self): + """预创建并缓存菜单,避免每次右键重建导致卡顿""" + menu = QMenu(self) + menu.setStyleSheet(self.MENU_QSS) + + self._act_motion = menu.addAction("随机动作 ♪") + self._act_expr = menu.addAction("随机表情 ☆") + self._act_thank = menu.addAction("感谢动作 ♥") + self._act_say = menu.addAction("说句话 ✦") + menu.addSeparator() + + # 切换角色·服装(两级子菜单:22 / 33 → 服装列表) + self._switch_menu = menu.addMenu("切换角色·服装") + models = self._model_cache + self._costume_actions = {} + for char in CHARACTERS: + char_menu = self._switch_menu.addMenu(f"{char}娘") + char_menu.setStyleSheet(self.MENU_QSS) + for (c, costume), path in sorted(models.items()): + if c != char: + continue + label = COSTUME_CN.get(costume, costume) + act = char_menu.addAction(label) + act.setData(path) + act.setCheckable(True) + self._costume_actions[path] = act + + menu.addSeparator() + self._act_top = menu.addAction("置顶 / 取消置顶") + self._act_fun = menu.addAction("搞笑模式 🤪") + self._act_about = menu.addAction("开发者名单 ℹ") + self._act_quit = menu.addAction("退出 (。•́︿•̀。)") + self._menu = menu + + def _show_menu(self, global_pos): + if self._menu is None: + self._build_menu() + # 更新服装选中状态 + for path, act in self._costume_actions.items(): + act.setChecked(path == self.model_path) + + action = self._menu.exec_(global_pos) + if action is None: + return + if action == self._act_motion: + self._random_motion() + elif action == self._act_expr: + self._random_expression() + elif action == self._act_thank: + self._thank_motion() + elif action == self._act_say: + self._show_subtitle() + self.subtitle_timer.stop() + self.subtitle_timer.start(random.randint(*SUBTITLE_INTERVAL)) + elif action == self._act_top: + flags = self.windowFlags() + self.setWindowFlags(flags ^ Qt.WindowStaysOnTopHint) + self.show() + elif action == self._act_fun: + self._switch_to_desktop_pet() + elif action == self._act_about: + self._show_about() + elif action == self._act_quit: + QApplication.quit() + elif action in self._costume_actions.values(): + path = action.data() + if path and os.path.isfile(path): + self.model_path = path + self._load_model(path) + + def _switch_to_desktop_pet(self): + """切换到 tkinter 版搞笑模式:隐藏 Live2D 窗口,内嵌运行 DesktopPet""" + from DesktopPet import DesktopPet + self.hide() + self.render_timer.stop() + self.bubble.hide() + # 非阻塞运行 DesktopPet,退出时回调恢复 Live2D + self._desktop_pet = DesktopPet( + blocking=False, + on_exit=self._restore_from_desktop_pet, + ) + # 用 QTimer 驱动 tkinter 事件循环 + self._tk_timer = QTimer(self) + self._tk_timer.timeout.connect(self._pump_tk) + self._tk_timer.start(16) + + def _pump_tk(self): + """驱动 tkinter 事件处理""" + try: + if self._desktop_pet and not self._desktop_pet._exited: + self._desktop_pet.root.update() + else: + self._tk_timer.stop() + except Exception: + # root 已销毁 + self._tk_timer.stop() + + def _restore_from_desktop_pet(self): + """DesktopPet 退出后恢复 Live2D""" + self._tk_timer.stop() + self._desktop_pet = None + self.render_timer.start(16) + self.show() + + def _show_about(self): + """显示开发者名单""" + msg = QMessageBox(self) + msg.setWindowTitle("开发者名单") + msg.setText( + "
" + "

2333娘 Live2D 桌宠

" + "" + "" + "" + "" + "" + "" + "
Mincrohard_1724
Dinganzhi
MicGan(Chindows)
TermiNexus
悠然自得
" + "

谨献给每一个需要陪伴的人 ♡

" + "
" + ) + msg.setStyleSheet(self.MENU_QSS) + msg.exec_() + + # ============== 行为 ============== + def _random_motion(self): + if not self.model: + return + # 2233 模型的动作组:idle / tap_body / thanking + group = random.choice(["idle", "tap_body", "thanking"]) + try: + self.model.StartRandomMotion(group, live2d.MotionPriority.NORMAL) + except Exception: + pass + + def _random_expression(self): + if not self.model: + return + try: + self.model.SetRandomExpression() + except Exception: + pass + + def _thank_motion(self): + if not self.model: + return + try: + self.model.StartRandomMotion("thanking", live2d.MotionPriority.FORCE) + except Exception: + try: + self.model.StartRandomMotion("idle", live2d.MotionPriority.NORMAL) + except Exception: + pass + + def _idle_action(self): + if not self.model: + return + # 随机:动作 或 表情 + if random.random() < 0.6: + self._random_motion() + else: + self._random_expression() + self._reset_idle_timer() + + def _model_top_y(self): + """从 alpha mask 找到模型最上方的非透明像素(窗口坐标 y),None 表示无数据""" + if not self._alpha_mask: + return None + w, h = self.width(), self.height() + for y in range(h): + gl_y = h - 1 - y + row_start = gl_y * w + if max(self._alpha_mask[row_start:row_start + w]) >= ALPHA_THRESHOLD: + return y + return None + + def _show_subtitle(self): + """随机显示一条字幕气泡,紧贴模型头部上方""" + text = random.choice(SUBTITLES) + self.bubble.show_text(text, QPoint(0, 0)) # 先 show 再算尺寸 + fg = self.frameGeometry() + bx = fg.center().x() - self.bubble.width() // 2 + # 用模型实际顶部定位,回退到窗口顶部 + top_y = self._model_top_y() + anchor_y = top_y if top_y is not None else 0 + by = fg.top() + anchor_y - self.bubble.height() - 12 + # 屏幕上方不够时放到模型下方 + screen_top = QApplication.primaryScreen().availableGeometry().top() + if by < screen_top: + bottom_y = self.height() + by = fg.top() + bottom_y + 12 + self.bubble.move(bx, by) + self.subtitle_timer.start(random.randint(*SUBTITLE_INTERVAL)) + + def _reset_idle_timer(self): + self.idle_timer.start(random.randint(7000, 15000)) + + # ============== 退出清理 ============== + def closeEvent(self, e): + try: + self.render_timer.stop() + self.idle_timer.stop() + self.subtitle_timer.stop() + self.bubble.close() + except Exception: + pass + # 清理搞笑模式 + try: + if self._tk_timer: + self._tk_timer.stop() + if self._desktop_pet and not self._desktop_pet._exited: + self._desktop_pet._do_exit() + except Exception: + pass + try: + self.makeCurrent() + self.model = None + self.doneCurrent() + except Exception: + pass + try: + live2d.dispose() + except Exception: + pass + e.accept() + # Qt.Tool 窗口关闭不会自动退出事件循环,需显式 quit + QApplication.quit() + + +def main(): + # 确保 OpenGL 上下文带 alpha 通道(透明窗口必需)+ MSAA 抗锯齿 + fmt = QSurfaceFormat() + fmt.setAlphaBufferSize(8) + fmt.setDepthBufferSize(24) + fmt.setSamples(4) # MSAA 4x 抗锯齿,减少模型边缘锯齿 + fmt.setSwapBehavior(QSurfaceFormat.DoubleBuffer) + QSurfaceFormat.setDefaultFormat(fmt) + + # 关闭 live2d-py 日志刷屏 + try: + live2d.setLogLevel(live2d.Live2DLogLevels.Off) + except Exception: + pass + + live2d.init() + + app = QApplication(sys.argv) + app.setApplicationName("2333娘 Live2D 桌宠") + + models = ScanModelFiles() + model_path = models.get(DEFAULT_KEY) + if not model_path or not os.path.isfile(model_path): + # 回退:取第一个可用的 + if models: + model_path = list(models.values())[0] + else: + print(f"[错误] 在 {MODEL_DIR} 下找不到任何模型文件") + print("请确认 model/22 或 model/33 目录存在且包含 model.*.json") + sys.exit(1) + + pet = Live2DPet(model_path) + pet.show() + + sys.exit(app.exec_()) + + +if __name__ == "__main__": + main() diff --git a/Live2DPet.spec b/Live2DPet.spec new file mode 100644 index 0000000..8acad2c --- /dev/null +++ b/Live2DPet.spec @@ -0,0 +1,44 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['Live2DPet.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='Live2DPet', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) +coll = COLLECT( + exe, + a.binaries, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='Live2DPet', +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..704267d --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +```bash +pip install live2d pyqt5 +``` +主入口在 Live2DPet.py +用 pyinstaller 打包其即可 +```bash +pyinstaller -w Live2DPet.py --onefile +``` + +需要让程序工作目录下有“model”文件夹 \ No newline at end of file diff --git a/_2233live2d-main/README.md b/_2233live2d-main/README.md new file mode 100644 index 0000000..74a5941 --- /dev/null +++ b/_2233live2d-main/README.md @@ -0,0 +1,29 @@ +## 2233live2d + +从 [哔哩哔哩 Windows 客户端](https://app.bilibili.com/) 解包得到的 2233 娘 live2D 模型 + +--- + +食用方式: + +使用非常简单,只需要如下三步: + +1. 引入`live2d.js` + +```html + +``` + +2. 放置 canvas + +```html + +``` + +3. 绑定模型 + +```js +loadlive2d("live2d", "res/model/22/model.default.json"); +``` + +\* 示例 html 可见`demo.html` diff --git a/_2233live2d-main/demo.html b/_2233live2d-main/demo.html new file mode 100644 index 0000000..f372deb --- /dev/null +++ b/_2233live2d-main/demo.html @@ -0,0 +1,15 @@ + + + + + + live2d测试 + + + + + + + + + \ No newline at end of file diff --git a/_2233live2d-main/favicon.ico b/_2233live2d-main/favicon.ico new file mode 100644 index 0000000..628ecb4 Binary files /dev/null and b/_2233live2d-main/favicon.ico differ diff --git a/_2233live2d-main/index.html b/_2233live2d-main/index.html new file mode 100644 index 0000000..705108d --- /dev/null +++ b/_2233live2d-main/index.html @@ -0,0 +1,322 @@ + + + + + + + 哔哩哔哩2233娘 Live2D 预览 + + + + + + +

2233娘 Live2D 预览

+
+ +
+
加载中...
+ +
+ +
+ 角色 +
+ + +
+ 服装 + +
+
+ + + + + + + \ No newline at end of file diff --git a/_2233live2d-main/res/js/live2d.js b/_2233live2d-main/res/js/live2d.js new file mode 100644 index 0000000..93c21af --- /dev/null +++ b/_2233live2d-main/res/js/live2d.js @@ -0,0 +1,5 @@ +"use strict";!function(t){function i(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}var e={};i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=4)}([function(t,i,e){function r(){this.live2DModel=null,this.modelMatrix=null,this.eyeBlink=null,this.physics=null,this.pose=null,this.debugMode=!1,this.initialized=!1,this.updating=!1,this.alpha=1,this.accAlpha=0,this.lipSync=!1,this.lipSyncValue=0,this.accelX=0,this.accelY=0,this.accelZ=0,this.dragX=0,this.dragY=0,this.startTimeMSec=null,this.mainMotionManager=new h,this.expressionManager=new h,this.motions={},this.expressions={},this.isTexLoaded=!1}function o(){AMotion.prototype.constructor.call(this),this.paramList=new Array}function n(){this.id="",this.type=-1,this.value=null}function s(){this.nextBlinkTime=null,this.stateStartTime=null,this.blinkIntervalMsec=null,this.eyeState=g.STATE_FIRST,this.blinkIntervalMsec=4e3,this.closingMotionMsec=100,this.closedMotionMsec=50,this.openingMotionMsec=150,this.closeIfZero=!0,this.eyeID_L="PARAM_EYE_L_OPEN",this.eyeID_R="PARAM_EYE_R_OPEN"}function _(){this.tr=new Float32Array(16),this.identity()}function a(t,i){_.prototype.constructor.call(this),this.width=t,this.height=i}function h(){MotionQueueManager.prototype.constructor.call(this),this.currentPriority=null,this.reservePriority=null,this.super=MotionQueueManager.prototype}function l(){this.physicsList=new Array,this.startTimeMSec=UtSystem.getUserTimeMSec()}function $(){this.lastTime=0,this.lastModel=null,this.partsGroups=new Array}function u(t){this.paramIndex=-1,this.partsIndex=-1,this.link=null,this.id=t}function p(){this.EPSILON=.01,this.faceTargetX=0,this.faceTargetY=0,this.faceX=0,this.faceY=0,this.faceVX=0,this.faceVY=0,this.lastTimeSec=0}function f(){_.prototype.constructor.call(this),this.screenLeft=null,this.screenRight=null,this.screenTop=null,this.screenBottom=null,this.maxLeft=null,this.maxRight=null,this.maxTop=null,this.maxBottom=null,this.max=Number.MAX_VALUE,this.min=0}function c(){}var d=0;r.prototype.getModelMatrix=function(){return this.modelMatrix},r.prototype.setAlpha=function(t){t>.999&&(t=1),t<.001&&(t=0),this.alpha=t},r.prototype.getAlpha=function(){return this.alpha},r.prototype.isInitialized=function(){return this.initialized},r.prototype.setInitialized=function(t){this.initialized=t},r.prototype.isUpdating=function(){return this.updating},r.prototype.setUpdating=function(t){this.updating=t},r.prototype.getLive2DModel=function(){return this.live2DModel},r.prototype.setLipSync=function(t){this.lipSync=t},r.prototype.setLipSyncValue=function(t){this.lipSyncValue=t},r.prototype.setAccel=function(t,i,e){this.accelX=t,this.accelY=i,this.accelZ=e},r.prototype.setDrag=function(t,i){this.dragX=t,this.dragY=i},r.prototype.getMainMotionManager=function(){return this.mainMotionManager},r.prototype.getExpressionManager=function(){return this.expressionManager},r.prototype.loadModelData=function(t,i){var e=c.getPlatformManager();this.debugMode&&e.log("Load model : "+t);var r=this;e.loadLive2DModel(t,function(t){if(r.live2DModel=t,r.live2DModel.saveParam(),0!=Live2D.getError())return void console.error("Error : Failed to loadModelData().");r.modelMatrix=new a(r.live2DModel.getCanvasWidth(),r.live2DModel.getCanvasHeight()),r.modelMatrix.setWidth(2),r.modelMatrix.setCenterPosition(0,0),i(r.live2DModel)})},r.prototype.loadTexture=function(t,i,e){d++;var r=c.getPlatformManager();this.debugMode&&r.log("Load Texture : "+i);var o=this;r.loadTexture(this.live2DModel,t,i,function(){d--,0==d&&(o.isTexLoaded=!0),"function"==typeof e&&e()})},r.prototype.loadMotion=function(t,i,e){var r=c.getPlatformManager();this.debugMode&&r.log("Load Motion : "+i);var o=null,n=this;r.loadBytes(i,function(i){o=Live2DMotion.loadMotion(i),null!=t&&(n.motions[t]=o),e(o)})},r.prototype.loadExpression=function(t,i,e){var r=c.getPlatformManager();this.debugMode&&r.log("Load Expression : "+i);var n=this;r.loadBytes(i,function(i){null!=t&&(n.expressions[t]=o.loadJson(i)),"function"==typeof e&&e()})},r.prototype.loadPose=function(t,i){var e=c.getPlatformManager();this.debugMode&&e.log("Load Pose : "+t);var r=this;try{e.loadBytes(t,function(t){r.pose=$.load(t),"function"==typeof i&&i()})}catch(t){console.warn(t)}},r.prototype.loadPhysics=function(t){var i=c.getPlatformManager();this.debugMode&&i.log("Load Physics : "+t);var e=this;try{i.loadBytes(t,function(t){e.physics=l.load(t)})}catch(t){console.warn(t)}},r.prototype.hitTestSimple=function(t,i,e){if(null===this.live2DModel)return!1;var r=this.live2DModel.getDrawDataIndex(t);if(r<0)return!1;for(var o=this.live2DModel.getTransformedPoints(r),n=this.live2DModel.getCanvasWidth(),s=0,_=this.live2DModel.getCanvasHeight(),a=0,h=0;hs&&(s=l),$<_&&(_=$),$>a&&(a=$)}var u=this.modelMatrix.invertTransformX(i),p=this.modelMatrix.invertTransformY(e);return n<=u&&u<=s&&_<=p&&p<=a},r.prototype.hitTestSimpleCustom=function(t,i,e,r){return null!==this.live2DModel&&e>=t[0]&&e<=i[0]&&r<=t[1]&&r>=i[1]},o.prototype=new AMotion,o.EXPRESSION_DEFAULT="DEFAULT",o.TYPE_SET=0,o.TYPE_ADD=1,o.TYPE_MULT=2,o.loadJson=function(t){var i=new o,e=c.getPlatformManager(),r=e.jsonParseFromBytes(t);if(i.setFadeIn(parseInt(r.fade_in)>0?parseInt(r.fade_in):1e3),i.setFadeOut(parseInt(r.fade_out)>0?parseInt(r.fade_out):1e3),null==r.params)return i;var s=r.params,_=s.length;i.paramList=[];for(var a=0;a<_;a++){var h=s[a],l=h.id.toString(),$=parseFloat(h.val),u=o.TYPE_ADD,p=null!=h.calc?h.calc.toString():"add";if((u="add"===p?o.TYPE_ADD:"mult"===p?o.TYPE_MULT:"set"===p?o.TYPE_SET:o.TYPE_ADD)==o.TYPE_ADD){var f=null==h.def?0:parseFloat(h.def);$-=f}else if(u==o.TYPE_MULT){var f=null==h.def?1:parseFloat(h.def);0==f&&(f=1),$/=f}var d=new n;d.id=l,d.type=u,d.value=$,i.paramList.push(d)}return i},o.prototype.updateParamExe=function(t,i,e,r){for(var n=this.paramList.length-1;n>=0;--n){var s=this.paramList[n];s.type==o.TYPE_ADD?t.addToParamFloat(s.id,s.value,e):s.type==o.TYPE_MULT?t.multParamFloat(s.id,s.value,e):s.type==o.TYPE_SET&&t.setParamFloat(s.id,s.value,e)}},s.prototype.calcNextBlink=function(){return UtSystem.getUserTimeMSec()+Math.random()*(2*this.blinkIntervalMsec-1)},s.prototype.setInterval=function(t){this.blinkIntervalMsec=t},s.prototype.setEyeMotion=function(t,i,e){this.closingMotionMsec=t,this.closedMotionMsec=i,this.openingMotionMsec=e},s.prototype.updateParam=function(t){var i,e=UtSystem.getUserTimeMSec(),r=0;switch(this.eyeState){case g.STATE_CLOSING:r=(e-this.stateStartTime)/this.closingMotionMsec,r>=1&&(r=1,this.eyeState=g.STATE_CLOSED,this.stateStartTime=e),i=1-r;break;case g.STATE_CLOSED:r=(e-this.stateStartTime)/this.closedMotionMsec,r>=1&&(this.eyeState=g.STATE_OPENING,this.stateStartTime=e),i=0;break;case g.STATE_OPENING:r=(e-this.stateStartTime)/this.openingMotionMsec,r>=1&&(r=1,this.eyeState=g.STATE_INTERVAL,this.nextBlinkTime=this.calcNextBlink()),i=r;break;case g.STATE_INTERVAL:this.nextBlinkTime=t||this.currentPriority>=t||(this.reservePriority=t,0))},h.prototype.setReservePriority=function(t){this.reservePriority=t},h.prototype.updateParam=function(t){var i=MotionQueueManager.prototype.updateParam.call(this,t);return this.isFinished()&&(this.currentPriority=0),i},h.prototype.startMotionPrio=function(t,i){return i==this.reservePriority&&(this.reservePriority=0),this.currentPriority=i,this.startMotion(t,!1)},l.load=function(t){for(var i=new l,e=c.getPlatformManager(),r=e.jsonParseFromBytes(t),o=r.physics_hair,n=o.length,s=0;s=0)break;r=n,o=t.getPartsOpacity(s),(o+=e/.5)>1&&(o=1)}}r<0&&(r=0,o=1);for(var n=0;n.15&&(a=1-.15/(1-o)),h>a&&(h=a),t.setPartsOpacity(s,h)}}},$.prototype.copyOpacityOtherParts=function(t,i){for(var e=0;eo)&&(l*=o/u,$*=o/u,u=o),this.faceVX+=l,this.faceVY+=$;var f=.5*(Math.sqrt(o*o+16*o*_-8*o*_)-o),c=Math.sqrt(this.faceVX*this.faceVX+this.faceVY*this.faceVY);c>f&&(this.faceVX*=f/c,this.faceVY*=f/c),this.faceX+=this.faceVX,this.faceY+=this.faceVY}},f.prototype=new _,f.prototype.getMaxScale=function(){return this.max},f.prototype.getMinScale=function(){return this.min},f.prototype.setMaxScale=function(t){this.max=t},f.prototype.setMinScale=function(t){this.min=t},f.prototype.isMaxScale=function(){return this.getScaleX()==this.max},f.prototype.isMinScale=function(){return this.getScaleX()==this.min},f.prototype.adjustTranslate=function(t,i){this.tr[0]*this.maxLeft+(this.tr[12]+t)>this.screenLeft&&(t=this.screenLeft-this.tr[0]*this.maxLeft-this.tr[12]),this.tr[0]*this.maxRight+(this.tr[12]+t)this.screenBottom&&(i=this.screenBottom-this.tr[5]*this.maxBottom-this.tr[13]);var e=[1,0,0,0,0,1,0,0,0,0,1,0,t,i,0,1];_.mul(e,this.tr,this.tr)},f.prototype.adjustScale=function(t,i,e){var r=e*this.tr[0];r0&&(e=this.min/this.tr[0]):r>this.max&&this.tr[0]>0&&(e=this.max/this.tr[0]);var o=[1,0,0,0,0,1,0,0,0,0,1,0,t,i,0,1],n=[e,0,0,0,0,e,0,0,0,0,1,0,0,0,0,1],s=[1,0,0,0,0,1,0,0,0,0,1,0,-t,-i,0,1];_.mul(s,this.tr,this.tr),_.mul(n,this.tr,this.tr),_.mul(o,this.tr,this.tr)},f.prototype.setScreenRect=function(t,i,e,r){this.screenLeft=t,this.screenRight=i,this.screenTop=r,this.screenBottom=e},f.prototype.setMaxScreenRect=function(t,i,e,r){this.maxLeft=t,this.maxRight=i,this.maxTop=r,this.maxBottom=e},f.prototype.getScreenLeft=function(){return this.screenLeft},f.prototype.getScreenRight=function(){return this.screenRight},f.prototype.getScreenBottom=function(){return this.screenBottom},f.prototype.getScreenTop=function(){return this.screenTop},f.prototype.getMaxLeft=function(){return this.maxLeft},f.prototype.getMaxRight=function(){return this.maxRight},f.prototype.getMaxBottom=function(){return this.maxBottom},f.prototype.getMaxTop=function(){return this.maxTop},c.platformManager=null,c.getPlatformManager=function(){return c.platformManager},c.setPlatformManager=function(t){c.platformManager=t},t.exports={L2DTargetPoint:p,Live2DFramework:c,L2DViewMatrix:f,L2DPose:$,L2DPartsParam:u,L2DPhysics:l,L2DMotionManager:h,L2DModelMatrix:a,L2DMatrix44:_,EYE_STATE:g,L2DEyeBlink:s,L2DExpressionParam:n,L2DExpressionMotion:o,L2DBaseModel:r}},function(t,i,e){var r={DEBUG_LOG:!1,DEBUG_MOUSE_LOG:!1,DEBUG_DRAW_HIT_AREA:!1,DEBUG_DRAW_ALPHA_MODEL:!1,VIEW_MAX_SCALE:2,VIEW_MIN_SCALE:.8,VIEW_LOGICAL_LEFT:-1,VIEW_LOGICAL_RIGHT:1,VIEW_LOGICAL_MAX_LEFT:-2,VIEW_LOGICAL_MAX_RIGHT:2,VIEW_LOGICAL_MAX_BOTTOM:-2,VIEW_LOGICAL_MAX_TOP:2,PRIORITY_NONE:0,PRIORITY_IDLE:1,PRIORITY_SLEEPY:2,PRIORITY_NORMAL:3,PRIORITY_FORCE:4,MOTION_GROUP_IDLE:"idle",MOTION_GROUP_SLEEPY:"sleepy",MOTION_GROUP_TAP_BODY:"tap_body",MOTION_GROUP_FLICK_HEAD:"flick_head",MOTION_GROUP_PINCH_IN:"pinch_in",MOTION_GROUP_PINCH_OUT:"pinch_out",MOTION_GROUP_SHAKE:"shake",HIT_AREA_HEAD:"head",HIT_AREA_BODY:"body"};t.exports=r},function(t,i,e){function r(t){n=t}function o(){return n}Object.defineProperty(i,"__esModule",{value:!0}),i.setContext=r,i.getContext=o;var n=void 0},function(t,i,e){function r(){}r.matrixStack=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.depth=0,r.currentMatrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r.tmp=new Array(16),r.reset=function(){this.depth=0},r.loadIdentity=function(){for(var t=0;t<16;t++)this.currentMatrix[t]=t%5==0?1:0},r.push=function(){var t=(this.depth,16*(this.depth+1));this.matrixStack.lengthe.left&&i.y>e.top)return i;var o=t.x-i.x,n=t.y-i.y,s=r(o,n);i.xat.frameBuffers.length&&(this.curFrameNo=this.getMaskRenderTexture()),this.tmpModelToViewMatrix=new R,this.tmpMatrix2=new R,this.tmpMatrixForMask=new R,this.tmpMatrixForDraw=new R,this.CHANNEL_COLORS=new Array;var i=new A;i=new A,i.r=0,i.g=0,i.b=0,i.a=1,this.CHANNEL_COLORS.push(i),i=new A,i.r=1,i.g=0,i.b=0,i.a=0,this.CHANNEL_COLORS.push(i),i=new A,i.r=0,i.g=1,i.b=0,i.a=0,this.CHANNEL_COLORS.push(i),i=new A,i.r=0,i.g=0,i.b=1,i.a=0,this.CHANNEL_COLORS.push(i);for(var e=0;eG._$T7)throw t._$NP|=i._$4s,new lt("_$gi _$C _$li , _$n0 _$_ version _$li ( SDK : "+G._$T7+" < _$f0 : "+r+" )@_$SS#loadModel()\n");var h=o._$nP();if(r>=G._$s7){var l=o._$9T(),$=o._$9T();if(-30584!=l||-30584!=$)throw t._$NP|=i._$0s,new lt("_$gi _$C _$li , _$0 _$6 _$Ui.")}t._$KS(h);var u=t.getModelContext();u.setDrawParam(t.getDrawParam()),u.init()}catch(t){_._$Rb(t)}},i.prototype._$KS=function(t){this._$MT=t},i.prototype.getModelImpl=function(){return null==this._$MT&&(this._$MT=new p,this._$MT._$zP()),this._$MT},i.prototype.getCanvasWidth=function(){return null==this._$MT?0:this._$MT.getCanvasWidth()},i.prototype.getCanvasHeight=function(){return null==this._$MT?0:this._$MT.getCanvasHeight()},i.prototype.getParamFloat=function(t){return"number"!=typeof t&&(t=this._$5S.getParamIndex(u.getID(t))),this._$5S.getParamFloat(t)},i.prototype.setParamFloat=function(t,i,e){"number"!=typeof t&&(t=this._$5S.getParamIndex(u.getID(t))),arguments.length<3&&(e=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)*(1-e)+i*e)},i.prototype.addToParamFloat=function(t,i,e){"number"!=typeof t&&(t=this._$5S.getParamIndex(u.getID(t))),arguments.length<3&&(e=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)+i*e)},i.prototype.multParamFloat=function(t,i,e){"number"!=typeof t&&(t=this._$5S.getParamIndex(u.getID(t))),arguments.length<3&&(e=1),this._$5S.setParamFloat(t,this._$5S.getParamFloat(t)*(1+(i-1)*e))},i.prototype.getParamIndex=function(t){return this._$5S.getParamIndex(u.getID(t))},i.prototype.loadParam=function(){this._$5S.loadParam()},i.prototype.saveParam=function(){this._$5S.saveParam()},i.prototype.init=function(){this._$5S.init()},i.prototype.update=function(){this._$5S.update()},i.prototype._$Rs=function(){return _._$li("_$60 _$PT _$Rs()"),-1},i.prototype._$Ds=function(t){_._$li("_$60 _$PT _$SS#_$Ds() \n")},i.prototype._$K2=function(){},i.prototype.draw=function(){},i.prototype.getModelContext=function(){return this._$5S},i.prototype._$s2=function(){return this._$NP},i.prototype._$P7=function(t,i,e,r){var o=-1,n=0,s=this;if(0!=e)if(1==t.length){var _=t[0],a=0!=s.getParamFloat(_),h=i[0],l=s.getPartsOpacity(h),$=e/r;a?(l+=$)>1&&(l=1):(l-=$)<0&&(l=0),s.setPartsOpacity(h,l)}else{for(var u=0;u=0)break;o=u;var h=i[u];n=s.getPartsOpacity(h),(n+=e/r)>1&&(n=1)}}o<0&&(console.log("No _$wi _$q0/ _$U default[%s]",t[0]),o=0,n=1,s.loadParam(),s.setParamFloat(t[o],n),s.saveParam());for(var u=0;u.15&&(f=1-.15/(1-n)),c>f&&(c=f),s.setPartsOpacity(h,c)}}}else for(var u=0;u=this._$5S._$aS.length)return null;var i=this._$5S._$aS[t];return null!=i&&i.getType()==W._$wb&&i instanceof $t?i.getIndexArray():null},e.CHANNEL_COUNT=4,e.RENDER_TEXTURE_USE_MIPMAP=!1,e.NOT_USED_FRAME=-100,e.prototype._$L7=function(){if(this.tmpModelToViewMatrix&&(this.tmpModelToViewMatrix=null),this.tmpMatrix2&&(this.tmpMatrix2=null),this.tmpMatrixForMask&&(this.tmpMatrixForMask=null),this.tmpMatrixForDraw&&(this.tmpMatrixForDraw=null),this.tmpBoundsOnModel&&(this.tmpBoundsOnModel=null),this.CHANNEL_COLORS){for(var t=this.CHANNEL_COLORS.length-1;t>=0;--t)this.CHANNEL_COLORS.splice(t,1);this.CHANNEL_COLORS=[]}this.releaseShader()},e.prototype.releaseShader=function(){for(var t=at.frameBuffers.length,i=0;i0){var n=i.gl.getParameter(i.gl.FRAMEBUFFER_BINDING),s=new Array(4);s[0]=0,s[1]=0,s[2]=i.gl.canvas.width,s[3]=i.gl.canvas.height,i.gl.viewport(0,0,at.clippingMaskBufferSize,at.clippingMaskBufferSize),this.setupLayoutBounds(e),i.gl.bindFramebuffer(i.gl.FRAMEBUFFER,at.frameBuffers[this.curFrameNo].framebuffer),i.gl.clearColor(0,0,0,0),i.gl.clear(i.gl.COLOR_BUFFER_BIT);for(var r=0;rr?e:r,n=o,s=o,_=0,a=0,h=i.clippedDrawContextList.length,l=0;l_&&(_=S),v>a&&(a=v)}}if(n==o)i.allClippedDrawRect.x=0,i.allClippedDrawRect.y=0,i.allClippedDrawRect.width=0,i.allClippedDrawRect.height=0,i.isUsing=!1;else{var L=_-n,M=a-s;i.allClippedDrawRect.x=n,i.allClippedDrawRect.y=s,i.allClippedDrawRect.width=L,i.allClippedDrawRect.height=M,i.isUsing=!0}},e.prototype.setupLayoutBounds=function(t){var i=t/e.CHANNEL_COUNT,r=t%e.CHANNEL_COUNT;i=~~i,r=~~r;for(var o=0,n=0;n=1)return 1;var p=r,f=p*p;return l*(p*f)+$*f+u*p+0},s.prototype._$a0=function(){},s.prototype.setFadeIn=function(t){this._$dP=t},s.prototype.setFadeOut=function(t){this._$eo=t},s.prototype._$pT=function(t){this._$V0=t},s.prototype.getFadeOut=function(){return this._$eo},s.prototype._$4T=function(){return this._$eo},s.prototype._$mT=function(){return this._$V0},s.prototype.getDurationMSec=function(){return-1},s.prototype.getLoopDurationMSec=function(){return-1},s.prototype.updateParam=function(t,i){if(i._$AT&&!i._$9L){var e=w.getUserTimeMSec();if(i._$z2<0){i._$z2=e,i._$bs=e;var r=this.getDurationMSec();i._$Do<0&&(i._$Do=r<=0?-1:i._$z2+r)}var o=this._$V0;o=o*(0==this._$dP?1:ht._$r2((e-i._$bs)/this._$dP))*(0==this._$eo||i._$Do<0?1:ht._$r2((i._$Do-e)/this._$eo)),0<=o&&o<=1||console.log("### assert!! ### "),this.updateParamExe(t,e,o,i),i._$Do>0&&i._$Do0?console.log("\n"):e%8==0&&e>0&&console.log(" "),console.log("%02X ",255&t[e]);console.log("\n")},_._$nr=function(t,i,e){console.log("%s\n",t);for(var r=i.length,o=0;o=0;--r)this._$lL[r]._$oP(t,this);this._$oo(t,e),this._$M2=this._$Yb(),this._$9b=(this._$M2-this._$ks)/e,this._$ks=this._$M2}for(var r=this._$qP.length-1;r>=0;--r)this._$qP[r]._$YS(t,this);this._$iT=i},f.prototype._$oo=function(t,i){i<.033&&(i=.033);var e=1/i;this.p1.vx=(this.p1.x-this.p1._$s0)*e,this.p1.vy=(this.p1.y-this.p1._$70)*e,this.p1.ax=(this.p1.vx-this.p1._$7L)*e,this.p1.ay=(this.p1.vy-this.p1._$HL)*e,this.p1.fx=this.p1.ax*this.p1._$p,this.p1.fy=this.p1.ay*this.p1._$p,this.p1._$xT();var r,o,n=-Math.atan2(this.p1.y-this.p2.y,this.p1.x-this.p2.x),s=Math.cos(n),_=Math.sin(n),a=9.8*this.p2._$p,h=this._$Db*Lt._$bS,l=a*Math.cos(n-h);r=l*_,o=l*s;var $=-this.p1.fx*_*_,u=-this.p1.fy*_*s,p=-this.p2.vx*this._$L2,f=-this.p2.vy*this._$L2;this.p2.fx=r+$+p,this.p2.fy=o+u+f,this.p2.ax=this.p2.fx/this.p2._$p,this.p2.ay=this.p2.fy/this.p2._$p,this.p2.vx+=this.p2.ax*i,this.p2.vy+=this.p2.ay*i,this.p2.x+=this.p2.vx*i,this.p2.y+=this.p2.vy*i;var c=Math.sqrt((this.p1.x-this.p2.x)*(this.p1.x-this.p2.x)+(this.p1.y-this.p2.y)*(this.p1.y-this.p2.y));this.p2.x=this.p1.x+this._$Fo*(this.p2.x-this.p1.x)/c,this.p2.y=this.p1.y+this._$Fo*(this.p2.y-this.p1.y)/c,this.p2.vx=(this.p2.x-this.p2._$s0)*e,this.p2.vy=(this.p2.y-this.p2._$70)*e,this.p2._$xT()},c.prototype._$xT=function(){this._$s0=this.x,this._$70=this.y,this._$7L=this.vx,this._$HL=this.vy},d.prototype._$oP=function(t,i){},g.prototype=new d,g.prototype._$oP=function(t,i){var e=this.scale*t.getParamFloat(this._$wL),r=i.getPhysicsPoint1();switch(this._$tL){default:case f.Src.SRC_TO_X:r.x=r.x+(e-r.x)*this._$V0;break;case f.Src.SRC_TO_Y:r.y=r.y+(e-r.y)*this._$V0;break;case f.Src.SRC_TO_G_ANGLE:var o=i._$qr();o+=(e-o)*this._$V0,i._$pr(o)}},y.prototype._$YS=function(t,i){},T.prototype=new y,T.prototype._$YS=function(t,i){switch(this._$YP){default:case f.Target.TARGET_FROM_ANGLE:t.setParamFloat(this._$wL,this.scale*i._$5r(),this._$V0);break;case f.Target.TARGET_FROM_ANGLE_V:t.setParamFloat(this._$wL,this.scale*i._$Cs(),this._$V0)}},f.Src=function(){},f.Src.SRC_TO_X="SRC_TO_X",f.Src.SRC_TO_Y="SRC_TO_Y",f.Src.SRC_TO_G_ANGLE="SRC_TO_G_ANGLE",f.Target=function(){},f.Target.TARGET_FROM_ANGLE="TARGET_FROM_ANGLE",f.Target.TARGET_FROM_ANGLE_V="TARGET_FROM_ANGLE_V",P.prototype.init=function(t){this._$fL=t._$fL,this._$gL=t._$gL,this._$B0=t._$B0,this._$z0=t._$z0,this._$qT=t._$qT,this.reflectX=t.reflectX,this.reflectY=t.reflectY},P.prototype._$F0=function(t){this._$fL=t._$_T(),this._$gL=t._$_T(),this._$B0=t._$_T(),this._$z0=t._$_T(),this._$qT=t._$_T(),t.getFormatVersion()>=G.LIVE2D_FORMAT_VERSION_V2_10_SDK2&&(this.reflectX=t._$po(),this.reflectY=t._$po())},P.prototype._$e=function(){};var It=function(){};It._$ni=function(t,i,e,r,o,n,s,_,a){var h=s*n-_*o;if(0==h)return null;var l,$=((t-e)*n-(i-r)*o)/h;return l=0!=o?(t-e-$*s)/o:(i-r-$*_)/n,isNaN(l)&&(l=(t-e-$*s)/o,isNaN(l)&&(l=(i-r-$*_)/n),isNaN(l)&&(console.log("a is NaN @UtVector#_$ni() "),console.log("v1x : "+o),console.log("v1x != 0 ? "+(0!=o)))),null==a?new Array(l,$):(a[0]=l,a[1]=$,a)},S.prototype._$8P=function(){return this.x+.5*this.width},S.prototype._$6P=function(){return this.y+.5*this.height},S.prototype._$EL=function(){return this.x+this.width},S.prototype._$5T=function(){return this.y+this.height},S.prototype._$jL=function(t,i,e,r){this.x=t,this.y=i,this.width=e,this.height=r},S.prototype._$jL=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},S.prototype.contains=function(t,i){return this.x<=this.x&&this.y<=this.y&&this.x<=this.x+this.width&&this.y<=this.y+this.height},S.prototype.expand=function(t,i){this.x-=t,this.y-=i,this.width+=2*t,this.height+=2*i},v._$Z2=function(t,i,e,r){var o=i._$Q2(t,e),n=t._$vs(),s=t._$Tr();if(i._$zr(n,s,o),o<=0)return r[n[0]];if(1==o){var _=r[n[0]],a=r[n[1]],h=s[0];return _+(a-_)*h|0}if(2==o){var _=r[n[0]],a=r[n[1]],l=r[n[2]],$=r[n[3]],h=s[0],u=s[1],p=_+(a-_)*h|0,f=l+($-l)*h|0;return p+(f-p)*u|0}if(3==o){var c=r[n[0]],d=r[n[1]],g=r[n[2]],y=r[n[3]],m=r[n[4]],T=r[n[5]],P=r[n[6]],S=r[n[7]],h=s[0],u=s[1],v=s[2],_=c+(d-c)*h|0,a=g+(y-g)*h|0,l=m+(T-m)*h|0,$=P+(S-P)*h|0,p=_+(a-_)*u|0,f=l+($-l)*u|0;return p+(f-p)*v|0}if(4==o){var L=r[n[0]],M=r[n[1]],E=r[n[2]],A=r[n[3]],I=r[n[4]],w=r[n[5]],x=r[n[6]],O=r[n[7]],D=r[n[8]],R=r[n[9]],b=r[n[10]],F=r[n[11]],C=r[n[12]],N=r[n[13]],B=r[n[14]],U=r[n[15]],h=s[0],u=s[1],v=s[2],G=s[3],c=L+(M-L)*h|0,d=E+(A-E)*h|0,g=I+(w-I)*h|0,y=x+(O-x)*h|0,m=D+(R-D)*h|0,T=b+(F-b)*h|0,P=C+(N-C)*h|0,S=B+(U-B)*h|0,_=c+(d-c)*u|0,a=g+(y-g)*u|0,l=m+(T-m)*u|0,$=P+(S-P)*u|0,p=_+(a-_)*v|0,f=l+($-l)*v|0;return p+(f-p)*G|0}for(var Y=1<=G._$T7?(this.clipID=t._$nP(),this.clipIDList=this.convertClipIDForV2_11(this.clipID)):this.clipIDList=[],this._$MS(this._$Lb)},M.prototype.getClipIDList=function(){return this.clipIDList},M.prototype.init=function(t){},M.prototype._$Nr=function(t,i){if(i._$IS[0]=!1,i._$Us=v._$Z2(t,this._$GS,i._$IS,this._$Lb),at._$Zs);else if(i._$IS[0])return;i._$7s=v._$br(t,this._$GS,i._$IS,this._$mS)},M.prototype._$2b=function(t,i){},M.prototype.getDrawDataID=function(){return this._$gP},M.prototype._$j2=function(t){this._$gP=t},M.prototype.getOpacity=function(t,i){return i._$7s},M.prototype._$zS=function(t,i){return i._$Us},M.prototype._$MS=function(t){for(var i=t.length-1;i>=0;--i){var e=t[i];eM._$R2&&(M._$R2=e)}},M.prototype.getTargetBaseDataID=function(){return this._$dr},M.prototype._$gs=function(t){this._$dr=t},M.prototype._$32=function(){return null!=this._$dr&&this._$dr!=yt._$2o()},M.prototype.preDraw=function(t,i,e){},M.prototype.draw=function(t,i,e){},M.prototype.getType=function(){},M.prototype._$B2=function(t,i,e){},E._$ps=32,E.CLIPPING_PROCESS_NONE=0,E.CLIPPING_PROCESS_OVERWRITE_ALPHA=1,E.CLIPPING_PROCESS_MULTIPLY_ALPHA=2,E.CLIPPING_PROCESS_DRAW=3,E.CLIPPING_PROCESS_CLEAR_ALPHA=4,E.prototype.setChannelFlagAsColor=function(t,i){this.CHANNEL_COLORS[t]=i},E.prototype.getChannelFlagAsColor=function(t){return this.CHANNEL_COLORS[t]},E.prototype._$ZT=function(){},E.prototype._$Uo=function(t,i,e,r,o,n,s){},E.prototype._$Rs=function(){return-1},E.prototype._$Ds=function(t){},E.prototype.setBaseColor=function(t,i,e,r){t<0?t=0:t>1&&(t=1),i<0?i=0:i>1&&(i=1),e<0?e=0:e>1&&(e=1),r<0?r=0:r>1&&(r=1),this._$lT=t,this._$C0=i,this._$tT=e,this._$WL=r},E.prototype._$WP=function(t){this.culling=t},E.prototype.setMatrix=function(t){for(var i=0;i<16;i++)this.matrix4x4[i]=t[i]},E.prototype._$IT=function(){return this.matrix4x4},E.prototype.setPremultipliedAlpha=function(t){this.premultipliedAlpha=t},E.prototype.isPremultipliedAlpha=function(){return this.premultipliedAlpha},E.prototype.setAnisotropy=function(t){this.anisotropy=t},E.prototype.getAnisotropy=function(){return this.anisotropy},E.prototype.getClippingProcess=function(){return this.clippingProcess},E.prototype.setClippingProcess=function(t){this.clippingProcess=t},E.prototype.setClipBufPre_clipContextForMask=function(t){this.clipBufPre_clipContextMask=t},E.prototype.getClipBufPre_clipContextMask=function(){return this.clipBufPre_clipContextMask},E.prototype.setClipBufPre_clipContextForDraw=function(t){this.clipBufPre_clipContextDraw=t},E.prototype.getClipBufPre_clipContextDraw=function(){return this.clipBufPre_clipContextDraw},I._$ur=-2,I._$c2=1,I._$_b=2,I.prototype._$F0=function(t){this._$kP=t._$nP(),this._$dr=t._$nP()},I.prototype.readV2_opacity=function(t){t.getFormatVersion()>=G.LIVE2D_FORMAT_VERSION_V2_10_SDK2&&(this._$mS=t._$Tb())},I.prototype.init=function(t){},I.prototype._$Nr=function(t,i){},I.prototype.interpolateOpacity=function(t,i,e,r){null==this._$mS?e.setInterpolatedOpacity(1):e.setInterpolatedOpacity(v._$br(t,i,r,this._$mS))},I.prototype._$2b=function(t,i){},I.prototype._$nb=function(t,i,e,r,o,n,s){},I.prototype.getType=function(){},I.prototype._$gs=function(t){this._$dr=t},I.prototype._$a2=function(t){this._$kP=t},I.prototype.getTargetBaseDataID=function(){return this._$dr},I.prototype.getBaseDataID=function(){return this._$kP},I.prototype._$32=function(){return null!=this._$dr&&this._$dr!=yt._$2o()},w._$W2=0,w._$CS=w._$W2,w._$Mo=function(){return!0},w._$XP=function(t){try{for(var i=getTimeMSec();getTimeMSec()-i=t.length)return!1;for(var o=i;o=0;--e){var r=this._$Ob[e].getParamIndex(i);if(r==x._$ds&&(r=t.getParamIndex(this._$Ob[e].getParamID())),t._$Xb(r))return!0}return!1},D.prototype._$Q2=function(t,i){for(var e,r,o=this._$Ob.length,n=t._$v2(),s=0,_=0;_U._$Qb&&console.log("err 23245\n");for(var o=this._$Ob.length,n=1,s=1,_=0,a=0;a=0;--n)e[n]=o[n]}else this.mult_fast(t,i,e,r)},R.prototype.mult_fast=function(t,i,e,r){r?(e[0]=t[0]*i[0]+t[4]*i[1]+t[8]*i[2],e[4]=t[0]*i[4]+t[4]*i[5]+t[8]*i[6],e[8]=t[0]*i[8]+t[4]*i[9]+t[8]*i[10],e[12]=t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12],e[1]=t[1]*i[0]+t[5]*i[1]+t[9]*i[2],e[5]=t[1]*i[4]+t[5]*i[5]+t[9]*i[6],e[9]=t[1]*i[8]+t[5]*i[9]+t[9]*i[10],e[13]=t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13],e[2]=t[2]*i[0]+t[6]*i[1]+t[10]*i[2],e[6]=t[2]*i[4]+t[6]*i[5]+t[10]*i[6],e[10]=t[2]*i[8]+t[6]*i[9]+t[10]*i[10],e[14]=t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14],e[3]=e[7]=e[11]=0,e[15]=1):(e[0]=t[0]*i[0]+t[4]*i[1]+t[8]*i[2]+t[12]*i[3],e[4]=t[0]*i[4]+t[4]*i[5]+t[8]*i[6]+t[12]*i[7],e[8]=t[0]*i[8]+t[4]*i[9]+t[8]*i[10]+t[12]*i[11],e[12]=t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12]*i[15],e[1]=t[1]*i[0]+t[5]*i[1]+t[9]*i[2]+t[13]*i[3],e[5]=t[1]*i[4]+t[5]*i[5]+t[9]*i[6]+t[13]*i[7],e[9]=t[1]*i[8]+t[5]*i[9]+t[9]*i[10]+t[13]*i[11],e[13]=t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13]*i[15],e[2]=t[2]*i[0]+t[6]*i[1]+t[10]*i[2]+t[14]*i[3], +e[6]=t[2]*i[4]+t[6]*i[5]+t[10]*i[6]+t[14]*i[7],e[10]=t[2]*i[8]+t[6]*i[9]+t[10]*i[10]+t[14]*i[11],e[14]=t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14]*i[15],e[3]=t[3]*i[0]+t[7]*i[1]+t[11]*i[2]+t[15]*i[3],e[7]=t[3]*i[4]+t[7]*i[5]+t[11]*i[6]+t[15]*i[7],e[11]=t[3]*i[8]+t[7]*i[9]+t[11]*i[10]+t[15]*i[11],e[15]=t[3]*i[12]+t[7]*i[13]+t[11]*i[14]+t[15]*i[15])},R.prototype.translate=function(t,i,e){this.m[12]=this.m[0]*t+this.m[4]*i+this.m[8]*e+this.m[12],this.m[13]=this.m[1]*t+this.m[5]*i+this.m[9]*e+this.m[13],this.m[14]=this.m[2]*t+this.m[6]*i+this.m[10]*e+this.m[14],this.m[15]=this.m[3]*t+this.m[7]*i+this.m[11]*e+this.m[15]},R.prototype.scale=function(t,i,e){this.m[0]*=t,this.m[4]*=i,this.m[8]*=e,this.m[1]*=t,this.m[5]*=i,this.m[9]*=e,this.m[2]*=t,this.m[6]*=i,this.m[10]*=e,this.m[3]*=t,this.m[7]*=i,this.m[11]*=e},R.prototype.rotateX=function(t){var i=Lt.fcos(t),e=Lt._$9(t),r=this.m[4];this.m[4]=r*i+this.m[8]*e,this.m[8]=r*-e+this.m[8]*i,r=this.m[5],this.m[5]=r*i+this.m[9]*e,this.m[9]=r*-e+this.m[9]*i,r=this.m[6],this.m[6]=r*i+this.m[10]*e,this.m[10]=r*-e+this.m[10]*i,r=this.m[7],this.m[7]=r*i+this.m[11]*e,this.m[11]=r*-e+this.m[11]*i},R.prototype.rotateY=function(t){var i=Lt.fcos(t),e=Lt._$9(t),r=this.m[0];this.m[0]=r*i+this.m[8]*-e,this.m[8]=r*e+this.m[8]*i,r=this.m[1],this.m[1]=r*i+this.m[9]*-e,this.m[9]=r*e+this.m[9]*i,r=m[2],this.m[2]=r*i+this.m[10]*-e,this.m[10]=r*e+this.m[10]*i,r=m[3],this.m[3]=r*i+this.m[11]*-e,this.m[11]=r*e+this.m[11]*i},R.prototype.rotateZ=function(t){var i=Lt.fcos(t),e=Lt._$9(t),r=this.m[0];this.m[0]=r*i+this.m[4]*e,this.m[4]=r*-e+this.m[4]*i,r=this.m[1],this.m[1]=r*i+this.m[5]*e,this.m[5]=r*-e+this.m[5]*i,r=this.m[2],this.m[2]=r*i+this.m[6]*e,this.m[6]=r*-e+this.m[6]*i,r=this.m[3],this.m[3]=r*i+this.m[7]*e,this.m[7]=r*-e+this.m[7]*i},b.prototype=new et,b._$tP=new Object,b._$27=function(){b._$tP.clear()},b.getID=function(t){var i=b._$tP[t];return null==i&&(i=new b(t),b._$tP[t]=i),i},b.prototype._$3s=function(){return new b},F._$kS=-1,F._$pS=0,F._$hb=1,F.STATE_IDENTITY=0,F._$gb=1,F._$fo=2,F._$go=4,F.prototype.transform=function(t,i,e){var r,o,n,s,_,a,h=0,l=0;switch(this._$hi){default:return;case F._$go|F._$fo|F._$gb:for(r=this._$7,o=this._$H,n=this._$k,s=this._$f,_=this._$g,a=this._$w;--e>=0;){var $=t[h++],u=t[h++];i[l++]=r*$+o*u+n,i[l++]=s*$+_*u+a}return;case F._$go|F._$fo:for(r=this._$7,o=this._$H,s=this._$f,_=this._$g;--e>=0;){var $=t[h++],u=t[h++];i[l++]=r*$+o*u,i[l++]=s*$+_*u}return;case F._$go|F._$gb:for(o=this._$H,n=this._$k,s=this._$f,a=this._$w;--e>=0;){var $=t[h++];i[l++]=o*t[h++]+n,i[l++]=s*$+a}return;case F._$go:for(o=this._$H,s=this._$f;--e>=0;){var $=t[h++];i[l++]=o*t[h++],i[l++]=s*$}return;case F._$fo|F._$gb:for(r=this._$7,n=this._$k,_=this._$g,a=this._$w;--e>=0;)i[l++]=r*t[h++]+n,i[l++]=_*t[h++]+a;return;case F._$fo:for(r=this._$7,_=this._$g;--e>=0;)i[l++]=r*t[h++],i[l++]=_*t[h++];return;case F._$gb:for(n=this._$k,a=this._$w;--e>=0;)i[l++]=t[h++]+n,i[l++]=t[h++]+a;return;case F.STATE_IDENTITY:return void(t==i&&h==l||w._$jT(t,h,i,l,2*e))}},F.prototype.update=function(){0==this._$H&&0==this._$f?1==this._$7&&1==this._$g?0==this._$k&&0==this._$w?(this._$hi=F.STATE_IDENTITY,this._$Z=F._$pS):(this._$hi=F._$gb,this._$Z=F._$hb):0==this._$k&&0==this._$w?(this._$hi=F._$fo,this._$Z=F._$kS):(this._$hi=F._$fo|F._$gb,this._$Z=F._$kS):0==this._$7&&0==this._$g?0==this._$k&&0==this._$w?(this._$hi=F._$go,this._$Z=F._$kS):(this._$hi=F._$go|F._$gb,this._$Z=F._$kS):0==this._$k&&0==this._$w?(this._$hi=F._$go|F._$fo,this._$Z=F._$kS):(this._$hi=F._$go|F._$fo|F._$gb,this._$Z=F._$kS)},F.prototype._$RT=function(t){this._$IT(t);var i=t[0],e=t[2],r=t[1],o=t[3],n=Math.sqrt(i*i+r*r),s=i*o-e*r;0==n?at._$so&&console.log("affine._$RT() / rt==0"):(t[0]=n,t[1]=s/n,t[2]=(r*o+i*e)/s,t[3]=Math.atan2(r,i))},F.prototype._$ho=function(t,i,e,r){var o=new Float32Array(6),n=new Float32Array(6);t._$RT(o),i._$RT(n);var s=new Float32Array(6);s[0]=o[0]+(n[0]-o[0])*e,s[1]=o[1]+(n[1]-o[1])*e,s[2]=o[2]+(n[2]-o[2])*e,s[3]=o[3]+(n[3]-o[3])*e,s[4]=o[4]+(n[4]-o[4])*e,s[5]=o[5]+(n[5]-o[5])*e,r._$CT(s)},F.prototype._$CT=function(t){var i=Math.cos(t[3]),e=Math.sin(t[3]);this._$7=t[0]*i,this._$f=t[0]*e,this._$H=t[1]*(t[2]*i-e),this._$g=t[1]*(t[2]*e+i),this._$k=t[4],this._$w=t[5],this.update()},F.prototype._$IT=function(t){t[0]=this._$7,t[1]=this._$f,t[2]=this._$H,t[3]=this._$g,t[4]=this._$k,t[5]=this._$w},C.prototype=new s,C._$cs="VISIBLE:",C._$ar="LAYOUT:",C._$Co=0,C._$D2=[],C._$1T=1,C.loadMotion=function(t){var i=new C,e=[0],r=t.length;i._$yT=0;for(var o=0;o=0){var a=new B;O.startsWith(t,s,C._$cs)?(a._$RP=B._$hs,a._$4P=new String(t,s,_-s)):O.startsWith(t,s,C._$ar)?(a._$4P=new String(t,s+7,_-s-7),O.startsWith(t,s+7,"ANCHOR_X")?a._$RP=B._$xs:O.startsWith(t,s+7,"ANCHOR_Y")?a._$RP=B._$us:O.startsWith(t,s+7,"SCALE_X")?a._$RP=B._$qs:O.startsWith(t,s+7,"SCALE_Y")?a._$RP=B._$Ys:O.startsWith(t,s+7,"X")?a._$RP=B._$ws:O.startsWith(t,s+7,"Y")&&(a._$RP=B._$Ns)):(a._$RP=B._$Fr,a._$4P=new String(t,s,_-s)),i.motions.push(a);var h=0;for(C._$D2.clear(),o=_+1;o0){C._$D2.push(l),h++;var $=e[0];if($i._$yT&&(i._$yT=h)}}}else{for(var s=o,_=-1;o=0)for(_==s+4&&"f"==t[s+1]&&"p"==t[s+2]&&"s"==t[s+3]&&(u=!0),o=_+1;o0&&u&&5=l?l-1:s];t.setParamFloat($,u)}else if(B._$ws<=h._$RP&&h._$RP<=B._$Ys);else{var p=t.getParamFloat($),f=h._$I0[s>=l?l-1:s],c=h._$I0[s+1>=l?l-1:s+1],d=f+(c-f)*_,g=p+(d-p)*e;t.setParamFloat($,g)}}s>=this._$yT&&(this._$E?(r._$z2=i,this.loopFadeIn&&(r._$bs=i)):r._$9L=!0)},C.prototype._$r0=function(){return this._$E},C.prototype._$aL=function(t){this._$E=t},C.prototype.isLoopFadeIn=function(){return this.loopFadeIn},C.prototype.setLoopFadeIn=function(t){this.loopFadeIn=t},N.prototype.clear=function(){this.size=0},N.prototype.add=function(t){if(this._$P.length<=this.size){var i=new Float32Array(2*this.size);w._$jT(this._$P,0,i,0,this.size),this._$P=i}this._$P[this.size++]=t},N.prototype._$BL=function(){var t=new Float32Array(this.size);return w._$jT(this._$P,0,t,0,this.size),t},B._$Fr=0,B._$hs=1,B._$ws=100,B._$Ns=101,B._$xs=102,B._$us=103,B._$qs=104,B._$Ys=105,U._$Ms=1,U._$Qs=2,U._$i2=0,U._$No=2,U._$do=U._$Ms,U._$Ls=!0,U._$1r=5,U._$Qb=65,U._$J=1e-4,U._$FT=.001,U._$Ss=3,G._$o7=6,G._$S7=7,G._$s7=8,G._$77=9,G.LIVE2D_FORMAT_VERSION_V2_10_SDK2=10,G.LIVE2D_FORMAT_VERSION_V2_11_SDK2_1=11,G._$T7=G.LIVE2D_FORMAT_VERSION_V2_11_SDK2_1,G._$Is=-2004318072,G._$h0=0,G._$4L=23,G._$7P=33,G._$uT=function(t){console.log("_$bo :: _$6 _$mo _$E0 : %d\n",t)},G._$9o=function(t){if(t<40)return G._$uT(t),null;if(t<50)return G._$uT(t),null;if(t<60)return G._$uT(t),null;if(t<100)switch(t){case 65:return new Z;case 66:return new D;case 67:return new x;case 68:return new z;case 69:return new P;case 70:return new $t;default:return G._$uT(t),null}else if(t<150)switch(t){case 131:return new st;case 133:return new tt;case 136:return new p;case 137:return new ot;case 142:return new j}return G._$uT(t),null},Y._$HP=0,Y._$_0=!0;Y._$V2=-1,Y._$W0=-1,Y._$jr=!1,Y._$ZS=!0,Y._$tr=-1e6,Y._$lr=1e6,Y._$is=32,Y._$e=!1,Y.prototype.getDrawDataIndex=function(t){for(var i=this._$aS.length-1;i>=0;--i)if(null!=this._$aS[i]&&this._$aS[i].getDrawDataID()==t)return i;return-1},Y.prototype.getDrawData=function(t){if(t instanceof b){if(null==this._$Bo){this._$Bo=new Object;for(var i=this._$aS.length,e=0;e0&&this.release();for(var t=this._$Ri.getModelImpl(),i=t._$Xr(),r=i.length,o=new Array,n=new Array,s=0;s=0)&&(this._$3S.push(m),this._$db.push(n[s]),o[s]=null,y=!0)}}if(!y)break}var P=t._$E2();if(null!=P){var S=P._$1s();if(null!=S)for(var v=S.length,s=0;s=0;i--)this._$Js[i]=Y._$jr;return this._$QT=!1,Y._$e&&_.dump("_$eL"),!1},Y.prototype.preDraw=function(t){null!=this.clipManager&&(t._$ZT(),this.clipManager.setupClip(this,t))},Y.prototype.draw=function(t){if(null==this._$Ws)return void _._$li("call _$Ri.update() before _$Ri.draw() ");var i=this._$Ws.length;t._$ZT();for(var e=0;e=0;--i)if(this._$pb[i]==t)return i;return this._$02(t,0,Y._$tr,Y._$lr)},Y.prototype._$BS=function(t){return this.getBaseDataIndex(t)},Y.prototype.getBaseDataIndex=function(t){for(var i=this._$3S.length-1;i>=0;--i)if(null!=this._$3S[i]&&this._$3S[i].getBaseDataID()==t)return i;return-1},Y.prototype._$UT=function(t,i){var e=new Float32Array(i);return w._$jT(t,0,e,0,t.length),e},Y.prototype._$02=function(t,i,e,r){if(this._$qo>=this._$pb.length){var o=this._$pb.length,n=new Array(2*o);w._$jT(this._$pb,0,n,0,o),this._$pb=n,this._$_2=this._$UT(this._$_2,2*o),this._$vr=this._$UT(this._$vr,2*o),this._$Rr=this._$UT(this._$Rr,2*o),this._$Or=this._$UT(this._$Or,2*o);var s=new Array;w._$jT(this._$Js,0,s,0,o),this._$Js=s}return this._$pb[this._$qo]=t,this._$_2[this._$qo]=i,this._$vr[this._$qo]=i,this._$Rr[this._$qo]=e,this._$Or[this._$qo]=r,this._$Js[this._$qo]=Y._$ZS,this._$qo++},Y.prototype._$Zo=function(t,i){this._$3S[t]=i},Y.prototype.setParamFloat=function(t,i){ithis._$Or[t]&&(i=this._$Or[t]),this._$_2[t]=i},Y.prototype.loadParam=function(){var t=this._$_2.length;t>this._$fs.length&&(t=this._$fs.length),w._$jT(this._$fs,0,this._$_2,0,t)},Y.prototype.saveParam=function(){var t=this._$_2.length;t>this._$fs.length&&(this._$fs=new Float32Array(t)),w._$jT(this._$_2,0,this._$fs,0,t)},Y.prototype._$v2=function(){return this._$co},Y.prototype._$WS=function(){return this._$QT},Y.prototype._$Xb=function(t){return this._$Js[t]==Y._$ZS},Y.prototype._$vs=function(){return this._$Es},Y.prototype._$Tr=function(){return this._$ZP},Y.prototype.getBaseData=function(t){return this._$3S[t]},Y.prototype.getParamFloat=function(t){return this._$_2[t]},Y.prototype.getParamMax=function(t){return this._$Or[t]},Y.prototype.getParamMin=function(t){return this._$Rr[t]},Y.prototype.setPartsOpacity=function(t,i){this._$Hr[t].setPartsOpacity(i)},Y.prototype.getPartsOpacity=function(t){return this._$Hr[t].getPartsOpacity()},Y.prototype.getPartsDataIndex=function(t){for(var i=this._$F2.length-1;i>=0;--i)if(null!=this._$F2[i]&&this._$F2[i]._$p2()==t)return i;return-1},Y.prototype._$q2=function(t){return this._$db[t]},Y.prototype._$C2=function(t){return this._$8b[t]},Y.prototype._$Bb=function(t){return this._$Hr[t]},Y.prototype._$5s=function(t,i){for(var e=this._$Ws.length,r=t,o=0;o0;)n+=i;return r},k._$C=function(t){var i=null,e=null;try{i=t instanceof Array?t:new _$Xs(t,8192),e=new _$js;for(var r,o=new Int8Array(1e3);(r=i.read(o))>0;)e.write(o,0,r);return e._$TS()}finally{null!=t&&t.close(),null!=e&&(e.flush(),e.close())}},V.prototype._$T2=function(){return w.getUserTimeMSec()+Math._$10()*(2*this._$Br-1)},V.prototype._$uo=function(t){this._$Br=t},V.prototype._$QS=function(t,i,e){this._$Dr=t,this._$Cb=i,this._$mr=e},V.prototype._$7T=function(t){var i,e=w.getUserTimeMSec(),r=0;switch(this._$_L){case STATE_CLOSING:r=(e-this._$bb)/this._$Dr,r>=1&&(r=1,this._$_L=wt.STATE_CLOSED,this._$bb=e),i=1-r;break;case STATE_CLOSED:r=(e-this._$bb)/this._$Cb,r>=1&&(this._$_L=wt.STATE_OPENING,this._$bb=e),i=0;break;case STATE_OPENING:r=(e-this._$bb)/this._$mr,r>=1&&(r=1,this._$_L=wt.STATE_INTERVAL,this._$12=this._$T2()),i=r;break;case STATE_INTERVAL:this._$12.9?at.EXPAND_W:0;this.gl.drawElements(a,e,r,o,n,h,this.transform,_)}},X.prototype._$Rs=function(){throw new Error("_$Rs")},X.prototype._$Ds=function(t){throw new Error("_$Ds")},X.prototype._$K2=function(){for(var t=0;t=0;--i){var e=t[i];eW._$R2&&(W._$R2=e)}},W._$or=function(){return W._$52},W._$Pr=function(){return W._$R2},W.prototype._$F0=function(t){this._$gP=t._$nP(),this._$dr=t._$nP(),this._$GS=t._$nP(),this._$qb=t._$6L(),this._$Lb=t._$cS(),this._$mS=t._$Tb(),t.getFormatVersion()>=G._$T7?(this.clipID=t._$nP(),this.clipIDList=this.convertClipIDForV2_11(this.clipID)):this.clipIDList=null,W._$Sb(this._$Lb)},W.prototype.getClipIDList=function(){return this.clipIDList},W.prototype._$Nr=function(t,i){if(i._$IS[0]=!1,i._$Us=v._$Z2(t,this._$GS,i._$IS,this._$Lb),at._$Zs);else if(i._$IS[0])return;i._$7s=v._$br(t,this._$GS,i._$IS,this._$mS)},W.prototype._$2b=function(t){},W.prototype.getDrawDataID=function(){return this._$gP},W.prototype._$j2=function(t){this._$gP=t},W.prototype.getOpacity=function(t,i){return i._$7s},W.prototype._$zS=function(t,i){return i._$Us},W.prototype.getTargetBaseDataID=function(){return this._$dr},W.prototype._$gs=function(t){this._$dr=t},W.prototype._$32=function(){return null!=this._$dr&&this._$dr!=yt._$2o()},W.prototype.getType=function(){},j._$42=0,j.prototype._$1b=function(){return this._$3S},j.prototype.getDrawDataList=function(){return this._$aS},j.prototype._$F0=function(t){this._$NL=t._$nP(),this._$aS=t._$nP(),this._$3S=t._$nP()},j.prototype._$kr=function(t){t._$Zo(this._$3S),t._$xo(this._$aS),this._$3S=null,this._$aS=null},q.prototype=new i,q.loadModel=function(t){var e=new q;return i._$62(e,t),e},q.loadModel=function(t){var e=new q;return i._$62(e,t),e},q._$to=function(){return new q},q._$er=function(t){var i=new _$5("../_$_r/_$t0/_$Ri/_$_P._$d");if(0==i.exists())throw new _$ls("_$t0 _$_ _$6 _$Ui :: "+i._$PL());for(var e=["../_$_r/_$t0/_$Ri/_$_P.512/_$CP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$vP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$EP._$1","../_$_r/_$t0/_$Ri/_$_P.512/_$pP._$1"],r=q.loadModel(i._$3b()),o=0;o=0){var h=new B;O.startsWith(t,_,J._$cs)?(h._$RP=B._$hs,h._$4P=O.createString(t,_,a-_)):O.startsWith(t,_,J._$ar)?(h._$4P=O.createString(t,_+7,a-_-7),O.startsWith(t,_+7,"ANCHOR_X")?h._$RP=B._$xs:O.startsWith(t,_+7,"ANCHOR_Y")?h._$RP=B._$us:O.startsWith(t,_+7,"SCALE_X")?h._$RP=B._$qs:O.startsWith(t,_+7,"SCALE_Y")?h._$RP=B._$Ys:O.startsWith(t,_+7,"X")?h._$RP=B._$ws:O.startsWith(t,_+7,"Y")&&(h._$RP=B._$Ns)):(h._$RP=B._$Fr,h._$4P=O.createString(t,_,a-_)),i.motions.push(h);var l=0,$=[];for(o=a+1;o0){$.push(u),l++;var p=e[0];if(pi._$yT&&(i._$yT=l)}}}else{for(var _=o,a=-1;o=0)for(a==_+4&&"f"==Q(t,_+1)&&"p"==Q(t,_+2)&&"s"==Q(t,_+3)&&(f=!0),o=a+1;o0&&f&&5=l?l-1:s];t.setParamFloat($,u)}else if(B._$ws<=h._$RP&&h._$RP<=B._$Ys);else{var p,f=t.getParamIndex($),c=t.getModelContext(),d=c.getParamMax(f),g=c.getParamMin(f),y=.4*(d-g),m=c.getParamFloat(f),T=h._$I0[s>=l?l-1:s],P=h._$I0[s+1>=l?l-1:s+1];p=Ty||T>P&&T-P>y?T:T+(P-T)*_;var S=m+(p-m)*e;t.setParamFloat($,S)}}s>=this._$yT&&(this._$E?(r._$z2=i,this.loopFadeIn&&(r._$bs=i)):r._$9L=!0),this._$eP=e},J.prototype._$r0=function(){return this._$E},J.prototype._$aL=function(t){this._$E=t},J.prototype._$S0=function(){return this._$D0},J.prototype._$U0=function(t){this._$D0=t},J.prototype.isLoopFadeIn=function(){return this.loopFadeIn},J.prototype.setLoopFadeIn=function(t){this.loopFadeIn=t},N.prototype.clear=function(){this.size=0},N.prototype.add=function(t){if(this._$P.length<=this.size){var i=new Float32Array(2*this.size);w._$jT(this._$P,0,i,0,this.size),this._$P=i}this._$P[this.size++]=t},N.prototype._$BL=function(){var t=new Float32Array(this.size);return w._$jT(this._$P,0,t,0,this.size),t},B._$Fr=0,B._$hs=1,B._$ws=100,B._$Ns=101,B._$xs=102,B._$us=103,B._$qs=104,B._$Ys=105,Z.prototype=new I,Z._$gT=new Array,Z.prototype._$zP=function(){this._$GS=new D,this._$GS._$zP()},Z.prototype._$F0=function(t){I.prototype._$F0.call(this,t),this._$A=t._$6L(),this._$o=t._$6L(),this._$GS=t._$nP(),this._$Eo=t._$nP(),I.prototype.readV2_opacity.call(this,t)},Z.prototype.init=function(t){var i=new K(this),e=(this._$o+1)*(this._$A+1);return null!=i._$Cr&&(i._$Cr=null),i._$Cr=new Float32Array(2*e),null!=i._$hr&&(i._$hr=null),this._$32()?i._$hr=new Float32Array(2*e):i._$hr=null,i},Z.prototype._$Nr=function(t,i){var e=i;if(this._$GS._$Ur(t)){var r=this._$VT(),o=Z._$gT;o[0]=!1,v._$Vr(t,this._$GS,o,r,this._$Eo,e._$Cr,0,2),i._$Ib(o[0]),this.interpolateOpacity(t,this._$GS,i,o)}},Z.prototype._$2b=function(t,i){var e=i;if(e._$hS(!0),this._$32()){var r=this.getTargetBaseDataID();if(e._$8r==I._$ur&&(e._$8r=t.getBaseDataIndex(r)),e._$8r<0)at._$so&&_._$li("_$L _$0P _$G :: %s",r),e._$hS(!1);else{var o=t.getBaseData(e._$8r),n=t._$q2(e._$8r);if(null!=o&&n._$yo()){var s=n.getTotalScale();e.setTotalScale_notForClient(s);var a=n.getTotalOpacity();e.setTotalOpacity(a*e.getInterpolatedOpacity()),o._$nb(t,n,e._$Cr,e._$hr,this._$VT(),0,2),e._$hS(!0)}else e._$hS(!1)}}else e.setTotalOpacity(e.getInterpolatedOpacity())},Z.prototype._$nb=function(t,i,e,r,o,n,s){var _=i,a=null!=_._$hr?_._$hr:_._$Cr;Z.transformPoints_sdk2(e,r,o,n,s,a,this._$o,this._$A)},Z.transformPoints_sdk2=function(i,e,r,o,n,s,_,a){for(var h,l,$,u=r*n,p=0,f=0,c=0,d=0,g=0,y=0,m=!1,T=o;T=1){var b=s[2*(0+a*M)],F=s[2*(0+a*M)+1],C=p-2*c+1*g,N=f-2*d+1*y,x=p+3*g,O=f+3*y,D=p-2*c+3*g,R=f-2*d+3*y,B=.5*(v- -2),U=.5*(L-1);B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else{var G=0|S;G==a&&(G=a-1);var B=.5*(v- -2),U=S-G,Y=G/a,k=(G+1)/a,b=s[2*(0+G*M)],F=s[2*(0+G*M)+1],x=s[2*(0+(G+1)*M)],O=s[2*(0+(G+1)*M)+1],C=p-2*c+Y*g,N=f-2*d+Y*y,D=p-2*c+k*g,R=f-2*d+k*y;B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else if(1<=v)if(L<=0){var D=s[2*(_+0*M)],R=s[2*(_+0*M)+1],x=p+3*c,O=f+3*d,C=p+1*c-2*g,N=f+1*d-2*y,b=p+3*c-2*g,F=f+3*d-2*y,B=.5*(v-1),U=.5*(L- -2);B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else if(L>=1){var C=s[2*(_+a*M)],N=s[2*(_+a*M)+1],b=p+3*c+1*g,F=f+3*d+1*y,D=p+1*c+3*g,R=f+1*d+3*y,x=p+3*c+3*g,O=f+3*d+3*y,B=.5*(v-1),U=.5*(L-1);B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else{var G=0|S;G==a&&(G=a-1);var B=.5*(v-1),U=S-G,Y=G/a,k=(G+1)/a,C=s[2*(_+G*M)],N=s[2*(_+G*M)+1],D=s[2*(_+(G+1)*M)],R=s[2*(_+(G+1)*M)+1],b=p+3*c+Y*g,F=f+3*d+Y*y,x=p+3*c+k*g,O=f+3*d+k*y;B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else if(L<=0){var V=0|P;V==_&&(V=_-1);var B=P-V,U=.5*(L- -2),X=V/_,z=(V+1)/_,D=s[2*(V+0*M)],R=s[2*(V+0*M)+1],x=s[2*(V+1+0*M)],O=s[2*(V+1+0*M)+1],C=p+X*c-2*g,N=f+X*d-2*y,b=p+z*c-2*g,F=f+z*d-2*y;B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else if(L>=1){var V=0|P;V==_&&(V=_-1);var B=P-V,U=.5*(L-1),X=V/_,z=(V+1)/_,C=s[2*(V+a*M)],N=s[2*(V+a*M)+1],b=s[2*(V+1+a*M)],F=s[2*(V+1+a*M)+1],D=p+X*c+3*g,R=f+X*d+3*y,x=p+z*c+3*g,O=f+z*d+3*y;B+U<=1?(e[T]=C+(b-C)*B+(D-C)*U,e[T+1]=N+(F-N)*B+(R-N)*U):(e[T]=x+(D-x)*(1-B)+(b-x)*(1-U),e[T+1]=O+(R-O)*(1-B)+(F-O)*(1-U))}else t.err.printf("_$li calc : %.4f , %.4f\t\t\t\t\t@@BDBoxGrid\n",v,L);else e[T]=p+v*c+L*g,e[T+1]=f+v*d+L*y}else l=P-(0|P),$=S-(0|S),h=2*((0|P)+(0|S)*(_+1)),l+$<1?(e[T]=s[h]*(1-l-$)+s[h+2]*l+s[h+2*(_+1)]*$,e[T+1]=s[h+1]*(1-l-$)+s[h+3]*l+s[h+2*(_+1)+1]*$):(e[T]=s[h+2*(_+1)+2]*(l-1+$)+s[h+2*(_+1)]*(1-l)+s[h+2]*(1-$),e[T+1]=s[h+2*(_+1)+3]*(l-1+$)+s[h+2*(_+1)+1]*(1-l)+s[h+3]*(1-$))}},Z.prototype.transformPoints_sdk1=function(t,i,e,r,o,n,s){for(var _,a,h,l,$,u,p,f=i,c=this._$o,d=this._$A,g=o*s,y=null!=f._$hr?f._$hr:f._$Cr,m=n;m1&&(_=1),a<0?a=0:a>1&&(a=1),_*=c,a*=d,h=0|_,l=0|a,h>c-1&&(h=c-1),l>d-1&&(l=d-1),u=_-h,p=a-l,$=2*(h+l*(c+1))):(_=e[m]*c,a=e[m+1]*d,u=_-(0|_),p=a-(0|a),$=2*((0|_)+(0|a)*(c+1))),u+p<1?(r[m]=y[$]*(1-u-p)+y[$+2]*u+y[$+2*(c+1)]*p,r[m+1]=y[$+1]*(1-u-p)+y[$+3]*u+y[$+2*(c+1)+1]*p):(r[m]=y[$+2*(c+1)+2]*(u-1+p)+y[$+2*(c+1)]*(1-u)+y[$+2]*(1-p),r[m+1]=y[$+2*(c+1)+3]*(u-1+p)+y[$+2*(c+1)+1]*(1-u)+y[$+3]*(1-p))},Z.prototype._$VT=function(){return(this._$o+1)*(this._$A+1)},Z.prototype.getType=function(){return I._$_b},K.prototype=new _t,tt._$42=0,tt.prototype._$zP=function(){this._$3S=new Array,this._$aS=new Array},tt.prototype._$F0=function(t){this._$g0=t._$8L(),this.visible=t._$8L(),this._$NL=t._$nP(),this._$3S=t._$nP(),this._$aS=t._$nP()},tt.prototype.init=function(t){var i=new it(this);return i.setPartsOpacity(this.isVisible()?1:0),i},tt.prototype._$6o=function(t){if(null==this._$3S)throw new Error("_$3S _$6 _$Wo@_$6o");this._$3S.push(t)},tt.prototype._$3o=function(t){if(null==this._$aS)throw new Error("_$aS _$6 _$Wo@_$3o");this._$aS.push(t)},tt.prototype._$Zo=function(t){this._$3S=t},tt.prototype._$xo=function(t){this._$aS=t},tt.prototype.isVisible=function(){return this.visible},tt.prototype._$uL=function(){return this._$g0},tt.prototype._$KP=function(t){this.visible=t},tt.prototype._$ET=function(t){this._$g0=t},tt.prototype.getBaseData=function(){return this._$3S},tt.prototype.getDrawData=function(){return this._$aS},tt.prototype._$p2=function(){return this._$NL},tt.prototype._$ob=function(t){this._$NL=t},tt.prototype.getPartsID=function(){return this._$NL},tt.prototype._$MP=function(t){this._$NL=t},it.prototype=new $,it.prototype.getPartsOpacity=function(){return this._$VS},it.prototype.setPartsOpacity=function(t){this._$VS=t},et._$L7=function(){u._$27(),yt._$27(),b._$27(),l._$27()},et.prototype.toString=function(){return this.id},rt.prototype._$F0=function(t){},ot.prototype._$1s=function(){return this._$4S},ot.prototype._$zP=function(){this._$4S=new Array},ot.prototype._$F0=function(t){this._$4S=t._$nP()},ot.prototype._$Ks=function(t){this._$4S.push(t)},nt.tr=new gt,nt._$50=new gt,nt._$Ti=new Array(0,0),nt._$Pi=new Array(0,0),nt._$B=new Array(0,0),nt.prototype._$lP=function(t,i,e,r){this.viewport=new Array(t,i,e,r)},nt.prototype._$bL=function(){this.context.save();var t=this.viewport;null!=t&&(this.context.beginPath(),this.context._$Li(t[0],t[1],t[2],t[3]),this.context.clip())},nt.prototype._$ei=function(){this.context.restore()},nt.prototype.drawElements=function(t,i,e,r,o,n,s,a){try{o!=this._$Qo&&(this._$Qo=o,this.context.globalAlpha=o);for(var h=i.length,l=t.width,$=t.height,u=this.context,p=this._$xP,f=this._$uP,c=this._$6r,d=this._$3r,g=nt.tr,y=nt._$Ti,m=nt._$Pi,T=nt._$B,P=0;P.02?nt.expandClip(t,i,e,r,l,$,u,p,f,c):nt.clipWithTransform(t,null,o,n,s,_,a,h)},nt.expandClip=function(t,i,e,r,o,n,s,_,a,h){var l=s-o,$=_-n,u=a-o,p=h-n,f=l*p-$*u>0?e:-e,c=-$,d=l,g=a-s,y=h-_,m=-y,T=g,P=Math.sqrt(g*g+y*y),S=-p,v=u,L=Math.sqrt(u*u+p*p),M=o-f*c/r,E=n-f*d/r,A=s-f*c/r,I=_-f*d/r,w=s-f*m/P,x=_-f*T/P,O=a-f*m/P,D=h-f*T/P,R=o+f*S/L,b=n+f*v/L,F=a+f*S/L,C=h+f*v/L,N=nt._$50;return null!=i._$P2(N)&&(nt.clipWithTransform(t,N,M,E,A,I,w,x,O,D,F,C,R,b),!0)},nt.clipWithTransform=function(t,i,e,r,o,n,s,a){if(arguments.length<7)return void _._$li("err : @LDGL.clip()");if(!(arguments[1]instanceof gt))return void _._$li("err : a[0] is _$6 LDTransform @LDGL.clip()");var h=nt._$B,l=i,$=arguments;if(t.beginPath(),l){l._$PS($[2],$[3],h),t.moveTo(h[0],h[1]);for(var u=4;u<$.length;u+=2)l._$PS($[u],$[u+1],h),t.lineTo(h[0],h[1])}else{t.moveTo($[2],$[3]);for(var u=4;u<$.length;u+=2)t.lineTo($[u],$[u+1])}t.clip()},nt.createCanvas=function(t,i){var e=document.createElement("canvas");return e.setAttribute("width",t),e.setAttribute("height",i),e||_._$li("err : "+e),e},nt.dumpValues=function(){for(var t="",i=0;i1?1:.5-.5*Math.cos(t*Lt.PI_F)},lt._$fr=-1,lt.prototype.toString=function(){return this._$ib},$t.prototype=new W,$t._$42=0,$t._$Os=30,$t._$ms=0,$t._$ns=1,$t._$_s=2,$t._$gT=new Array,$t.prototype._$_S=function(t){this._$LP=t},$t.prototype.getTextureNo=function(){return this._$LP},$t.prototype._$ZL=function(){return this._$Qi},$t.prototype._$H2=function(){return this._$JP},$t.prototype.getNumPoints=function(){return this._$d0},$t.prototype.getType=function(){return W._$wb},$t.prototype._$B2=function(t,i,e){var r=i,o=null!=r._$hr?r._$hr:r._$Cr;switch(U._$do){default:case U._$Ms:throw new Error("_$L _$ro ");case U._$Qs:for(var n=this._$d0-1;n>=0;--n)o[n*U._$No+4]=e}},$t.prototype._$zP=function(){this._$GS=new D,this._$GS._$zP()},$t.prototype._$F0=function(t){W.prototype._$F0.call(this,t),this._$LP=t._$6L(),this._$d0=t._$6L(),this._$Yo=t._$6L();var i=t._$nP();this._$BP=new Int16Array(3*this._$Yo);for(var e=3*this._$Yo-1;e>=0;--e)this._$BP[e]=i[e];if(this._$Eo=t._$nP(),this._$Qi=t._$nP(),t.getFormatVersion()>=G._$s7){if(this._$JP=t._$6L(),0!=this._$JP){if(0!=(1&this._$JP)){var r=t._$6L();null==this._$5P&&(this._$5P=new Object),this._$5P._$Hb=parseInt(r)}0!=(this._$JP&$t._$Os)?this._$6s=(this._$JP&$t._$Os)>>1:this._$6s=$t._$ms,0!=(32&this._$JP)&&(this.culling=!1)}}else this._$JP=0},$t.prototype.init=function(t){var i=new ut(this),e=this._$d0*U._$No,r=this._$32();switch(null!=i._$Cr&&(i._$Cr=null),i._$Cr=new Float32Array(e),null!=i._$hr&&(i._$hr=null),i._$hr=r?new Float32Array(e):null,U._$do){default:case U._$Ms:if(U._$Ls)for(var o=this._$d0-1;o>=0;--o){var n=o<<1;this._$Qi[n+1]=1-this._$Qi[n+1]}break;case U._$Qs:for(var o=this._$d0-1;o>=0;--o){var n=o<<1,s=o*U._$No,_=this._$Qi[n],a=this._$Qi[n+1];i._$Cr[s]=_,i._$Cr[s+1]=a,i._$Cr[s+4]=0,r&&(i._$hr[s]=_,i._$hr[s+1]=a,i._$hr[s+4]=0)}}return i},$t.prototype._$Nr=function(t,i){var e=i;if(this!=e._$GT()&&console.log("### assert!! ### "),this._$GS._$Ur(t)&&(W.prototype._$Nr.call(this,t,e),!e._$IS[0])){var r=$t._$gT;r[0]=!1,v._$Vr(t,this._$GS,r,this._$d0,this._$Eo,e._$Cr,U._$i2,U._$No)}},$t.prototype._$2b=function(t,i){try{this!=i._$GT()&&console.log("### assert!! ### ");var e=!1;i._$IS[0]&&(e=!0);var r=i;if(!e&&(W.prototype._$2b.call(this,t),this._$32())){var o=this.getTargetBaseDataID();if(r._$8r==W._$ur&&(r._$8r=t.getBaseDataIndex(o)),r._$8r<0)at._$so&&_._$li("_$L _$0P _$G :: %s",o);else{var n=t.getBaseData(r._$8r),s=t._$q2(r._$8r);null==n||s._$x2()?r._$AT=!1:(n._$nb(t,s,r._$Cr,r._$hr,this._$d0,U._$i2,U._$No),r._$AT=!0),r.baseOpacity=s.getTotalOpacity()}}}catch(t){throw t}},$t.prototype.draw=function(t,i,e){if(this!=e._$GT()&&console.log("### assert!! ### "),!e._$IS[0]){var r=e,o=this._$LP;o<0&&(o=1);var n=this.getOpacity(i,r)*e._$VS*e.baseOpacity,s=null!=r._$hr?r._$hr:r._$Cr;t.setClipBufPre_clipContextForDraw(e.clipBufPre_clipContext),t._$WP(this.culling),t._$Uo(o,3*this._$Yo,this._$BP,s,this._$Qi,n,this._$6s,r)}},$t.prototype.dump=function(){console.log(" _$yi( %d ) , _$d0( %d ) , _$Yo( %d ) \n",this._$LP,this._$d0,this._$Yo),console.log(" _$Oi _$di = { ");for(var t=0;tstartMotion() / start _$K _$3 (m%d)\n",r,e._$sr));if(null==t)return-1;e=new dt,e._$w0=t,this.motions.push(e);var n=e._$sr;return this._$eb&&_._$Ji("MotionQueueManager[size:%2d]->startMotion() / new _$w0 (m%d)\n",r,n),n},ct.prototype.updateParam=function(t){try{for(var i=!1,e=0;eupdateParam() / _$T0 _$w0 (m%d)\n",this.motions.length-1,r._$sr),this.motions.splice(e,1),e--)):(this.motions=this.motions.splice(e,1),e--)}else this.motions.splice(e,1),e--}return i}catch(t){return _._$li(t),!0}},ct.prototype.isFinished=function(t){if(arguments.length>=1){for(var i=0;i.9&&at.EXPAND_W,this.gl);if(null==this.gl)throw new Error("gl is null");var h=1*this._$C0*n,l=1*this._$tT*n,$=1*this._$WL*n,u=this._$lT*n;if(null!=this.clipBufPre_clipContextMask){a.frontFace(a.CCW),a.useProgram(this.shaderProgram),this._$vS=Tt(a,this._$vS,r),this._$no=Pt(a,this._$no,e),a.enableVertexAttribArray(this.a_position_Loc),a.vertexAttribPointer(this.a_position_Loc,2,a.FLOAT,!1,0,0),this._$NT=Tt(a,this._$NT,o),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this.textures[t]),a.uniform1i(this.s_texture0_Loc,1),a.enableVertexAttribArray(this.a_texCoord_Loc),a.vertexAttribPointer(this.a_texCoord_Loc,2,a.FLOAT,!1,0,0),a.uniformMatrix4fv(this.u_matrix_Loc,!1,this.getClipBufPre_clipContextMask().matrixForMask);var p=this.getClipBufPre_clipContextMask().layoutChannelNo,f=this.getChannelFlagAsColor(p);a.uniform4f(this.u_channelFlag,f.r,f.g,f.b,f.a);var c=this.getClipBufPre_clipContextMask().layoutBounds;a.uniform4f(this.u_baseColor_Loc,2*c.x-1,2*c.y-1,2*c._$EL()-1,2*c._$5T()-1),a.uniform1i(this.u_maskFlag_Loc,!0)}else if(null!=this.getClipBufPre_clipContextDraw()){a.useProgram(this.shaderProgramOff),this._$vS=Tt(a,this._$vS,r),this._$no=Pt(a,this._$no,e),a.enableVertexAttribArray(this.a_position_Loc_Off),a.vertexAttribPointer(this.a_position_Loc_Off,2,a.FLOAT,!1,0,0),this._$NT=Tt(a,this._$NT,o),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this.textures[t]),a.uniform1i(this.s_texture0_Loc_Off,1),a.enableVertexAttribArray(this.a_texCoord_Loc_Off),a.vertexAttribPointer(this.a_texCoord_Loc_Off,2,a.FLOAT,!1,0,0),a.uniformMatrix4fv(this.u_clipMatrix_Loc_Off,!1,this.getClipBufPre_clipContextDraw().matrixForDraw),a.uniformMatrix4fv(this.u_matrix_Loc_Off,!1,this.matrix4x4),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,at.fTexture[this.glno]),a.uniform1i(this.s_texture1_Loc_Off,2);var p=this.getClipBufPre_clipContextDraw().layoutChannelNo,f=this.getChannelFlagAsColor(p);a.uniform4f(this.u_channelFlag_Loc_Off,f.r,f.g,f.b,f.a),a.uniform4f(this.u_baseColor_Loc_Off,h,l,$,u)}else a.useProgram(this.shaderProgram),this._$vS=Tt(a,this._$vS,r),this._$no=Pt(a,this._$no,e),a.enableVertexAttribArray(this.a_position_Loc),a.vertexAttribPointer(this.a_position_Loc,2,a.FLOAT,!1,0,0),this._$NT=Tt(a,this._$NT,o),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this.textures[t]),a.uniform1i(this.s_texture0_Loc,1),a.enableVertexAttribArray(this.a_texCoord_Loc),a.vertexAttribPointer(this.a_texCoord_Loc,2,a.FLOAT,!1,0,0),a.uniformMatrix4fv(this.u_matrix_Loc,!1,this.matrix4x4),a.uniform4f(this.u_baseColor_Loc,h,l,$,u),a.uniform1i(this.u_maskFlag_Loc,!1);this.culling?this.gl.enable(a.CULL_FACE):this.gl.disable(a.CULL_FACE),this.gl.enable(a.BLEND);var d,g,y,m;if(null!=this.clipBufPre_clipContextMask)d=a.ONE,g=a.ONE_MINUS_SRC_ALPHA,y=a.ONE,m=a.ONE_MINUS_SRC_ALPHA;else switch(s){case $t._$ms:d=a.ONE,g=a.ONE_MINUS_SRC_ALPHA,y=a.ONE,m=a.ONE_MINUS_SRC_ALPHA;break;case $t._$ns:d=a.ONE,g=a.ONE,y=a.ZERO,m=a.ONE;break;case $t._$_s:d=a.DST_COLOR,g=a.ONE_MINUS_SRC_ALPHA,y=a.ZERO,m=a.ONE}a.blendEquationSeparate(a.FUNC_ADD,a.FUNC_ADD),a.blendFuncSeparate(d,g,y,m),this.anisotropyExt&&a.texParameteri(a.TEXTURE_2D,this.anisotropyExt.TEXTURE_MAX_ANISOTROPY_EXT,this.maxAnisotropy);var T=e.length;a.drawElements(a.TRIANGLES,T,a.UNSIGNED_SHORT,0),a.bindTexture(a.TEXTURE_2D,null)}},mt.prototype._$Rs=function(){throw new Error("_$Rs")},mt.prototype._$Ds=function(t){throw new Error("_$Ds")},mt.prototype._$K2=function(){for(var t=0;t=48){var r=G._$9o(t);return null!=r?(r._$F0(this),r):null}switch(t){case 1:return this._$bT();case 10:return new n(this._$6L(),!0);case 11:return new S(this._$mP(),this._$mP(),this._$mP(),this._$mP());case 12:return new S(this._$_T(),this._$_T(),this._$_T(),this._$_T());case 13:return new L(this._$mP(),this._$mP());case 14:return new L(this._$_T(),this._$_T());case 15:for(var o=this._$3L(),e=new Array(o),s=0;s>7-this._$hL++&1)},St.prototype._$zT=function(){0!=this._$hL&&(this._$hL=0)},vt.prototype._$wP=function(t,i,e){for(var r=0;rMath.PI;)e-=2*Math.PI;return e},Lt._$9=function(t){return Math.sin(t)},Lt.fcos=function(t){return Math.cos(t)},Mt.prototype._$u2=function(){return this._$IS[0]},Mt.prototype._$yo=function(){return this._$AT&&!this._$IS[0]},Mt.prototype._$GT=function(){return this._$e0},Et._$W2=0,Et.SYSTEM_INFO=null,Et.USER_AGENT=navigator.userAgent,Et.isIPhone=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone},Et.isIOS=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone||Et.SYSTEM_INFO._isIPad},Et.isAndroid=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isAndroid},Et.getOSVersion=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO.version},Et.getOS=function(){return Et.SYSTEM_INFO||Et.setup(),Et.SYSTEM_INFO._isIPhone||Et.SYSTEM_INFO._isIPad?"iOS":Et.SYSTEM_INFO._isAndroid?"Android":"_$Q0 OS"},Et.setup=function(){function t(t,i){for(var e=t.substring(i).split(/[ _,;\.]/),r=0,o=0;o<=2&&!isNaN(e[o]);o++){var n=parseInt(e[o]);if(n<0||n>999){_._$li("err : "+n+" @UtHtml5.setup()"),r=0;break}r+=n*Math.pow(1e3,2-o)}return r}var i,e=Et.USER_AGENT,r=Et.SYSTEM_INFO={userAgent:e};if((i=e.indexOf("iPhone OS "))>=0)r.os="iPhone",r._isIPhone=!0,r.version=t(e,i+"iPhone OS ".length);else if((i=e.indexOf("iPad"))>=0){if((i=e.indexOf("CPU OS"))<0)return void _._$li(" err : "+e+" @UtHtml5.setup()");r.os="iPad",r._isIPad=!0,r.version=t(e,i+"CPU OS ".length)}else(i=e.indexOf("Android"))>=0?(r.os="Android",r._isAndroid=!0,r.version=t(e,i+"Android ".length)):(r.os="-",r.version=-1)},window.UtSystem=w,window.UtDebug=_,window.LDTransform=gt,window.LDGL=nt,window.Live2D=at,window.Live2DModelWebGL=ft,window.Live2DModelJS=q,window.Live2DMotion=J,window.MotionQueueManager=ct,window.PhysicsHair=f,window.AMotion=s,window.PartsDataID=l,window.DrawDataID=b,window.BaseDataID=yt,window.ParamID=u,at.init();var At=!1}()}).call(i,e(7))},function(t,i){t.exports={import:function(){throw new Error("System.import cannot be used indirectly")}}},function(t,i,e){function r(t){return t&&t.__esModule?t:{default:t}}function o(){this.models=[],this.count=-1,this.reloadFlg=!1,Live2D.init(),n.Live2DFramework.setPlatformManager(new _.default)}Object.defineProperty(i,"__esModule",{value:!0}),i.default=o;var n=e(0),s=e(9),_=r(s),a=e(10),h=r(a),l=e(1),$=r(l);o.prototype.createModel=function(){var t=new h.default;return this.models.push(t),t},o.prototype.changeModel=function(t,i){this.reloadFlg&&(this.reloadFlg=!1,this.releaseModel(0,t),this.createModel(),this.models[0].load(t,i))},o.prototype.getModel=function(t){return t>=this.models.length?null:this.models[t]},o.prototype.releaseModel=function(t,i){this.models.length<=t||(this.models[t].release(i),delete this.models[t],this.models.splice(t,1))},o.prototype.numModels=function(){return this.models.length},o.prototype.setDrag=function(t,i){for(var e=0;e0){r.expressions={};for(var t=0;t