Hi everybody,
I have followed a lot of tutorial and I would like to go deeper in ThreeJS. While learning, I would like to forget boilerplate code with : npm, webpack, parcels and things like these.
Then I’m trying to start a very simple project in localhost with just :
-
three.js downloaded
-
index.html
Only a link to stylesheet and 2 scripts :
script type=“module” src=“js/three.js”
script type=“module” src=“js/index.js” -
index.css
html, body
{
margin: 0;
padding: 0;
} -
index.js
let scene = new THREE.Scene()
scene.background = new THREE.Color(0xbfbfbf)// Camera
let camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight)
camera.position.set(1, 2, 6)// AxesHelper
const axesHelper = new THREE.AxesHelper(5)
scene.add(axesHelper)let renderer = new THREE.WebGLRenderer()
renderer.setSize(window.innerWidth, window.innerHeight)
document.body.appendChild(renderer.domElement) -
Project struture :
src
|-- css
…|-- index.css
|-- js
…|-- index.js
…|-- three.js // downloaded
|-- index.html
I use VSC with Live Server plugin. The result is a black screen.
Usually, I don’t have problems with coding, unless I start from scratch. I think I m missing something from the basics of front-end project, like ES6 module or something else.
Can someone tell me what is wrong in the project please ?
Thx