@box2d/core

中文文档
0.11.0发布于 2024/08/17MITTypeScriptCommonJS零依赖近 30 天下载 4765

A TypeScript port of Box2D

原始使用文档

@box2d/core

Box2D is a 2D physics engine for games.

@box2d/core is a TypeScript port of Erin Cattos Box2D. This is a fork of box2d.ts from Isaac Burns (flyover) who did a huge job initially porting Box2D and LiquidFun to TypeScript.

How to Use

Check out the documentation

The @box2d Ecosystem

@box2d is a full-blown ecosystem for box2d for the JavaScript/TypeScript world. It can be used both in the browser and in node.js

Check out demos and compare performance here: https://lusito.github.io/box2d.ts/

Fair Warning: The whole @box2d ecosystem is in an early stage, so it will probably change a lot before we release the first stable version (1.0.0).

Other packages included in the ecosystem:

  • Benchmark: Based on bench2d by joelgwebber
  • Controllers: From the LiquidFun project
  • Particles: Also from the LiquidFun project
  • Lights: ported from LibGDX
  • DebugDraw: Debug drawing using a canvas
  • Testbed: A set of demos, partially ports of the original projects, partially new ones.

Contributing

We're looking for contributors to make this the best place to start with box2d on the web. Check out the project page for more information: https://github.com/Lusito/box2d.ts

版本与发布记录

@box2d/core 共发布 9 个版本,首次发布于 2020/11/08;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.11.0latest2024/08/172 年前
0.10.02022/09/044 年前
0.9.22022/08/294 年前
0.9.02021/09/125 年前
0.8.02020/12/305 年前
0.7.52020/11/095 年前

关于 @box2d/core 的常见问题

@box2d/core 是什么?

A TypeScript port of Box2D

如何安装 @box2d/core?

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

@box2d/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@box2d/core 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@box2d/core 可以商用吗?

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

@box2d/core 的下载量有多少?

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

@box2d/core 还在维护吗?

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