All Projects → spacejack → three-mithril-ts

spacejack / three-mithril-ts

Licence: other
THREE.js, Mithril.js, TypeScript starter project

Programming Languages

typescript
32286 projects
CSS
56736 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to three-mithril-ts

PolyDraw
✳️ PTSource PolyDraw is a free 3D polygonal modeller for Windows x86 and x64, for creating or modifying 3D objects using a mesh of 3D points and parametric NURBS Curves .Exports and imports to over 40 formats including WebVR and 3D Printing.
Stars: ✭ 17 (-50%)
Mutual labels:  threejs
DepthKit-A-Frame
🎥 An A-Frame component for rendering DepthKit volumetric videos in WebVR
Stars: ✭ 34 (+0%)
Mutual labels:  threejs
gamedex
👾 The code for my game dev + computer graphics experiments on YouTube.
Stars: ✭ 165 (+385.29%)
Mutual labels:  threejs
blockcraft-public
BlockCraft is a WebGL implementation of an infinite procedurally-generated voxel world that runs on the browser. This project originally spawned as a Minecraft Classic clone but has expanded to include multiplayer PvP, crafting, shaders and much more!
Stars: ✭ 22 (-35.29%)
Mutual labels:  threejs
frontend-park
哈喽大家好~我是荣顶!这是一个有趣的前端趣味知识公园~该项目是我平时捣鼓前端相关技术的一些案例集合。
Stars: ✭ 66 (+94.12%)
Mutual labels:  threejs
react-with-threejs-example
An example project integrating React with three.js
Stars: ✭ 27 (-20.59%)
Mutual labels:  threejs
TouchControls
This is a three.js controller which supports touch events and hit-testing.
Stars: ✭ 43 (+26.47%)
Mutual labels:  threejs
WebGL-Billiards
ThreeJS based 8-ball pool
Stars: ✭ 28 (-17.65%)
Mutual labels:  threejs
three-vue-pattern
A biofeedback visualization made with Three.js, Vue, and LUIS (cognitive services), made with Brian Holt
Stars: ✭ 97 (+185.29%)
Mutual labels:  threejs
three-strip
Generate strip geometry for three.js. Supports taper, twist, dasharray and uvgen.
Stars: ✭ 15 (-55.88%)
Mutual labels:  threejs
cuber
优美而强大的网页魔方
Stars: ✭ 32 (-5.88%)
Mutual labels:  threejs
building-editor
3D model editor for building/architecture
Stars: ✭ 24 (-29.41%)
Mutual labels:  threejs
icosa-viewer
3D Viewer component for Tilt Brush / Open Brush, Google Blocks files and their derivatives
Stars: ✭ 24 (-29.41%)
Mutual labels:  threejs
gl-bench
⏱ WebGL performance monitor with CPU/GPU load.
Stars: ✭ 146 (+329.41%)
Mutual labels:  threejs
home
Community for parametric furniture designs.
Stars: ✭ 44 (+29.41%)
Mutual labels:  threejs
zeo
Multiplayer WebVR worlds made out of npm modules.
Stars: ✭ 47 (+38.24%)
Mutual labels:  threejs
racing-game-cljs
A 3D racing game built with ClojureScript, React and ThreeJS
Stars: ✭ 209 (+514.71%)
Mutual labels:  threejs
Photo-Sphere-Viewer
A JavaScript library to display Photo Sphere panoramas.
Stars: ✭ 1,198 (+3423.53%)
Mutual labels:  threejs
Big-Data-Demo
基于Vue、three.js、echarts,数据可视化展示项目,包含三维模型导入交互、三维模型标注等功能
Stars: ✭ 146 (+329.41%)
Mutual labels:  threejs
codrops-texture-projection
Article about Texture Projection in Three.js
Stars: ✭ 75 (+120.59%)
Mutual labels:  threejs

THREE / Mithril / Typescript starter project

This is a somewhat opinionated, but hopefully open-ended starter project for web apps that have some combination of a canvas-based 3D scene and a DOM-based UI.

Online Demo

It leans heavily on THREE.js for 3D graphics and Mithril.js for a GUI framework and streams library.

It includes example techniques of mixing canvas and DOM elements, implementing a responsive layout and scalable 3D scene. And it shows how to use a canvas rendering engine alongside a virtual DOM library for UI.

Game architecture itself isn't really the focus here, but a servicable object-oriented skeleton is used for demonstration.

Install

npm install

Recommended VS Code extensions:

  • TSLint
  • stylelint
  • postcss-sugarss-language
  • EditorConfig

Compile-on-save ts and css files with source maps, start localhost server

Use this during development:

npm start

Then go to http://localhost:3000/ in your browser. Edits to source files will be automatically compiled on save and reloaded in the browser.

Compile minified JS and CSS

Use this to create deployable files in /public:

npm run build

Will output public/css/app.css, public/js/app.js and public/js/vendor.js bundles. You can then deploy the entire public folder to a web server.

Why

If you come from a game development background, then managing HTML layouts and working with modern web frameworks may be a bit foreign, or even a nuisance task.

If you come from building web apps and aren't accustomed to doing real-time graphics at 60FPS then some of those concepts may also be foreign to you.

I like to work in as minimalist a way as possible. But not so minimal to the point that it hinders productivity. This is a setup and a collection of technologies and tools I've found strike a nice balance for small-to-medium sized projects.

What follows is a list of libraries and tools used, and some brief rationales.

Libraries

Mithril

Though not a big player in the world of front-end frameworks, Mithril can compete with the best of them. It's a VDOM-based framework, like React or Vue. It's small, it requires no additional tooling to use effectively, and its design makes for extremely simple redraw management. It also has the most ergonomic hyperscript syntax I've seen. It comes with a router, HTTP request lib and a tiny streams lib, all of which gzip down to about 10kb. In my opinion it's a perfect fit for game development, whether you only have a thin layer of DOM UI or if your game is heavily DOM-based and full of CSS animations.

Perhaps most importantly, Mithril has no opinions on and makes no requirements of how you manage your application state. Mithril redraws are tied to events rather than state changes, which means working with Mithril is much more like rendering a game scene than other UI libraries. You can opt-in or opt-out of its auto-redraw mechanism entirely, or on an as-needed basis.

three.js

What can I say about this lib? The granddaddy of 3D libraries in the browser. It may be a bit on the heavy side but if you're going to be loading 3D meshes and textures, the size of the library will not likely be that siginificant. And even though it provides a relatively high-level API, it's still easy to get under the hood and control your rendering pipeline, write custom shaders or build your own vertex buffers. In terms of features, ongoing development and community, it has no real competition.

That said, if you prefer something else like PIXI for 2D, or a more barebones 3D library, it should be a straightforward replacement. Most graphics libraries simply need a canvas element to use as a render target.

Build Tools

Typescript

There are better articles out there to sell you on the value of static types but suffice it to say that Typescript is a compromise. Javascript is a deeply flawed language but at the same time you want as little friction as possible in order to leverage the wealth of available libraries. Adding static types is one of the easiest ways to catch errors early. They help navigate complex library APIs (like three.js) and make refactoring easy.

PostCSS

There are a wide range of CSS preprocessors and tools out there. PostCSS's autoprefixer is invaluable, and since auto-prefixing is my number one CSS processor feature, I may as well leverage this ecosystem. By limiting ourselves to a subset of PostCSS plugins, we're pretty much just writing modern-future CSS rather than a completely different language. Plus the compiler is super fast and easy to configure.

Browserify

It may seem a bit quaint and antique compared to Webpack these days, but Browserify is still vastly simpler to configure and maintain. It can do code splitting, hot module reloads, environment variables - pretty much everything I'd need from webpack. Why make things more complex than a few npm scripts?

Using the npm-run-all module allows us to create a set of simple scripts that do one thing, and then compose those into more complex scripts that can be run in sequence (run-s) or in parallel (run-p). npm-run-all allows us to write these kinds of scripts in a cross-platform friendly way.

Other bundling tools like Parcel may require zero configuration, but hide the inner workings. Using browserify everything is transparent and run via npm scripts. Rollup is another very nice bundling solution that focuses on optimized bundle sizes but as yet does not yet have any hot-reloading development tools.

Budo

Budo is to browserify as webpack-dev-server is to webpack. It sets up a local dev server with hot reloads for CSS and JS bundles, again with very simple configuration.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].