Giter Site home page Giter Site logo

stevenjoezhang / live2d-widget Goto Github PK

View Code? Open in Web Editor NEW
8.4K 89.0 2.3K 988 KB

把萌萌哒的看板娘抱回家 (ノ≧∇≦)ノ | Live2D widget for web platform

Home Page: https://zhangshuqiao.org/2018-07/在网页中添加Live2D看板娘

License: GNU General Public License v3.0

JavaScript 77.24% CSS 22.76%
javascript-plugin live2d

live2d-widget's Introduction



live2d-widget's People

Contributors

leirock avatar shadowwaiker avatar stevenjoezhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

live2d-widget's Issues

请问如何用代码控制动作?

我想用代码控制看板娘的动作, 比如什么时候说话, 往哪里看. 这个是在live2d.min.js中的函数来控制的吗? 是否有未压缩版本的?
谢谢

live2d 切换人物模型资源加载问题

问题:waifu-tips.js 进行资源加载时error !
如图所示:
live2d source Loading problem
加载模型:Live2D 模型 6-0 加载完成后出现错误
html page error msg :
Package size exceeded the configured limit of 50 MB. Try https://github.com/fghrsh/live2d_api/tree/1.0.0/model/HyperdimensionNeptunia/nepnep/general/pose.json instead.
已尝试解决方案:
切换文件内部资源加载链接为本地:
42行 script.src = "https://cdn.jsdelivr.net/gh/GalaxyMimi/CDN/asteroids.js";
54行 open("https://github.com/stevenjoezhang/live2d-widget");
仍未解决;分析原因可能不是因为这两份资源导致。
如大佬有时间请看一下是否能处理,不胜感激。
说明:通过demo进行测试人物切换一样的问题。

看板娘位置设置在右边后不显示工具栏

在waifu.css中设置了
`
#waifu {
bottom: -1000px;
right: 0; // 让看板娘出现在最右侧
line-height: 0;
margin-bottom: -10px;
position: fixed;
transform: translateY(3px);
transition: transform .3s ease-in-out, bottom 3s ease-in-out;
z-index: 1;
}

#waifu-tool {
color: #aaa;
opacity: 0;
position: absolute;
left: 10px; // 设置工具栏在左侧显示
top: 70px;
transition: opacity 1s;
}
`
后访问只在右侧加载了看板娘,不能加载工具栏。求助。

使用了自己上传npm的包,看板娘变模糊了

我按照示例说的fork了一份到自己的repo中,使用jsdelivr去加载js脚本,但是发现做了更改后,jsdelivr不更新,仍然使用老的缓存,所以后来打包到npm上,让jsdelivr读npm的包,这样可以及时更新,但发现和原来比,看板娘变模糊了,没弄懂是为什么。
我只是把看板娘挪到了右侧。

应用的网址是
https://blog.houtiao.club
大神能帮忙看看吗?

是否有看板娘全部完成的回调方法

我这边加了一个拖动看板娘的js,但是绘制看板娘是异步加载的,没发判断看板娘是否绘画完成,拿到的waifu是空的,可否加一个看板娘绘画完成的回调方法?

想请教一下canvas外事件响应和loadlive2d的实现

Hi,
我想请教一下您项目里的live2d canvas上事件响应的实现:如何让鼠标移出canvas后live2d角色的目光依然能跟随光标运动。
另外,waifu-tips.js中的loadlive2d是否是live2d.min.js中的函数。我在您的代码中没有找到对应的实现。live2d的事件响应是在这里做的吗?
谢谢!

报错 SyntaxError: JSON Parse error: Unrecognized token '<'

我按照你的说明在 Hexo NexT 的 source/_data/head.swig 中添加了相关的代码

<script src="/live2d/autoload.js"></script>

也修改了autoload.js相应的 live2d-path 路径

const live2d_path = "/live2d/";

fghrsh/live2d_api/ 的代码部署到了有 Nginx 和 PHP 环境的服务器上建立了api ,但是浏览器依然报错如下,请问是哪里配置还需要修改吗?
Xnip2020-04-09_17-16-58
看板娘也无法正确加载
Xnip2020-04-09_17-19-54

关于加载模型的方式

目前想要加载自定义模型要自己搭后端,感觉不太方便。能否修改成通过这个live2d-helper或者类似的方式加载模型?这样既不用自己搭后端,也可以通过jsdelivr之类的cdn加速live2d贴图的访问。

换成html代码大概长下面这个样子。

<script
  defer="defer"
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js"
  onload='if (screen.width >= 768) {
    document.body.insertAdjacentHTML("beforeend", `
      <div id="waifu">
        <canvas id="live2d"></canvas>
      </div>`);
    setTimeout(() => {
        document.getElementById("waifu").style.bottom = 0;
        document.getElementById("waifu").style.right = 0;
        document.getElementById("waifu").style.zIndex = 1;
        document.getElementById("waifu").style.position = "fixed";
      }, 0);
    loadLive2d({
        canvas: "live2d",
        baseUrl: "https:\/\/cdn.jsdelivr.net/gh/fghrsh/live2d_api/model/HyperdimensionNeptunia/nepnep",
        model: "https:\/\/cdn.jsdelivr.net/gh/fghrsh/live2d_api/model/HyperdimensionNeptunia/nepnep/index.json",
        width: "300",
        height: "415"
      })
  }'
></script>

怎么改变live2d的尺寸啊

document.body.insertAdjacentHTML("beforeend", <div id="waifu"> <div id="waifu-tips"></div> <canvas id="live2d" width="800" height="800"></canvas> <div id="waifu-tool"> <span class="fa fa-lg fa-comment"></span> <span class="fa fa-lg fa-user-circle"></span> <span class="fa fa-lg fa-street-view"></span> <span class="fa fa-lg fa-camera-retro"></span> <span class="fa fa-lg fa-info-circle"></span> <span class="fa fa-lg fa-times"></span> </div> </div>);

@media (max-width: 768px) {
#waifu {
display: none;
}
}

我改这2个好像都不行啊,大佬,可以解答一下吗,谢谢

浏览器报:initWidget is not defined

您好,我把live2d_path设置成我服务器上的live2d-widget的路径,而且也能在浏览器上访问到live2d.min.js和waifu-tips.js这两个js文件,但是浏览器却报报了三个错误:
Uncaught SyntaxError: Unexpected token return
Uncaught SyntaxError: Unexpected token this
Uncaught ReferenceError: initWidget is not defined
我把live2d_path换成了https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/能成功显示,博客是用hexo+next7.1主题

不能变装?

貌似只有海王星的那个可以,其他的都不行,不过米米的博客里的可以,请求公开api
(从那个博客上扒的“https://api.zsq.im/live2d ”貌似不能用,只有在页面刚刷新出来的时候响应几秒钟)(或者是我的问题) :(

Chrome调试报错:autoload.js:26 Uncaught ReferenceError: initWidget is not defined

作者大大您好,我在使用插件的过程中遇到了以下问题:在使用您提供的地址

//const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/";

时看板娘可以正常显示,但是我把您的资源完整拷贝了一份到我的仓库中,改成了

const live2d_path = "./live2d-widget/",

看板娘就无法正确显示了。Chrome调试报错:

autoload.js:27 Uncaught ReferenceError: initWidget is not defined
Uncaught SyntaxError: Unexpected token return
ncaught SyntaxError: Unexpected token this

我发现之前也有人问过这个问题,不过我试了一下他的方法,还是不行。请问您知道是怎么回事吗?我的博客地址是:Eric_fish's Blog

live2d使用的谷歌字体api失效

使用live2d之后,由于其中调用的谷歌字体api无法使用,导致网站加载速度被拖慢,在文件中也没有找到是什么代码请求了谷歌字体api,所以想请来问如何关闭谷歌字体api请求。

我终于知道如何添加右键快捷通道了

我终于知道如何添加右键快捷通道了,特地来分享一下。
新加的函数一定要写在function initModel()这个函数下!!!否则没用!!!
参考写法:

$("#live2d").mousedown(function(e) {
	if(e.which==3){
	showMessage("秘密通道<br/><a href=\"https://crowdrink.com/\" title=\"首页\">首页 </a><a href=\"https://crowdrink.com/wplogin\" title=\"后台\" target=\"_blank\">后台 </a><a href=\"http://101.133.211.86\" title=\"宝塔\" target=\"_blank\">宝塔</a> ",4000,10);
	}
});
$("#live2d").bind("contextmenu", function(e) {
	return false;
});

Add i18n support.

Hi there.

Please forgive me writing this issue in English, my Chinese isn't very well.

I was super interested in this project and wanted to have i18n - multiple languages support. I have made a fork of this project to support those who needs to add language of your own.

https://github.com/nonsoft-dev/live2d-widget-i18n

The idea is to swap the waifu language in real-time.

image

This requires i18n-js dependency and I have modified quite a bit of codes without proper testing. Therefore, I'll not make a pull request to add in but I think it's great to share for those who're looking for the same thing as me :).

Thank you for such an awesome widget 🎊 🎊.

Keep up with the great work!

希望调整一下waifu-toggle-active的z-Index

我为body设置了背景图片,然后在body上面盖了一层wrap,为warp设置了一个半透明背景,然后发现warp把waifu-toggle-active覆盖以致于waifu-toggle-active点不了,如下图所示。虽然也可以通过调整自己页面元素的z-Index来修复,但还是觉得调整waifu-toggle-active的z-Index来的优雅。

image

另外一个建议是fontawesome可以升级到新版的https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css,支持的图标更多而且更新

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.