Code Monkey home page Code Monkey logo

l2dpetformac's Introduction

L2dPetForMac/Live2d桌宠

前言

希望有生之年整合完善所有功能点,成为可配置,可扩展,可自定义的多功能应用。

持续维护中 - 20200831 - 20220330 - 时隔2年重构一次

作者的逼逼叨

  • 因为本是程序员,想要在Mac上运行一个可爱的小萝莉很久了。苦于Mac市场目前我找了很久都没找到符合心意的项目。
  • 于是自己写了一套并且开源!
  • 然后目前项目初期,现阶段可能类似demo版本,整个项目需要的所有技术点对我而言都是直接上手,代码可能不会很优雅。
  • 如果你会js,node,你将很容易玩转这个项目!因为我已经给你搭好架子了。(踩了超多坑!!!
  • 最后:如果你喜欢live2d,喜欢这个项目,欢迎fork,反馈,一定第一时间解答!

环境

小于2.0.0

  1. chrome 83.0.4103.64
  2. node 12.14.1
  3. electron 9.1.0
  4. Live2D Cubism Core version: 04.00.0000 (67108864)

2.0.0

  1. chrome 83.0.4103.64
  2. node 12.14.1
  3. electron 12.2.3
  4. Live2D Cubism Core version: 4.1.0

主要功能

  1. 窗口置顶
  2. 窗口透明 透明无边框
  3. live2d的透明区域点击穿透
  4. 窗口在dock层显示 源码在这里
  5. jsts 打包后的 js 代码通信问题 主要通过window通信
  6. node-imap mail-listener5 邮件监听,随时获取最新邮件信息
  7. Volume.js 声音控制
  8. 谷歌浏览器历史记录实时获取-重构为插件模式
  9. sqlite3加入为了读取Chrome的sqlite
  10. 引入openBES弹幕系统
  11. 拖动移动位置

待重构:

  1. sqlite 封装
  2. mail-listener5 会报Buffer
  3. chrome 通过插件注入 live2d模型
  4. opencv-node 准备接入人脸扫描,期望达到类似faceicg 的效果,face-api可以研究还是有些问题需要解决[x]

项目开始

本项目食用方法

开发版

为了方便后面 electronjs

  1. 分别进入 panel | live2d | 还有根目录 / 运行 yarn 初始化构建一下,3个缺一不可

  2. 启动 electronjs 命令:yarn ; yarn run start 正常的话这时桌面应该有模型被显示了

  3. 启动 live2d 热更新 命令:cd live2d ; yarn ; yarn run start 这一步是为了开启热更新,方便修改

  4. 不想开启热更新的话可以在 cd live2d 目录下面使用yarn run build 此时会更新 live2d 目录下的 dict 文件夹

tips

主进程的处理逻辑都在 app/main/ 目录下 渲染进程的逻辑 app/renderer/ 目录下

运行

正常显示

Dock栏级别的显示

邮件获取截图

图片

监听Chrome浏览截图

弹幕功能

左边是model模型,右边是model3模型 ps:实验性测试,结论是ok的,就是支持live2d可以加载不同版本的模型

图片

fork前需要技术栈

  1. js live2d 4.0打包之后是这个
  2. ts live2d 4.0的sdk需要这个
  3. nodejs electron需要这个
  4. oc 需要了解程度,窗口顶端化需要这个语言
  5. c++ 需要了解程度,涉及到nodejs和oc通信
  6. webgl 需要有了解,live2d展示核心是这个
  7. 需要看一遍 electron 的官网那些文档最起码的概念要知道 官网文档
  8. live2d 官网的sdk文档,建议每个字都去看一下,建议选日语或者英语用chrome浏览器自带的翻译看,官网的机翻更渣 live2d官网文档4.0

已知bug

  1. loop方法更新动画时会出现警告-[已解决]原因是为了实现透明区域点击穿透导致的性能问题。

需要优化

  1. cpu占用率过高-因为live2dsdk4的渲染是使用的cpu,导致drawImage方法太费cpu资源了。后续可以优化一下

依赖

由此项目扩展出的让窗口置顶的方法

electron-panel-window 魔改

l2dpetformac's People

Contributors

bokuweb avatar bratsos avatar chankruze avatar ckerr avatar codebytere avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar fscherwi avatar haacked avatar icodeforbananas avatar icoxfog417 avatar izuzak avatar jlord avatar kevinsawicki avatar likeneko avatar louis993546 avatar malept avatar marshallofsound avatar nornagon avatar richienb avatar sahildua2305 avatar sebastianschmidt avatar shiftkey avatar steevedroz avatar tatzyr avatar tcyrus avatar vhashimotoo avatar zanesterling avatar zeke 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

Watchers

 avatar  avatar

l2dpetformac's Issues

报错:A JavaScript error occurred in the main process

Uncaught Exception:
Error: EROFS: read-only file system, open 'db.json'
at Object.openSync (fs.js:440:3)
at Object.func [as openSync] (electron/js2c/asar.js:140:31)
at writeFileSync (fs.js:1265:35)
at FileSync.read (/Applications/L2dPetForMac.app/Contents/Resources/app/node_modules/lowdb/adapters/FileSync.js:46:9)
at LodashWrapper.db.read (/Applications/L2dPetForMac.app/Contents/Resources/app/node_modules/lowdb/lib/main.js:32:21)
at module.exports (/Applications/L2dPetForMac.app/Contents/Resources/app/node_modules/lowdb/lib/main.js:51:13)
at Object. (/Applications/L2dPetForMac.app/Contents/Resources/app/app/main/libs/db/LowDB.js:6:10)
at Module._compile (internal/modules/cjs/loader.js:967:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004:10)
at Module.load (internal/modules/cjs/loader.js:815:32)

Error building `pannel` directory

When building the panel directory via yarn, I got the following errers:

yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.10.6 found at "/usr/local/bin/python"
gyp http GET https://atom.io/download/electron/v12.2.3/node-v12.2.3-headers.tar.gz
gyp http 200 https://atom.io/download/electron/v12.2.3/node-v12.2.3-headers.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: There was a fatal problem while downloading/extracting the tarball
gyp ERR! stack     at Unpack.afterTarball (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:212:21)
gyp ERR! stack     at Unpack.emit (events.js:400:28)
gyp ERR! stack     at Unpack.[maybeClose] (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/unpack.js:217:12)
gyp ERR! stack     at Unpack.opt.ondone (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/unpack.js:131:23)
gyp ERR! stack     at Unpack.emit (events.js:400:28)
gyp ERR! stack     at Unpack.[emit] (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:235:12)
gyp ERR! stack     at Unpack.[maybeEnd] (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:351:17)
gyp ERR! stack     at Unpack.[consumeChunk] (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:380:21)
gyp ERR! stack     at Unpack.write (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:315:25)
gyp ERR! stack     at Unpack.end (/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:424:14)
gyp ERR! System Darwin 21.4.0
gyp ERR! command "/Users/lixingyu/.nvm/versions/node/v14.21.1/bin/node" "/Users/lixingyu/.nvm/versions/node/v14.21.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/lixingyu/Desktop/ethdenver/L2dPetForMac/panel
gyp ERR! node -v v14.21.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

My Personal Config: Mac M1 Pro, node v14.21.1 (tried both v16.14.0 and v12.14.1 and none worked), node-gyp v9.3.1.
Wonder if anyone has encountered a similar problem and how to solve it. Thanks!

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.