anat / nuxt-threejs-starter-pack

Lighweight Nuxt/ThreeJS Starter Pack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lightweight Nuxt + Three.js boilerplate

Demo

Features

  • 🎈 Only 13 files (excluding .gitignore, assets and this file)

  • πŸ› Not another over configurated boilerplate ! It's just what you need to start you own project

  • πŸ“¦ Only small packages are included, if you don't need them, it's simple to erase them

  • 🎨 No UI framework added by default, you could add one depending on your needs : vue-bootstrap, vuetify, vue-material

Packages included :

  • eventemitter3 (minified : 1.1KB) : Event Emitter
  • tweenjs/tween.js (minified: 3.1KB) : TWEEN for animations
  • animate.css (minified: 5.2KB) : Fancy css animations
  • postprocessing (minified: 91.6KB, tree shakable) : Postprocessing library for THREE.js

Requirements

Scripts

  • npm run dev β€” Start the projet in development mode
  • npm run generate β€” Generate the static site ready for production (in ./dist)

In detail

  • Project is built on the assessment you need both "classic" web pages combined with pages that includes 3D
  • /components/Artwork/Engine.js contains all the basic Three.js logic : Scene, Renderer, Camera management
  • /components/Artwork/AssetManager.js is used to load assets in general (Textures, Models etc..)
  • There is a notion of "Component" (Unity 3D way) to separate logic for specific 3D elements :
    Each component has two methods :
    init() : Setup of elements inside the component
    update() : Called every frame
    You can find an example component here : /components/Artwork/CubeComponent.js

Hierarchy

.
β”œβ”€β”€ assets/css/main.scss      # main SCSS file
β”œβ”€β”€ components
β”‚   β”œβ”€β”€ Artwork  
β”‚   β”‚   β”œβ”€β”€ Artwork.vue       # Vue component for 3D content
β”‚   β”‚   β”œβ”€β”€ AssetManager.js   # Class in charge of asset loading
β”‚   β”‚   β”œβ”€β”€ CubeComponent.js  # Example 3D Component with init() & update() methods
β”‚   β”‚   β”œβ”€β”€ Engine.js         # Class in charge of Three.js core features
β”‚   β”‚   β”œβ”€β”€ Nav.js            # Vue component to control 3D scene
β”‚   └── Header.vue            # Vue component for all pages Header
β”œβ”€β”€ layouts/default.vue       # Layout shared by all pages
β”œβ”€β”€ pages
β”‚   β”œβ”€β”€ about.vue             # Page for demo "/about" route
β”‚   └── index.vue             # Home page
β”œβ”€β”€ static
β”‚   β”œβ”€β”€ assets                # Assets : Models & Textures needed by 3D
β”‚   └── images                # Image needed for web pages
β”œβ”€β”€ app.html                  # Skeleton of the page with static loader image
β”œβ”€β”€ nuxt.config.js            # Nuxt.js configuration file
└── package.json              # Node configuration file

Troubleshooting

Following error "PostCSS received undefined instead of CSS string at new Input" Can be resolved with this command :

npm rebuild node-sass

License

MIT

"Forest House" (https://skfb.ly/6QSKT) by peachyroyalty is licensed under Creative Commons Attribution-NonCommercial (http://creativecommons.org/licenses/by-nc/4.0/).

About

Lighweight Nuxt/ThreeJS Starter Pack

License:MIT License


Languages

Language:JavaScript 53.0%Language:Vue 39.8%Language:HTML 3.8%Language:SCSS 3.4%