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

Commit

Permalink
feat: FINALLY USEABLE (basically)
Browse files Browse the repository at this point in the history
by the way, we fixed journey-ad/live2d_src#1 and
journey-ad/live2d_src#3 , thanks for your great work!
  • Loading branch information
xiazeyu committed Aug 26, 2018
1 parent 7caba30 commit 4f6200a
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 36 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Add the Sseexxyyy live2d to your webpages!

[TOC]

Demo: [TBD.](javascript:void(0);)
Demo: [Still working, but you can have a look~](https://xiazeyu.github.io/live2d-widget.js/dev.html)

Docs(including APIs): [Click me!](https://xiazeyu.github.io/live2d-widget.js/)

Online generator: [TBD.](javascript:void(0);)

Expand Down
3 changes: 3 additions & 0 deletions dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
</head>
<body>
<script src="dev/clL2D.min.js"></script>
<script type="text/javascript">
initL2Dwidget();
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions lib/clL2D.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/clL2D.0.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/clL2D.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/clL2D.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/stats.html

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/PlatformManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ PlatformManager.prototype.loadTexture = function(model/*ALive2DModel*/, no/*
{
// load textures
var loadedImage = new Image();
// Thanks to @mashirozx & @fghrsh
// Issues:
// @https:/journey-ad/live2d_src/issues/1
// @https:/journey-ad/live2d_src/issues/3
loadedImage.crossOrigin = 'Anonymous';
loadedImage.src = path;
loadedImage.onload = onload;
loadedImage.onerror = onerror;
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions src/cDefine.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @desc The definitions of values releated to model react
*/

var cDefine = {
export const cDefine = {
// above are viewMatrix value settings
VIEW_LOGICAL_LEFT : -1, // -1, the left abscissa of viewMatrix
VIEW_LOGICAL_RIGHT : 1, // 1, the right abscissa of viewMatrix
Expand Down Expand Up @@ -33,5 +33,3 @@ var cDefine = {
HIT_AREA_HEAD : "head",
HIT_AREA_BODY : "body"
};

module.exports = cDefine;
File renamed without changes.
5 changes: 3 additions & 2 deletions src/cLive2DApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


import { config } from './config/configMgr';
import { createElement, currWebGL } from './elementMgr';
import { createElement, currWebGL, currCanvas } from './elementMgr';
import { UtSystem,
UtDebug,
LDTransform,
Expand All @@ -23,8 +23,9 @@ import { UtSystem,
import { L2DTargetPoint, L2DViewMatrix, L2DMatrix44 } from "./lib/Live2DFramework";
import { cManager } from "./cManager";
import { MatrixStack } from "./utils/MatrixStack";
import cDefine from "./cDefine";
import { cDefine } from "./cDefine";

let live2DMgr = new cManager();
let isDrawStart = false;
let dragMgr = null;
let viewMatrix = null;
Expand Down
5 changes: 2 additions & 3 deletions src/cManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Live2DFramework } from "./lib/Live2DFramework";
import { PlatformManager } from "./lib/PlatformManager";
import { PlatformManager } from "./PlatformManager";
import { cModel } from "./cModel";
import { cDefine } from "./cDefine";

Expand All @@ -10,8 +10,7 @@ function cManager() {
this.count = -1;
this.reloadFlg = false;

Live2D.init();
Live2DFramework.setPlatformManager(new PlatformManager);
Live2DFramework.setPlatformManager(new PlatformManager());

}

Expand Down
File renamed without changes.
18 changes: 16 additions & 2 deletions src/cModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@ import { Live2DFramework, L2DBaseModel, L2DEyeBlink } from "./lib/Live2DFramewor
import { ModelSettingJson } from "./utils/ModelSettingJson";
import { MatrixStack } from "./utils/MatrixStack";
import { cDefine } from "./cDefine";

import { UtSystem,/*
UtDebug,
LDTransform,
LDGL,
Live2D,
Live2DModelWebGL,
Live2DModelJS,
Live2DMotion,
MotionQueueManager,
PhysicsHair,
AMotion,
PartsDataID,
DrawDataID,
BaseDataID,
ParamID*/ } from './lib/live2d.core';
//============================================================
//============================================================
// class cModel extends L2DBaseModel
//============================================================
//============================================================
export default function cModel()
export function cModel()
{
//L2DBaseModel.apply(this, arguments);
L2DBaseModel.prototype.constructor.call(this);
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/elementMgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ let currCanvas;

function createElement(){

let e = document.getElementById(config.name.div)
if (e !== null){
document.body.removeChild(e);
}

let newElem = document.createElement('div');
newElem.id = config.name.div;
newElem.innerHTML = htmlTemplate;
Expand Down Expand Up @@ -84,4 +89,5 @@ function initWebGL(){
export{
createElement,
currWebGL,
currCanvas,
}
46 changes: 31 additions & 15 deletions src/lib/Live2DFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
* @desc Basic functions releated to model react
*/

import { UtSystem,
UtDebug,
LDTransform,
LDGL,
Live2D,
Live2DModelWebGL,
Live2DModelJS,
Live2DMotion,
MotionQueueManager,
PhysicsHair,
AMotion,
PartsDataID,
DrawDataID,
BaseDataID,
ParamID } from './live2d.core';

//============================================================
//============================================================
// class L2DBaseModel
Expand Down Expand Up @@ -1142,7 +1158,7 @@ function L2DTargetPoint() {
}

//============================================================
L2DTargetPoint.FRAME_RATE = 30;
L2DTargetPoint.FRAME_RATE = 60;

//============================================================
// L2DTargetPoint # set()
Expand Down Expand Up @@ -1374,18 +1390,18 @@ Live2DFramework.setPlatformManager = function (platformManager /*IPlatformManage
}

export{
L2DTargetPoint,
Live2DFramework,
L2DViewMatrix,
L2DPose,
L2DPartsParam,
L2DPhysics,
L2DMotionManager,
L2DModelMatrix,
L2DMatrix44,
EYE_STATE,
L2DEyeBlink,
L2DExpressionParam,
L2DExpressionMotion,
L2DBaseModel,
L2DTargetPoint,
Live2DFramework,
L2DViewMatrix,
L2DPose,
L2DPartsParam,
L2DPhysics,
L2DMotionManager,
L2DModelMatrix,
L2DMatrix44,
EYE_STATE,
L2DEyeBlink,
L2DExpressionParam,
L2DExpressionMotion,
L2DBaseModel,
}
File renamed without changes.
4 changes: 1 addition & 3 deletions src/utils/MatrixStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @desc A matrix stack releated to draw the model
*/

function MatrixStack() {}
export function MatrixStack() {}

MatrixStack.matrixStack = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
MatrixStack.depth = 0;
Expand Down Expand Up @@ -132,5 +132,3 @@ MatrixStack.multMatrix = function(matNew)
thisRef.currentMatrix[i] = thisRef.tmp[i];
}
}

module.exports = MatrixStack;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/ModelSettingJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Live2DFramework } from "../lib/Live2DFramework"
* @param null
* @returns {Structure} ModelSettingJson
*/
export default function ModelSettingJson()
export function ModelSettingJson()
{ // Define the index in the json file.
this.NAME = "name";
this.ID = "id";
Expand Down
File renamed without changes.

0 comments on commit 4f6200a

Please sign in to comment.