JSFiddle - React, Tailwind, and code Playground

HTML

<!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/[email protected]/dist/es-module-shims.js"></script>
    
<script type="importmap">
	{
		"imports": {
			"three": "https://unpkg.com/three/build/three.module.js"
		}
	}
</script>

CSS

body {
	  margin: 0;
}

JavaScript

import * as THREE from 'three';

// init

const camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.01, 10 );
camera.position.z = 1;

const scene = new THREE.Scene();

const geometry = new THREE.BoxGeometry( 0.5, 0.5, 0.5 );
const material = new THREE.MeshBasicMaterial( { transparent: true } );
material.onBeforeCompile = function( my ) {
  my.fragmentShader = `void main() {
  	float bunny = gl_FragCoord.z / gl_FragCoord.w;
    float kitty = 1.0;
    if( bunny < 0.8 ) {
    	// make the transparency drop towards the camera
      kitty = bunny * 1.23;
    }
  	gl_FragColor = vec4( vec3( bunny ), kitty );
  }`;
};

//const mesh = new THREE.Mesh( geometry, material );
//scene.add( mesh );

let instancedMesh = new THREE.InstancedMesh( geometry, material, 1);

for (let i=0; i < 1; i++) {
  const dummy = new THREE.Object3D();
  //dummy.position.set(1.0 * (i+1), 0.0, 1.0 * (i+1));
  dummy.rotation.set(3, 2, 1);
  dummy.updateMatrix(true);
  instancedMesh.setMatrixAt(i, dummy.matrix.clone());
  instancedMesh.instanceMatrix.needsUpdate = true;
}
instancedMesh.material.transparent = true;
instancedMesh.material.needsUpdate = true;
scene.add( instancedMesh );


const backTemplate = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial );
for (let i = 0; i < 10; i++) {
	const back = backTemplate.clone();
  back.position.set(
  	2.7 * Math.sin( i * 0.62832 ), 0,
    2.7 * Math.cos( i * 0.62832 )
  );
  back.rotation.set( 1.2, 3.4, 5.6 );
  back.scale.set( 2, 2, 6 );
  scene.add( back );
}

const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setAnimationLoop( animation );
document.body.appendChild( renderer.domElement );

// animation

function animation( time ) {

	const a = time / 2000;
  camera.position.set(
  	Math.sin( a ), 0, Math.cos( a )
  );
  camera.lookAt( 0, 0, 0 );

	renderer.render( scene, camera );

}