skinview3d/README.md

64 lines
2.0 KiB
Markdown
Raw Normal View History

2017-10-01 14:17:34 +02:00
skinview3d
========
2020-01-07 07:15:01 +01:00
[![CI Status](https://img.shields.io/github/workflow/status/bs-community/skinview3d/CI?label=CI&logo=github&style=flat-square)](https://github.com/bs-community/skinview3d/actions?query=workflow:CI)
[![NPM Package](https://img.shields.io/npm/v/skinview3d.svg?style=flat-square)](https://www.npmjs.com/package/skinview3d)
[![MIT License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat-square)](https://github.com/bs-community/skinview3d/blob/master/LICENSE)
[![Gitter Chat](https://img.shields.io/gitter/room/TechnologyAdvice/Stardust.svg?style=flat-square)](https://gitter.im/skinview3d/Lobby)
2017-10-01 14:17:34 +02:00
2017-10-01 09:47:40 +02:00
Three.js powered Minecraft skin viewer.
2016-01-10 18:28:54 +01:00
# Features
* 1.8 Skins
2017-09-02 14:39:01 +02:00
* HD Skins
2016-01-10 18:28:54 +01:00
* Capes
* Slim Arms
* Automatic model detection (Slim / Default)
2016-01-10 18:28:54 +01:00
2017-10-01 14:17:34 +02:00
# Usage
2018-06-30 17:32:08 +02:00
[Examples of using the viewer](https://bs-community.github.io/skinview3d/)
2017-10-01 14:17:34 +02:00
```html
<div id="skin_container"></div>
<script>
2020-05-29 10:46:19 +02:00
let skinViewer = new skinview3d.SkinViewer(document.getElementById("skin_container"));
2017-10-01 14:17:34 +02:00
2020-05-29 10:46:19 +02:00
// Set viewer size
2018-02-11 16:39:33 +01:00
skinViewer.width = 300;
skinViewer.height = 400;
2017-10-01 14:17:34 +02:00
2020-05-29 10:46:19 +02:00
// Load skin & cape
skinViewer.loadSkinFrom("img/skin.png");
skinViewer.loadCapeFrom("img/cape.png");
// Hide the cape
skinViewer.playerObject.cape.visible = false;
2018-02-11 16:39:33 +01:00
// Control objects with your mouse!
2018-02-12 02:46:07 +01:00
let control = skinview3d.createOrbitControls(skinViewer);
control.enableRotate = true;
control.enableZoom = false;
control.enablePan = false;
2018-01-06 15:01:12 +01:00
2018-02-11 16:39:33 +01:00
// Add an animation
2019-12-22 13:19:33 +01:00
let walk = skinViewer.animations.add(skinview3d.WalkingAnimation);
2018-02-11 16:39:33 +01:00
// Add another animation
2019-12-22 13:19:33 +01:00
let rotate = skinViewer.animations.add(skinview3d.RotatingAnimation);
2018-02-11 16:39:33 +01:00
// Remove an animation, stop walking dude
walk.remove();
2019-12-22 13:19:33 +01:00
// Remove the rotating animation, and make the player face forward
rotate.resetAndRemove();
2018-02-11 16:39:33 +01:00
// And run for now!
2019-12-22 13:19:33 +01:00
let run = skinViewer.animations.add(skinview3d.RunningAnimation);
2018-01-06 15:01:12 +01:00
2018-02-11 16:39:33 +01:00
// Set the speed of an animation
run.speed = 3;
// Pause single animation
run.paused = true;
// Pause all animations!
2019-12-22 13:19:33 +01:00
skinViewer.animations.paused = true;
2017-10-01 14:17:34 +02:00
</script>
```
2017-10-01 14:00:45 +02:00
# Build
2017-10-02 15:29:41 +02:00
`npm run build`