Revert "Merge pull request #59 from bs-community/add-storybook"
This reverts commitc65b2cd25c
, reversing changes made to990deb16db
.
|
@ -1,4 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
stories: ['../examples/stories/**/*.stories.js'],
|
|
||||||
addons: ['@storybook/addon-knobs/register']
|
|
||||||
};
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"type": "commonjs"
|
|
||||||
}
|
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
@ -0,0 +1,40 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>skinview3d</title>
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Archivo+Black" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="skin_container"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../bundles/skinview3d.bundle.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let skinViewer = new skinview3d.SkinViewer(document.getElementById("skin_container"), {
|
||||||
|
width: 400,
|
||||||
|
height: 300,
|
||||||
|
skin: "./1_8_texturemap_redux.png"
|
||||||
|
});
|
||||||
|
|
||||||
|
let control = new skinview3d.createOrbitControls(skinViewer);
|
||||||
|
skinViewer.animations.add(skinview3d.WalkingAnimation);
|
||||||
|
skinViewer.animations.speed = 1.5;
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -1,100 +0,0 @@
|
||||||
/* eslint-disable */
|
|
||||||
import * as skinview3d from "../..";
|
|
||||||
import { withKnobs, radios, number } from "@storybook/addon-knobs";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
title: "Skinview3d",
|
|
||||||
decorators: [withKnobs],
|
|
||||||
};
|
|
||||||
|
|
||||||
let currentAnimation;
|
|
||||||
|
|
||||||
const createViewer = () => {
|
|
||||||
const element = document.createElement("div");
|
|
||||||
const viewer = new skinview3d.SkinViewer(element, {
|
|
||||||
width: 300,
|
|
||||||
height: 400,
|
|
||||||
skin: "textures/1_8_texturemap_redux.png",
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(viewer);
|
|
||||||
|
|
||||||
// Control objects with your mouse!
|
|
||||||
const control = skinview3d.createOrbitControls(viewer);
|
|
||||||
control.enableRotate = true;
|
|
||||||
control.enableZoom = false;
|
|
||||||
control.enablePan = false;
|
|
||||||
|
|
||||||
// Add an animation
|
|
||||||
currentAnimation = viewer.animations.add(skinview3d.WalkingAnimation);
|
|
||||||
|
|
||||||
return { viewer, element };
|
|
||||||
};
|
|
||||||
|
|
||||||
let { viewer, element } = createViewer();
|
|
||||||
|
|
||||||
export const Basic = () => {
|
|
||||||
// reset
|
|
||||||
let { viewer, element } = createViewer();
|
|
||||||
if (currentAnimation) {
|
|
||||||
currentAnimation.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Animation = () => {
|
|
||||||
if (currentAnimation) {
|
|
||||||
currentAnimation.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
const animationMap = {
|
|
||||||
Walk: skinview3d.WalkingAnimation,
|
|
||||||
Run: skinview3d.RunningAnimation,
|
|
||||||
Rotate: skinview3d.RotatingAnimation,
|
|
||||||
};
|
|
||||||
|
|
||||||
const animationKey = radios("Animations", Object.keys(animationMap), "Run");
|
|
||||||
currentAnimation = viewer.animations.add(animationMap[animationKey]);
|
|
||||||
|
|
||||||
const label = "Speed";
|
|
||||||
|
|
||||||
const defaultValue = 0.5;
|
|
||||||
const options = {
|
|
||||||
range: true,
|
|
||||||
min: 0.1,
|
|
||||||
max: 2,
|
|
||||||
step: 0.01,
|
|
||||||
};
|
|
||||||
const value = number(label, defaultValue, options);
|
|
||||||
|
|
||||||
currentAnimation.speed = value;
|
|
||||||
|
|
||||||
return element;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Textures = () => {
|
|
||||||
const skinOptions = {
|
|
||||||
"1.8 Skin": "1_8_texturemap_redux",
|
|
||||||
"Classic Skin": "Hacksore",
|
|
||||||
"HD Skin": "ironman_hd",
|
|
||||||
};
|
|
||||||
const skinUrl = radios("Skin Textures", skinOptions, "1_8_texturemap_redux");
|
|
||||||
|
|
||||||
const capeOptions = {
|
|
||||||
None: "none",
|
|
||||||
"Classic Cape": "cape",
|
|
||||||
"HD Cape": "hd_cape",
|
|
||||||
};
|
|
||||||
|
|
||||||
const capeUrl = radios("Cape Textures", capeOptions, "none");
|
|
||||||
viewer.loadSkin(`textures/${skinUrl}.png`);
|
|
||||||
|
|
||||||
if (capeUrl === "none") {
|
|
||||||
viewer.loadCape(null);
|
|
||||||
} else {
|
|
||||||
viewer.loadCape(`textures/${capeUrl}.png`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return element;
|
|
||||||
};
|
|
Before Width: | Height: | Size: 689 B |
|
@ -1,3 +0,0 @@
|
||||||
# Example textures
|
|
||||||
Assets in this directory are copyrighted by their original author(s), and are **OUTSIDE** the scope of skinview3d's license.
|
|
||||||
These files are intended for demo use. If you are the copyright owner and disagree with our use, please submit an issue and we will remove the related files.
|
|
Before Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 278 KiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
13
package.json
|
@ -11,10 +11,10 @@
|
||||||
"build": "npm run build:modules && npm run build:bundles",
|
"build": "npm run build:modules && npm run build:bundles",
|
||||||
"test:lint": "eslint --ext .ts src",
|
"test:lint": "eslint --ext .ts src",
|
||||||
"test": "npm run test:lint",
|
"test": "npm run test:lint",
|
||||||
"dev:watch:modules": "tsc -w --preserveWatchOutput --declaration --sourceMap --outDir libs -p .",
|
"dev:watch:modules": "tsc -w --declaration --sourceMap --outDir libs -p .",
|
||||||
"dev:watch:bundles": "rollup -w --no-watch.clearScreen -c",
|
"dev:watch:bundles": "rollup -w -c",
|
||||||
"dev:storybook": "start-storybook -s ./examples -p 6006",
|
"dev:serve": "ws",
|
||||||
"dev": "npm-run-all --parallel dev:watch:modules dev:storybook",
|
"dev": "npm-run-all --parallel dev:watch:modules dev:watch:bundles dev:serve",
|
||||||
"prepublishOnly": "npm run clean && npm run build"
|
"prepublishOnly": "npm run clean && npm run build"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -42,16 +42,13 @@
|
||||||
"three": "^0.118.3"
|
"three": "^0.118.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.4",
|
|
||||||
"@rollup/plugin-node-resolve": "^8.4.0",
|
"@rollup/plugin-node-resolve": "^8.4.0",
|
||||||
"@rollup/plugin-typescript": "^5.0.2",
|
"@rollup/plugin-typescript": "^5.0.2",
|
||||||
"@storybook/addon-knobs": "^5.3.19",
|
|
||||||
"@storybook/html": "^5.3.19",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
||||||
"@typescript-eslint/parser": "^3.6.1",
|
"@typescript-eslint/parser": "^3.6.1",
|
||||||
"@yushijinhun/three-minifier-rollup": "^0.1.7",
|
"@yushijinhun/three-minifier-rollup": "^0.1.7",
|
||||||
"babel-loader": "^8.1.0",
|
|
||||||
"eslint": "^7.4.0",
|
"eslint": "^7.4.0",
|
||||||
|
"local-web-server": "^4.2.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "^2.21.0",
|
"rollup": "^2.21.0",
|
||||||
|
|