stevenjoezhang / live2d-widget Goto Github PK
View Code? Open in Web Editor NEW把萌萌哒的看板娘抱回家 (ノ≧∇≦)ノ | Live2D widget for web platform
Home Page: https://zhangshuqiao.org/2018-07/在网页中添加Live2D看板娘
License: GNU General Public License v3.0
把萌萌哒的看板娘抱回家 (ノ≧∇≦)ノ | Live2D widget for web platform
Home Page: https://zhangshuqiao.org/2018-07/在网页中添加Live2D看板娘
License: GNU General Public License v3.0
为什么手机端不能访问?
我想用代码控制看板娘的动作, 比如什么时候说话, 往哪里看. 这个是在live2d.min.js
中的函数来控制的吗? 是否有未压缩版本的?
谢谢
问题:waifu-tips.js 进行资源加载时error !
如图所示:
加载模型: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;
}
`
后访问只在右侧加载了看板娘,不能加载工具栏。求助。
我按照示例说的fork了一份到自己的repo中,使用jsdelivr去加载js脚本,但是发现做了更改后,jsdelivr不更新,仍然使用老的缓存,所以后来打包到npm上,让jsdelivr读npm的包,这样可以及时更新,但发现和原来比,看板娘变模糊了,没弄懂是为什么。
我只是把看板娘挪到了右侧。
应用的网址是
https://blog.houtiao.club
大神能帮忙看看吗?
能不能不让看板娘,点开网页就弹出?
我这边加了一个拖动看板娘的js,但是绘制看板娘是异步加载的,没发判断看板娘是否绘画完成,拿到的waifu是空的,可否加一个看板娘绘画完成的回调方法?
Hi,
我想请教一下您项目里的live2d canvas上事件响应的实现:如何让鼠标移出canvas后live2d角色的目光依然能跟随光标运动。
另外,waifu-tips.js中的loadlive2d是否是live2d.min.js中的函数。我在您的代码中没有找到对应的实现。live2d的事件响应是在这里做的吗?
谢谢!
①live2d_api是直接clone https://github.com/fghrsh/live2d_api.git 的,地址是https://live2dapi.teriri.cc/
②使用原来的apiPath=https://live2d.fghrsh.net/api/可以正常加载图片
③但使用自己的api,就无法加载:
调试的时候,各个js文件都能访问到
其次,下载的demo-1.html无法正常显示
而访问README中的demo-1则能正常显示
我按照你的说明在 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 ,但是浏览器依然报错如下,请问是哪里配置还需要修改吗?
看板娘也无法正确加载
目前想要加载自定义模型要自己搭后端,感觉不太方便。能否修改成通过这个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>
找不到对应修改的位置了,大佬可以指出修改的位置吗?
waifu-tip.js 中 初始化模型中modelID modeltexture ID 如何指定成 自定义的模型
有两位看板娘会浮空,一位位置过下。还有看板娘会被我的首页遮挡
点击照相图标后没有下载图片
模型把按钮挡住了
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个好像都不行啊,大佬,可以解答一下吗,谢谢
https://live2d.fghrsh.net
域名证书已过期
试了一下iphone和一台魅族,都显示不出来。
您好,我把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主题
我现在实在无法改变按钮的位置,我的播放器挡住了,请问该如何改变按钮位置
请问大佬 live2d.min.js 源码,没打包过的版本,有吗?(不单指压缩。)
如题,是不是如果关闭,是不是每次都要清理浏览器缓存才能重新显示?
貌似只有海王星的那个可以,其他的都不行,不过米米的博客里的可以,请求公开api
(从那个博客上扒的“https://api.zsq.im/live2d ”貌似不能用,只有在页面刚刷新出来的时候响应几秒钟)(或者是我的问题) :(
求助
作者大大您好,我在使用插件的过程中遇到了以下问题:在使用您提供的地址
//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
是因为api的证书到期了吗?取消注释CDN的那行还是不能加载
看板娘是可以加载出来的,但是对于看板娘的设置已经进行修改(如说的话和大小),可是依旧和你的GitHub里的源码原配置相同,说的话还是没变。附上地址:http://47.95.121.139/wp/
缓存也经过刷新了。。。没用。。。
还有想问一下如何设置大小才能使手机也显示看板娘:https://2heng.xin/👈像这个
麻烦作者了
改到右下角是要改css对嘛,代码量多吗
使用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;
});
header.zip
这是我主题的 header.php.
附上 F12 截图和运行环境:
感谢 dalao.
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.
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!
我为body设置了背景图片,然后在body上面盖了一层wrap,为warp设置了一个半透明背景,然后发现warp把waifu-toggle-active覆盖以致于waifu-toggle-active点不了,如下图所示。虽然也可以通过调整自己页面元素的z-Index来修复,但还是觉得调整waifu-toggle-active的z-Index来的优雅。
另外一个建议是fontawesome可以升级到新版的https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css,支持的图标更多而且更新
飞啊飞
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.