@casual-simulation/three

中文文档
0.161.2发布于 2024/02/20MITESM + CJS零依赖近 30 天下载 8812

JavaScript 3D library - Optimized for CasualOS

此软件包已被标记为弃用

This version is broken. Use v0.140.3 instead

原始使用文档
文档目录3 节
  1. Usage
  2. Cloning this repository
  3. Change log

three.js but optimized for CasualOS

NPM Package Build Size NPM Downloads DeepScan Discord

JavaScript 3D library

The aim of the project is to create an easy-to-use, lightweight, cross-browser, general-purpose 3D library. The current builds only include a WebGL renderer but WebGPU (experimental), SVG and CSS3D renderers are also available as addons.

Examples — Docs — Manual — Wiki — Migrating — Questions — Forum — Discord

Usage

This code creates a scene, a camera, and a geometric cube, and it adds the cube to the scene. It then creates a WebGL renderer for the scene and camera, and it adds that viewport to the document.body element. Finally, it animates the cube within the scene for the camera.

import * as THREE from 'three';

const width = window.innerWidth, height = window.innerHeight;

// init

const camera = new THREE.PerspectiveCamera( 70, width / height, 0.01, 10 );
camera.position.z = 1;

const scene = new THREE.Scene();

const geometry = new THREE.BoxGeometry( 0.2, 0.2, 0.2 );
const material = new THREE.MeshNormalMaterial();

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

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

// animation

function animation( time ) {

    mesh.rotation.x = time / 2000;
    mesh.rotation.y = time / 1000;

    renderer.render( scene, camera );

}

If everything goes well, you should see this.

Cloning this repository

Cloning the repo with all its history results in a ~2 GB download. If you don't need the whole history you can use the depth parameter to significantly reduce download size.

git clone --depth=1 https://github.com/mrdoob/three.js.git

Change log

Releases

版本与发布记录

@casual-simulation/three 共发布 10 个版本,首次发布于 2021/02/27;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.161.2latest2024/02/202 年前
0.161.12024/02/202 年前
0.161.02024/02/202 年前
0.140.32022/05/244 年前
0.140.22022/05/244 年前
0.139.52022/04/264 年前

关于 @casual-simulation/three 的常见问题

@casual-simulation/three 是什么?

JavaScript 3D library - Optimized for CasualOS注意:该包已被作者标记为弃用——This version is broken. Use v0.140.3 instead

如何安装 @casual-simulation/three?

在项目目录运行 npm install @casual-simulation/three,或使用 pnpm add / yarn add / bun add。

@casual-simulation/three 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/casual-simulation__three 是否存在。

@casual-simulation/three 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@casual-simulation/three 可以商用吗?

@casual-simulation/three 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@casual-simulation/three 的下载量有多少?

根据 npm 官方下载统计,@casual-simulation/three 在 2026/10/09 – 2026/11/07 这 30 天内被下载 8,812 次,日均约 294 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@casual-simulation/three 还在维护吗?

最新版本 0.161.2 发布于 2024/02/20(2 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/02/27。作者已将其标记为弃用,新项目建议寻找替代方案。