JSFiddle - React, Tailwind, and code Playground

JavaScript

var camera, scene, renderer;
var torus, cylinder;

init();
animate();

function init()
{
	// Create scene
	scene = new THREE.Scene();
  
  // Scene background
  {
  	const loader = new THREE.TextureLoader();
  	const bgTexture = loader.load('https://threejsfundamentals.org/threejs/resources/images/daikanyama.jpg');
  	scene.background = bgTexture;
  }
  
  // Light
  {
    const color = 0xFFFFFF;
    const intensity = 1;
    const light = new THREE.DirectionalLight(color, intensity);
    light.position.set(-1, 2, 4);
    scene.add(light);
  }

	// Create camera
	camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000);
	camera.position.z = 500;
  scene.add(camera);
  
	// Create renderer
  renderer = new THREE.WebGLRenderer();
  renderer.setSize(window.innerWidth, window.innerHeight);
  
  // Create torus
  {
  	const geometry = new THREE.TorusGeometry( 100, 25, 16, 100 );
		const material = new THREE.MeshPhongMaterial( { color: 0x0000ff } );
		torus = new THREE.Mesh(geometry, material);
  }
  
  // Create cylinder
  {
  	const geometry = new THREE.CylinderGeometry( 65, 65, 200, 32 );
		const material = new THREE.MeshPhongMaterial( { color: 0xff0000 } );
		cylinder = new THREE.Mesh(geometry, material);
    cylinder.rotation.x = Math.PI / 2;
  }
  
  // Create torus & cylinder group
  {
  	group = new THREE.Group();
    group.add(torus);
    group.add(cylinder);
    
    scene.add(group);
  }

  // Insert into DOM
  document.body.appendChild(renderer.domElement);
}

function animate()
{

    requestAnimationFrame(animate);
    render();

}

function render()
{

    group.rotation.x += 0.01;
    group.rotation.y += 0.02;

    renderer.render(scene, camera);

}