This repository has been archived on 2022-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
GeometryDash3D/js/main.js

30 lines
770 B
JavaScript
Raw Normal View History

2022-11-07 09:10:20 +01:00
window.addEventListener("load", () => main());
const main = () => {
2022-11-08 09:43:37 +01:00
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
2022-11-07 09:59:36 +01:00
2022-11-08 09:43:37 +01:00
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
2022-11-07 09:59:36 +01:00
2022-11-08 09:43:37 +01:00
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
camera.position.z = 5;
const animate = () => {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
animate();
2022-11-07 09:10:20 +01:00
};