Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
feat:
Browse files Browse the repository at this point in the history
almost
  • Loading branch information
xiazeyu committed Jan 13, 2018
1 parent 0ec0dec commit 8c668b1
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 52 deletions.
Empty file added src/PlatformManager
Empty file.
File renamed without changes.
Empty file added src/cDefine
Empty file.
File renamed without changes.
61 changes: 25 additions & 36 deletions src/cLive2DApp.js
Expand Up @@ -3,32 +3,29 @@
*/


import {
UtSystem,
UtDebug,
LDTransform,
LDGL,
Live2D,
Live2DModelWebGL,
Live2DModelJS,
Live2DMotion,
MotionQueueManager,
PhysicsHair,
AMotion,
PartsDataID,
DrawDataID,
BaseDataID,
ParamID
} from './lib/live2d.core';/*
import { device } from 'current-device';
import { config } from './config/configMgr';
import { createElement, currWebGL } from './elementMgr';
import { UtSystem,
UtDebug,
LDTransform,
LDGL,
Live2D,
Live2DModelWebGL,
Live2DModelJS,
Live2DMotion,
MotionQueueManager,
PhysicsHair,
AMotion,
PartsDataID,
DrawDataID,
BaseDataID,
ParamID } from './lib/live2d.core';
import { L2DTargetPoint, L2DViewMatrix, L2DMatrix44 } from "./lib/Live2DFramework";
import cManager from "./cManager";
import { cManager } from "./cManager";
import { MatrixStack } from "./utils/MatrixStack";
import { cDefine } from "./cDefine";

const live2DMgr = new cManager();
let isDrawStart = false;
let canvas = null;
let dragMgr = null;
let viewMatrix = null;
let projMatrix = null;
Expand All @@ -39,10 +36,8 @@ let lastMouseY = 0;
let headPos = 0.5;
let opacityDefault = 0.7;
let opacityHover = 1;
*/

import { config } from './config/configMgr';
import { createElement, currWebGL } from './elementMgr';


/**
* Main function of live2d-widget
Expand All @@ -53,12 +48,7 @@ export default () => {

createElement();

let width = canvas.width;
let height = canvas.height;
let sWidth = parseInt(canvas.style.width);
let sHeight = parseInt(canvas.style.height);

dragMgr = new L2DTargetPoint();
let dragMgr = new L2DTargetPoint();
let ratio = height / width;
let left = cDefine.VIEW_LOGICAL_LEFT;
let right = cDefine.VIEW_LOGICAL_RIGHT;
Expand Down Expand Up @@ -93,8 +83,7 @@ export default () => {


function initEvent(){/*
canvas = document.getElementById(canvasId);
if (canvas.addEventListener) {
if (currCanvas.addEventListener) {
window.addEventListener("click", mouseEvent);
window.addEventListener("mousedown", mouseEvent);
window.addEventListener("mousemove", mouseEvent);
Expand All @@ -117,7 +106,7 @@ function startDraw() {
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame;

requestAnimationFrame(tick, canvas);
requestAnimationFrame(tick, currCanvas);
})();
}
}
Expand Down Expand Up @@ -261,7 +250,7 @@ function modelTurnHead(event)
{
drag = true;

let rect = canvas.getBoundingClientRect();
let rect = currCanvas.getBoundingClientRect();

let sx = transformScreenX(event.clientX - rect.left);
let sy = transformScreenY(event.clientY - rect.top);
Expand All @@ -288,7 +277,7 @@ function modelTapEvent(event)
{
drag = true;

let rect = canvas.getBoundingClientRect();
let rect = currCanvas.getBoundingClientRect();

let sx = transformScreenX(event.clientX - rect.left);
let sy = transformScreenY(event.clientY - rect.top);
Expand All @@ -313,7 +302,7 @@ function modelTapEvent(event)

function followPointer(event)
{
let rect = canvas.getBoundingClientRect();
let rect = currCanvas.getBoundingClientRect();

let sx = transformScreenX(event.clientX - rect.left);
let sy = transformScreenY(event.clientY - rect.top);
Expand Down
Empty file added src/cManager
Empty file.
6 changes: 5 additions & 1 deletion src/_cManager.js → src/cManager.js
Expand Up @@ -3,7 +3,7 @@ import PlatformManager from "./lib/PlatformManager";
import { cModel } from "./cModel";
import { cDefine } from "./cDefine";

export default function cManager() {
function cManager() {
// console.log("--> cManager()");

this.models = [];
Expand Down Expand Up @@ -98,3 +98,7 @@ cManager.prototype.tapEvent = function (x, y) {

return true;
};

export{
cManager,
}
Empty file added src/cModel
Empty file.
File renamed without changes.
Empty file added src/lib/Live2DFramework
Empty file.
30 changes: 15 additions & 15 deletions src/lib/_Live2DFramework.js → src/lib/Live2DFramework.js
Expand Up @@ -1373,19 +1373,19 @@ Live2DFramework.setPlatformManager = function (platformManager /*IPlatformManage
Live2DFramework.platformManager = platformManager;
}

module.exports = {
L2DTargetPoint: L2DTargetPoint,
Live2DFramework: Live2DFramework,
L2DViewMatrix: L2DViewMatrix,
L2DPose: L2DPose,
L2DPartsParam: L2DPartsParam,
L2DPhysics: L2DPhysics,
L2DMotionManager: L2DMotionManager,
L2DModelMatrix: L2DModelMatrix,
L2DMatrix44: L2DMatrix44,
EYE_STATE: EYE_STATE,
L2DEyeBlink: L2DEyeBlink,
L2DExpressionParam: L2DExpressionParam,
L2DExpressionMotion: L2DExpressionMotion,
L2DBaseModel: L2DBaseModel
export{
L2DTargetPoint,
Live2DFramework,
L2DViewMatrix,
L2DPose,
L2DPartsParam,
L2DPhysics,
L2DMotionManager,
L2DModelMatrix,
L2DMatrix44,
EYE_STATE,
L2DEyeBlink,
L2DExpressionParam,
L2DExpressionMotion,
L2DBaseModel,
}
Empty file added src/utils/MatrixStack
Empty file.
File renamed without changes.
Empty file added src/utils/ModelSettingJson
Empty file.
File renamed without changes.

0 comments on commit 8c668b1

Please sign in to comment.