JSFiddle - React, Tailwind, and code Playground
CSS
html, body, canvas {
padding: 0;
margin: 0;
}
canvas {
width: 100%;
height: 100%;
}
JavaScript
var shape = [ 'SphereGeometry', [7, 16, 16] ];
// var shape = new THREE[shape[0]].apply( shape[1] );
function build() {
return THREE[shape[0]].apply(this, shape[1]);
}
build.prototype = THREE[shape[0]].prototype;
var shape = new build();
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor(0x333333)
document.body.appendChild( renderer.domElement );
var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
var sphere = new THREE.Mesh( shape, material );
scene.add( sphere );
camera.position.z = 35;
function render() {
requestAnimationFrame(render);
renderer.render(scene, camera);
}
render();