
Security News
Next.js Patches Critical Middleware Vulnerability (CVE-2025-29927)
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
@types/three
Advanced tools
@types/three provides TypeScript type definitions for the three.js library, which is a popular JavaScript library used to create and display animated 3D computer graphics in a web browser using WebGL.
Creating a Scene
This code demonstrates how to create a new scene in three.js. A scene is the container for all the objects, lights, and cameras in your 3D world.
const scene: THREE.Scene = new THREE.Scene();
Adding a Camera
This code shows how to create a perspective camera, which simulates the way the human eye sees. The parameters define the field of view, aspect ratio, near clipping plane, and far clipping plane.
const camera: THREE.PerspectiveCamera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
Creating a Renderer
This code demonstrates how to create a WebGL renderer, set its size, and append it to the DOM. The renderer is responsible for rendering the scene from the perspective of the camera.
const renderer: THREE.WebGLRenderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement);
Adding a Mesh
This code shows how to create a simple cube mesh with a basic material and add it to the scene. A mesh is an object that takes a geometry and applies a material to it, which can then be added to the scene.
const geometry: THREE.BoxGeometry = new THREE.BoxGeometry(); const material: THREE.MeshBasicMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); const cube: THREE.Mesh = new THREE.Mesh(geometry, material); scene.add(cube);
Animating the Scene
This code demonstrates how to create an animation loop that continuously renders the scene. The cube is rotated slightly on each frame, creating an animation effect.
function animate() { requestAnimationFrame(animate); cube.rotation.x += 0.01; cube.rotation.y += 0.01; renderer.render(scene, camera); } animate();
Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework. It provides similar functionalities to three.js but also includes a more extensive set of features for game development.
A-Frame is a web framework for building virtual reality experiences. It is built on top of three.js and provides an easy-to-use, declarative HTML-like syntax for creating 3D and VR scenes.
PlayCanvas is an open-source game engine that provides a comprehensive set of tools for building 3D web applications. It offers a visual development environment and is known for its performance and ease of use.
npm install --save @types/three
This package contains type definitions for three.js (https://threejs.org).
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/three
Additional Details
These definitions were written by Kon http://phyzkit.net/, Satoru Kimura https://github.com/gyohk, Florent Poujol https://github.com/florentpoujol, SereznoKot https://github.com/SereznoKot, HouChunlei https://github.com/omni360, Ivo https://github.com/ivoisbelongtous, David Asmuth https://github.com/piranha771, Brandon Roberge, Qinsi ZHU https://github.com/qszhusightp, Toshiya Nakakura https://github.com/nakakura, Poul Kjeldager Sørensen https://github.com/s093294, Stefan Profanter https://github.com/Pro, Edmund Fokschaner https://github.com/efokschaner, Roelof Jooste https://github.com/PsychoSTS, Daniel Hritzkiv https://github.com/dhritzkiv, Apurva Ojas https://github.com/apurvaojas.
FAQs
TypeScript definitions for three
The npm package @types/three receives a total of 550,228 weekly downloads. As such, @types/three popularity was classified as popular.
We found that @types/three demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.