1.0.1 • Published 1 year ago

l2d-vue v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

how to use in vite

package.json
{
	"dependencies": {
		"l2d-vue": "^1.0.0"
	},
	"devDependencies": {
		"vite-plugin-html": "^3.2.0"
	}
}
<script>
/* steps 
 1 init setting
 2 init model
 3 bind events
 */
import live2d from 'l2d-vue'
onMounted(() => {
  console.log(live2d);
  live2d.l2dInitSetting({modelAPI: '/data/', modelList: json.models, waifuSize: '250x360'})
  live2d.l2dInitModel('live2d')
  live2d.l2dWaifuMouseTip((type, txt) => { // event: mouseenter&mouseleave
    console.log(type, txt);
  })
  l2dModule.l2dWaifuClick((res) => { // event: click
  	console.log(res);
  })
})
function change() {
  live2d.l2dSwitchModel()
}
</script>
<template>
<canvas id="live2d"></canvas>
</template>
vite.config.js
server: {
    proxy: {
      '/data': {
        target: 'YourLocalhost/public/',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/data/, '')
      }
    }
  },

exposed

l2dInitModel l2dInitSetting l2dLoadModel l2dModelCapture l2dRandomModel l2dSwitchModel l2dWaifuClick l2dWaifuMouseTip l2d_settings

1.0.1

1 year ago

1.0.0

1 year ago