GithubHelp home page GithubHelp logo

kryndex / whitestorm.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from whitestormjs/whs.js

0.0 2.0 0.0 297.48 MB

:rocket: ๐ŸŒช Super-fast 3D framework for Web Applications ๐Ÿฅ‡ & Games ๐ŸŽฎ. Based on Three.js

Home Page: https://whsjs.readme.io/docs

License: MIT License

JavaScript 100.00%

whitestorm.js's Introduction

XO code style Three NPM Version Build Status PRs Welcome Coverage Status Known Vulnerabilities Discord

OpenCollective Backers OpenCollective Sponsors

Framework for developing 3D web apps

Contributors welcome! :P How to start contributing

Development chat - opens in discord app. Ask for help here;)

Support the project - [Donate] buy developers a โ˜•

$ npm install --save whs

You can find lots of examples at showcases.

basic/helloworld basic/model softbody/cloth3 postprocessing/basic-glitch softbody/ropes design/saturn

Why?

  • ๐Ÿค” Because making of even a basic Three.js application requires at least ~20 lines of code (see this tutorial)

    • Three.js: you will need to setup: scene, renderer, camera, make an animate() function before making the actual app.

    • Whitestorm.js: There are modules that helps you easily setup them:

      const app = new WHS.App([
        new WHS.ElementModule(), // attach to DOM
        new WHS.SceneModule(), // creates THREE.Scene instance
        new WHS.CameraModule(), // creates PerspectiveCamera instance
        new WHS.RenderingModule() // creates WebGLRenderer instance
      ]);
      
      app.start(); // run animation

      See more about modules

  • ๐Ÿ’ฃ Adding physics is hard.

    • Three.js: To make your app run with physics you need to make a second world with same 3d objects and apply their transform (position & rotation) to your rendered scene objects (THREE.Scene for example) in every frame.

    • Whitestorm.js: Can be done with modules in a few lines:

      const app = new WHS.App([
        // Other modules...
        new PHYSICS.WorldModule()
      ]);
      
      const sphere = new WHS.Sphere({
        geometry: {
          radius: 3
        },
      
        modules: [
          new PHYSICS.SphereModule({
            mass: 10
          })
        ],
      
        material: new THREE.MeshBasicMaterial({color: 0xff0000}) // red material
      });
      
      app.start(); // run animation

      Use physics-module-ammonext as your physics module.

      Try with physics on Codepen:

  • ๐Ÿ”Œ Components & plugins

    • Three.js: You can create meshes with geometry and material.

    • Whitestorm.js: You can create components with advanced custom functionality.

      export class BasicComponent extends WHS.MeshComponent {
        build() {
          return new THREE.Mesh(
            new THREE.IcosahedronGeometry(3, 5),
            new THREE.MeshBasicMaterial({color: 0xffffff})
          )
        }
      
        randomize() { // Additional function
          this.position.set(Math.random() * 10, Math.random() * 10, Math.random() * 10);
        }
      }
    • See Component system in interactive 3D of web article for more info.


Download

CDN

Proudly hosted by cdnjs

Features

  • ๐Ÿ’Ž Simple in usage
  • ๐Ÿš€ Speeds up 3D scene prototyping
  • ๐Ÿ”Œ Component based scene graph
  • ๐Ÿ’ฃ Simple integration of any high performance physics even with Worker (Multithreading)
  • ๐Ÿ’ซ Automatization of rendering
  • ๐Ÿ†• ES2015+ based
  • ๐Ÿ”ท Extension system (modules)
  • ๐Ÿ“ฆ Webpack friendly
  • โœ”๏ธ Integrated Three.js rendering engine
  • ๐Ÿ’ž Work with Whitestorm.js and Three.js at the same time

WEBPACK

Use whitestorm-app-boilerplate

Documentation

Documentation for beta is currently in progress. Contact developers in discord chat

Basic application

Try on Codepen:

const app = new WHS.App([
  new WHS.ElementModule(), // attach to DOM
  new WHS.SceneModule(), // creates THREE.Scene instance
  new WHS.CameraModule({
    position: new THREE.Vector3(0, 0, -10)
  }), // creates PerspectiveCamera instance
  new WHS.RenderingModule(), // creates WebGLRenderer instance
  new WHS.OrbitControlsModule() // orbit controls
]);

const sphere = new WHS.Sphere({ // Create sphere comonent.
  geometry: {
    radius: 3
  },

  material: new THREE.MeshBasicMaterial({
    color: 0xffffff, // White color.
  }),

  position: new THREE.Vector3(0, 1, 0) // x: 0, y: 1, z: 0
});

sphere.addTo(app);
console.log(sphere.native); // Logs THREE.Mesh of this component

app.start(); // run animation

You can easily integrate Whitestorm.js with React using react-whs tool!

$ npm install react react-whs --save

Try with React on Codepen:

Example:

import React, {Component} from 'react';
import {App, Sphere} from 'react-whs';

export class Application extends Component {
  render() {
    return (
      <App modules={[
        new WHS.SceneModule(),
        new WHS.CameraModule({
          position: {
            z: 20
          }
        }),
        new WHS.RenderingModule(),
        new WHS.OrbitControlsModule()
      ]}>
        <Sphere
          geometry={[3, 32, 32]}
          material={new THREE.MeshBasicMaterial({color: 0xffffff})}
          key="1"
        />
      </App>
    )
  }
}

Modules

Devtools

Name Status Description
whs-module-statsjs statsjs-npm WhitestormJS module for JavaScript Performance Monitor โšกโŒ›
whs-module-dat.gui datgui-npm User Interface for runtime editing properties ๐Ÿ”‘๐Ÿ› ๐Ÿ”ฉ

Physics

Name Status Description
physics-module-ammonext physics-ammonext-npm Physics module based on Ammo.js

Audio

Name Status Description
whs-module-audio WIP Audio module for 3D positional sound ๐Ÿ”‰

Integrations

Name Status Description
react-whs react-whs-npm Integration with ReactJS

Backers

Support us with a monthly donation and help us continue framework development๐ŸŽ‰ and adding new features๐Ÿ’ก๐ŸŽ.

Sponsors

Become a sponsor and get your logo on on our README on Github with a link to your website๐Ÿ”ญ.

Sponsors

forthebadge

whitestorm.js's People

Contributors

bdirl avatar brunocascio avatar electron0zero avatar hirako2000 avatar jackdalton avatar jackdalton2 avatar jinksi avatar jule- avatar noctisdark avatar preco21 avatar ryanguest avatar sasha240100 avatar t4r0 avatar taro-0 avatar thejmazz avatar timoxley avatar tyliec avatar typedef42 avatar utrobin avatar yeliex avatar zlatanvasovic avatar

Watchers

 avatar  avatar

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.