LPKRender

⭐ GitHub: cheezhi/LPKRender

示例 Live2D 模型来自 @躺师傅轻食小炒黑崽生日快乐!|live2d桌宠

版权为罗小黑官方与模型作者所有,如有侵权请联系删除

<!-- 引入看板猫 JS -->
<script src="https://cdn.jsdelivr.net/gh/cheezhi/LPKRender/lpkr.min.js"></script>

<!-- 初始化看板猫 -->
<script>
  Live2DWidget.init({
    // 必需参数
    lpkFile: '/model.lpk',           // LPK 模型文件路径

    // 基础设置
    width: 300,                     // 画布宽度
    height: 400,                    // 画布高度
    position: 'right',               // 位置:left 或 right
    bottom: 0,                      // 距离底部距离
    scale: 0.15,                    // 模型缩放
    modelX: 0.7,                 // 靠左(0为最左,1为最右)
    modelY: 0.4,                 // 偏下(0为最上,1为最下)
    modelYOffset: 30,            // 额外向下偏移30像素
    // 移动端专属配置(可选)
    mobileWidth: 150,           // 移动端更小尺寸
    mobileHeight: 150,          // 移动端画布高度
    mobileScale: 0.15,           // 移动端更小缩放
    mobilePosition: 'right',     // 移动端显示在右侧
    mobileBottom: 20,           // 移动端距离底部 20px
    mobileModelX: 0.6,          // 移动端模型水平位置
    mobileModelY: 0.3,          // 移动端模型垂直位置
    mobileModelYOffset: 0,     // 移动端模型垂直偏移

    // 交互控制
    draggable: true,               // 是否可拖拽
    clickable: true,               // 是否可点击
    tapMotion: true,               // 点击时播放动作
    randomMotion: false,          // 随机播放动作

    // 音效控制
    soundEnabled: false,          // 播放音效(默认关闭)

    // 动作控制
    idleMotion: null,             // 初始循环动作
    excludeMotions: ['Idle'],      // 排除的动作组
    hitAreaMapping: {                 // 点击区域映射
      '头': '打招呼',
      '左手': '书'
    },

    // 自定义 CDN(可选)
    libUrls: {
      // cubismCore: 'https://your-cdn.com/cubismcore.min.js',
      // pixi: 'https://your-cdn.com/pixi.min.js',
    }
  });
</script>
正在加载看板猫...