npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

live2d-render

v0.0.5

Published

a easy-to-go render interface for the newest version of live2d

Downloads

33

Readme

An easy-to-go live2d 4.0 render.

Live2dRender

Live2dRender 中文文档

Usage

Take vue.js as an example, the project is like:

📁public
   ├─📄index.html
   ├─📁cat
      ├─🏷️sdwhite cat b.model3.json
      ├─🏷️SDwhite cat B.moc3
      ├─🏷️xxx.exp3.json
      ├─ ...
   ├─ ...
📁src
   ├─🌿App.vue
   └─🎗️main.js

You can deploy your live2d model in your App.vue or anywhere you like via live2d.initializeLive2D:

<script setup>
import HelloWorld from './components/HelloWorld.vue'
import { onMounted } from 'vue';
import * as live2d from 'live2d-render';

defineComponent({
    name: 'App'
});

onMounted(async () => {
    await live2d.initializeLive2D({
        // background color of your live2d canvas 
        BackgroundRGBA: [0.0, 0.0, 0.0, 0.0],

        // path relative to your index.html
        // must be a *.model3.json
        ResourcesPath: './cat/sdwhite cat b.model3.json',
        
        // height and width of the live2d model
        CanvasSize: {
            height: 500,
            width: 400
        },

        ShowToolBox: true,
        
        // If `LoadFromCache` is set as true, all the static resources
        // like texture and model3.json will be stored in indexDB
        // as a quick cache
        LoadFromCache: true
    });
    console.log('finish loading');
});

</script>

Screenshot:

Extra

live2d.initializeLive2D can only be invoked after the window is mounted.

live2d.initializeLive2D has another two arguments MinifiedJSUrl and Live2dCubismcoreUrl, which are the CDN url of the two dependence package.

  • Default of MinifiedJSUrl: https://unpkg.com/[email protected]/minified.js
  • Default of Live2dCubismcoreUrl: https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js

If you want to make your service more stable, you can download the two packages to your server and set the new url as follows:

await live2d.initializeLive2D({
    MinifiedJSUrl: 'https://path/to/minified.js',
    Live2dCubismcoreUrl: 'https://path/to/live2dcubismcore.js'
});

Buy me a coffee

Sponsor me in my own website: https://kirigaya.cn/sponsor.