console
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(90, innerWidth / innerHeight, 1, 1000);
camera.position.set(0, 6, 6);
scene.add(camera)
const renderer = new THREE.WebGLRenderer();
renderer.setSize(innerWidth, innerHeight);
renderer.setClearColor(0x000000)
document.body.appendChild(renderer.domElement)
const cubeGeometry = new THREE.BoxGeometry(1, 1, 1);
const cubeMaterial = new THREE.MeshStandardMaterial({ color: 0xa50000 });
const cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
cube.position.set(0, 0, 0);
scene.add(cube);
const sphereGeometry = new THREE.SphereGeometry(0.5, 36, 36);
const sphereMaterial = new THREE.MeshStandardMaterial({ color: 0x009494 });
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
sphere.position.set(-2, 0, 0);
scene.add(sphere);
const planeGeometry = new THREE.PlaneGeometry(10, 10);
const planeMaterial = new THREE.MeshStandardMaterial({ color: 0xffffff, side: THREE.DoubleSide });
const plane = new THREE.Mesh(planeGeometry, planeMaterial);
plane.position.set(0, -1);
plane.rotateX(Math.PI / 2);
scene.add(plane);
const ambientLight = new THREE.AmbientLight(0xffffff);
scene.add(ambientLight)
const controls = new THREE.OrbitControls(camera, renderer.domElement);
function render() {
requestAnimationFrame(render);
renderer.render(scene, camera);
}
render()
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body style="margin:0;">
</body>
</html>