@citizenfx/three

中文文档
0.100.0发布于 2019/01/15MITESM + CJS零依赖近 30 天下载 1.2万

JavaScript 3D library

原始使用文档

three.js

NPM package Build Size Build Status Dependencies Dev Dependencies Language Grade

JavaScript 3D library

The aim of the project is to create an easy to use, lightweight, 3D library. The library provides Canvas 2D, SVG, CSS3D and WebGL renderers.

Examples — Documentation — Wiki — Migrating — Questions — Forum — Gitter — Slack

Usage

Download the minified library and include it in your HTML, or install and import it as a module, Alternatively see how to build the library yourself.

<script src="js/three.min.js"></script>

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.

var camera, scene, renderer;
var geometry, material, mesh;

init();
animate();

function init() {

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

    scene = new THREE.Scene();

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

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

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

}

function animate() {

    requestAnimationFrame( animate );

    mesh.rotation.x += 0.01;
    mesh.rotation.y += 0.02;

    renderer.render( scene, camera );

}

If everything went well you should see this.

Change log

Releases

版本与发布记录

@citizenfx/three 共发布 1 个版本,首次发布于 2019/01/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.100.0latest2019/01/157 年前

关于 @citizenfx/three 的常见问题

@citizenfx/three 是什么?

JavaScript 3D library

如何安装 @citizenfx/three?

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

@citizenfx/three 支持 TypeScript 吗?

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

@citizenfx/three 支持 ESM 还是 CommonJS?

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

@citizenfx/three 可以商用吗?

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

@citizenfx/three 的下载量有多少?

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

@citizenfx/three 还在维护吗?

最新版本 0.100.0 发布于 2019/01/15(7 年前);至今共发布 1 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/01/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。