src/cLive2DApp.js
function theRealInit (){

  createElement();
  initEvent();

  live2DMgr = new cManager(L2Dwidget)
  dragMgr = new L2DTargetPoint();
  let rect = currCanvas.getBoundingClientRect();
  let ratio = rect.height / rect.width;
  let left = cDefine.VIEW_LOGICAL_LEFT;
  let right = cDefine.VIEW_LOGICAL_RIGHT;
  let bottom = -ratio;
  let top = ratio;

  viewMatrix = new L2DViewMatrix();

  viewMatrix.setScreenRect(left, right, bottom, top);

  viewMatrix.setMaxScreenRect(cDefine.VIEW_LOGICAL_MAX_LEFT,
    cDefine.VIEW_LOGICAL_MAX_RIGHT,
    cDefine.VIEW_LOGICAL_MAX_BOTTOM,
    cDefine.VIEW_LOGICAL_MAX_TOP);

  modelScaling(device.mobile() && config.mobile.scale || config.model.scale)

  projMatrix = new L2DMatrix44();
  projMatrix.multScale(1, (rect.width / rect.height));

  deviceToScreen = new L2DMatrix44();
  deviceToScreen.multTranslate(-rect.width / 2.0, -rect.height / 2.0);  // #32
  deviceToScreen.multScale(2 / rect.width, -2 / rect.height);  // #32


  Live2D.setGL(currWebGL);
  currWebGL.clearColor(0.0, 0.0, 0.0, 0.0);
  changeModel(config.model.jsonPath);
  startDraw();


}
function theRealInit (){

  createElement();
  initEvent();

  live2DMgr = new cManager(L2Dwidget)
  dragMgr = new L2DTargetPoint();
  let rect = currCanvas.getBoundingClientRect();
  let ratio = rect.height / rect.width;
  let left = cDefine.VIEW_LOGICAL_LEFT;
  let right = cDefine.VIEW_LOGICAL_RIGHT;
  let bottom = -ratio;
  let top = ratio;

  viewMatrix = new L2DViewMatrix();

  viewMatrix.setScreenRect(left, right, bottom, top);

  viewMatrix.setMaxScreenRect(cDefine.VIEW_LOGICAL_MAX_LEFT,
    cDefine.VIEW_LOGICAL_MAX_RIGHT,
    cDefine.VIEW_LOGICAL_MAX_BOTTOM,
    cDefine.VIEW_LOGICAL_MAX_TOP);

  modelScaling(device.mobile() && config.mobile.scale || config.model.scale)

  projMatrix = new L2DMatrix44();
  projMatrix.multScale(1, (rect.width / rect.height));

  deviceToScreen = new L2DMatrix44();
  deviceToScreen.multTranslate(-rect.width / 2.0, -rect.height / 2.0);  // #32
  deviceToScreen.multScale(2 / rect.width, -2 / rect.height);  // #32


  Live2D.setGL(currWebGL);
  currWebGL.clearColor(0.0, 0.0, 0.0, 0.0);
  changeModel(config.model.jsonPath);
  startDraw();


}
function theRealInit ( ) { createElement ( ) ; initEvent ( ) ; live2DMgr = new cManager ( L2Dwidget ) dragMgr = new L2DTargetPoint ( ) ; let rect = currCanvas . getBoundingClientRect ( ) ; let ratio = rect . height / rect . width ; let left = cDefine . VIEW_LOGICAL_LEFT ; let right = cDefine . VIEW_LOGICAL_RIGHT ; let bottom = - ratio ; let top = ratio ; viewMatrix = new L2DViewMatrix ( ) ; viewMatrix . setScreenRect ( left , right , bottom , top ) ; viewMatrix . setMaxScreenRect ( cDefine . VIEW_LOGICAL_MAX_LEFT , cDefine . VIEW_LOGICAL_MAX_RIGHT , cDefine . VIEW_LOGICAL_MAX_BOTTOM , cDefine . VIEW_LOGICAL_MAX_TOP ) ; modelScaling ( device . mobile ( ) && config . mobile . scale || config . model . scale ) projMatrix = new L2DMatrix44 ( ) ; projMatrix . multScale ( 1 , ( rect . width / rect . height ) ) ; deviceToScreen = new L2DMatrix44 ( ) ; deviceToScreen . multTranslate ( - rect . width / 2.0 , - rect . height / 2.0 ) ; // #32 deviceToScreen . multScale ( 2 / rect . width , - 2 / rect . height ) ; // #32 Live2D . setGL ( currWebGL ) ; currWebGL . clearColor ( 0.0 , 0.0 , 0.0 , 0.0 ) ; changeModel ( config . model . jsonPath ) ; startDraw ( ) ; }
Main function of live2d-widget
@return {null}
Main function of live2d - widget