Home Reference Source
import {L2Dwidget} from 'live2d-widget/src/index.js'
public class | source

L2Dwidget

The main entry point, which is ... nothing

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

config: *

public

Method Summary

Public Methods
public

captureFrame(callback: Function): null

Capture current frame to png file captureFrame

public

download current frame L2Dwidget.captureFrame

public

emit(name: *, args: ...*): *

public

init(userConfig: Object): null

The init function

public

on(name: *, handler: *): *

Public Constructors

public constructor() source

Public Members

public config: * source

public eventHandlers: {} source

Public Methods

public captureFrame(callback: Function): null source

Capture current frame to png file captureFrame

Params:

NameTypeAttributeDescription
callback Function

The callback function which will receive the current frame

Return:

null

public downloadFrame(): null source

download current frame L2Dwidget.captureFrame

Return:

null

public emit(name: *, args: ...*): * source

Params:

NameTypeAttributeDescription
name *
args ...*

Return:

*

public init(userConfig: Object): null source

The init function

Params:

NameTypeAttributeDescription
userConfig Object
  • optional

User's custom config 用户自定义设置

userConfig.model.jsonPath String
  • optional
  • default: ''

Path to Live2D model's main json eg. https://test.com/miku.model.json model主文件路径

userConfig.model.scale Number
  • optional
  • default: 1

Scale between the model and the canvas 模型与canvas的缩放

userConfig.display.superSample Number
  • optional
  • default: 2

rate for super sampling rate 超采样等级

userConfig.display.width Number
  • optional
  • default: 150

Width to the canvas which shows the model canvas的长度

userConfig.display.height Number
  • optional
  • default: 300

Height to the canvas which shows the model canvas的高度

userConfig.display.position String
  • optional
  • default: 'right'

Left of right side to show 显示位置:左或右

userConfig.display.hOffset Number
  • optional
  • default: 0

Horizontal offset of the canvas canvas水平偏移

userConfig.display.vOffset Number
  • optional
  • default: -20

Vertical offset of the canvas canvas垂直偏移

userConfig.mobile.show Boolean
  • optional
  • default: true

Whether to show on mobile device 是否在移动设备上显示

userConfig.mobile.scale Number
  • optional
  • default: 0.5

Scale on mobile device 移动设备上的缩放

userConfig.name.canvas String
  • optional
  • default: 'live2dcanvas'

ID name of the canvas canvas元素的ID

userConfig.name.div String
  • optional
  • default: 'live2d-widget'

ID name of the div div元素的ID

userConfig.react.opacity Number
  • optional
  • default: 0.7

opacity 透明度

userConfig.dev.border Boolean
  • optional
  • default: false

Whether to show border around the canvas 在canvas周围显示边界

userConfig.dialog.enable Boolean
  • optional
  • default: false

Display dialog 显示人物对话框

userConfig.dialog.hitokoto Boolean
  • optional
  • default: false

Enable hitokoto 使用一言API

Return:

null

public on(name: *, handler: *): * source

Params:

NameTypeAttributeDescription
name *
handler *

Return:

*