Coder Social home page Coder Social logo

setsun / react-model-viewer Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 6.0 1.94 MB

3D model viewer / animation player in React & Three.js

Home Page: https://setsun.github.io/react-model-viewer

License: MIT License

JavaScript 15.84% TypeScript 84.16%
react threejs animation react-three-fiber 3d webgl

react-model-viewer's Introduction

react-model-viewer

A 3D model viewer & animation player for React.

Supports:

  • GTLF, OBJ formats
  • Loading progress bar for asset files
  • Animation progress bar for 3D animations
  • Animation clip selection
  • Orbit camera controls
  • Play, pause, seek, & loop controls
  • Playback speed controls

Install

# main package
npm i react-model-viewer

# peer dependencies
npm i react react-dom three

Bundle size: https://bundlephobia.com/result?p=react-model-viewer

Example

http://setsun.github.io/react-model-viewer/?path=/story/react-model-viewer--gtlf-sonic

example

API

react-model-viewer is meant to interface seamlessly with three.js model loaders for loading 3D assets (GTLFLoader, OBJLoader, etc).

Additionally it supports animations via THREE.AnimationMixer if the model includes them.

import ModelViewer from 'react-model-viewer';

const modelPath = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Duck/glTF/Duck.gltf';

const App = () => (
  <ModelViewer type="gtlf" src={modelPath} />
);

Coming Soon

  • Animation timestamps / frames
  • Better support for OBJ and switching out MTL textures.
  • Support for other loaders (FBX, COLLADA, etc.)
  • Render props for headless component rendering (BYOS - bring your own styles)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.