# @barvynkoa/particle-emitter 中文文档

规范地址：https://npmcn.com/package/%40barvynkoa/particle-emitter/

版本：0\.0\.1
npm 元数据更新时间：2024-05-27T12:29:36.252Z
中文译文更新时间：2026-11-07T17:21:14.650Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40barvynkoa/particle-emitter
原文对照：https://npmcn.com/package/%40barvynkoa/particle-emitter/?lang=original
项目主页：https://github.com/andriibarvynko/particle-emitter#readme
源码仓库：https://github.com/andriibarvynko/particle-emitter

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：573 kB，66 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：pixi\.js \>=6\.0\.4 \<9\.0\.0
- 首次发布：2024-05-27T12:29:35.729Z
- 最新版本发布：2024-05-27T12:29:35.985Z
- 近 30 天下载量：28892（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：1（近 12 个月 0 个）

## 中文简介

\[叉 为 Pixi.js 发射粒子

## 安装

```sh
npm install @barvynkoa/particle-emitter
```

也可以使用：`pnpm add @barvynkoa/particle-emitter`、`yarn add @barvynkoa/particle-emitter`、`bun add @barvynkoa/particle-emitter`

## README

# PixiJS 粒子喷出器

[![Build Status](https://github.com/pixijs/particle-emitter/workflows/Build/badge.svg)](https://github.com/pixijs/particle-emitter/actions?query=workflow%3A%22Build%22) [![GitHub version](https://badge.fury.io/gh/pixijs%2Fparticle-emitter.svg)](https://github.com/pixijs/particle-emitter/releases/latest)

用于 [皮克西杰斯语Name](https://github.com/pixijs/pixi.js) 图书馆。 而且,我们创造了一个 [交互式粒子编辑器](http://pixijs.github.io/pixi-particles-editor/) 用于设计和预览自定义的粒子发射器,该粒子发射器可使 PixiJS 粒子发射器实用化。 请注意,编辑器是为一个更古老的版本的库而建的 - 要使用它的输出,您必须使用 [`upgradeConfig()`](https://pixijs.github.io/particle-emitter/docs/modules.html#upgradeConfig) 函数.

## 从 v5 中突破 v6 的更改

-   `pixi.js` 更新到 v8
-   现在所有从 “ pixi.js ” 导入, 它都是向后兼容的, 但最好用于 pixi.js < v8
-   emitter 的更新方法现在有类型参数: 编号 QQ 计票器
-   删除了 LinkedListContainer(目前,正在开发中)
-   粒子性能实例现在不起作用, 因为无法使用 LinkedListContainer
-   更新到较新版本的依赖性(例如现在的打字版本为^ 5.0.4)
-   实例更新到 `pixi.js` 页:1

## 从 v4 中突破 v5 的更改

-   项目改名为 `pixi-particles` 改为 `@pixi/particle-emitter`
-   打开 `Emitter`,配置格式发生了急剧变化。 使用 [`upgradeConfig()`](https://pixijs.github.io/particle-emitter/docs/modules.html#upgradeConfig) 以自动转换旧的配置对象.
-   `PathParticle` 财务报告和审定财务报表 `AnimatedParticle` 不再存在 改用新行为.
-   PixiJS v4. 请使用 v6 - 而 v5 可能会起作用, Typescription 定义不会起作用, 并且会导致你头痛 .
-   图书馆现在输出ES6代码 - 如果你需要它在ES5代码中,你需要确保你的构建过程转接它.

## 样本使用

请参看各种预制出粒子配置的示例.

```js
// Create a new emitter
// note: if importing library like "import * as particles from '@pixi/particle-emitter'"
// or "const particles = require('@pixi/particle-emitter')", the PIXI namespace will
// not be modified, and may not exist - use "new particles.Emitter()", or whatever
// your imported namespace is
var emitter = new PIXI.particles.Emitter(

    // The PIXI.Container to put the emitter in
    // if using blend modes, it's important to put this
    // on top of a bitmap, and not use the root stage Container
    container,
    // Emitter configuration, edit this to change the look
    // of the emitter
    {
        lifetime: {
            min: 0.5,
            max: 0.5
        },
        frequency: 0.008,
        spawnChance: 1,
        particlesPerWave: 1,
        emitterLifetime: 0.31,
        maxParticles: 1000,
        pos: {
            x: 0,
            y: 0
        },
        addAtBack: false,
        behaviors: [
            {
                type: 'alpha',
                config: {
                    alpha: {
                        list: [
                            {
                                value: 0.8,
                                time: 0
                            },
                            {
                                value: 0.1,
                                time: 1
                            }
                        ],
                    },
                }
            },
            {
                type: 'scale',
                config: {
                    scale: {
                        list: [
                            {
                                value: 1,
                                time: 0
                            },
                            {
                                value: 0.3,
                                time: 1
                            }
                        ],
                    },
                }
            },
            {
                type: 'color',
                config: {
                    color: {
                        list: [
                            {
                                value: "fb1010",
                                time: 0
                            },
                            {
                                value: "f5b830",
                                time: 1
                            }
                        ],
                    },
                }
            },
            {
                type: 'moveSpeed',
                config: {
                    speed: {
                        list: [
                            {
                                value: 200,
                                time: 0
                            },
                            {
                                value: 100,
                                time: 1
                            }
                        ],
                        isStepped: false
                    },
                }
            },
            {
                type: 'rotationStatic',
                config: {
                    min: 0,
                    max: 360
                }
            },
            {
                type: 'spawnShape',
                config: {
                    type: 'torus',
                    data: {
                        x: 0,
                        y: 0,
                        radius: 10
                    }
                }
            },
            {
                type: 'textureSingle',
                config: {
                    texture: PIXI.Texture.from('image.jpg')
                }
            }
        ],
    }
);

// Calculate the current time
var elapsed = Date.now();

// Update function every frame
var update = function(){

    // Update the next frame
    requestAnimationFrame(update);

    var now = Date.now();

    // The emitter requires the elapsed
    // number of seconds since the last update
    emitter.update((now - elapsed) * 0.001);
    elapsed = now;
};

// Start emitting
emitter.emit = true;

// Start the update
update();
```

## 文档

[http://pixijs.github.io/粒子-emitter/docs/ 互联网档案馆的存檔,存档日期2013-12-21](http://pixijs.github.io/particle-emitter/docs/)

## 安装

PixiJS 粒子放送器可以安装在国家预防机制或其他软件包管理器中.

```bash
npm install @pixi/particle-emitter
```

## 实例

-   [爆炸 1](https://pixijs.github.io/particle-emitter/examples/explosion.html)
-   [爆炸2](https://pixijs.github.io/particle-emitter/examples/explosion2.html)
-   [爆炸 3](https://pixijs.github.io/particle-emitter/examples/explosion3.html)
-   [爆炸环](https://pixijs.github.io/particle-emitter/examples/explosionRing.html)
-   [巨魔死亡事件](https://pixijs.github.io/particle-emitter/examples/megamanDeath.html)
-   [雨声](https://pixijs.github.io/particle-emitter/examples/rain.html)
-   [火焰](https://pixijs.github.io/particle-emitter/examples/flame.html)
-   [多边形链上的火焰](https://pixijs.github.io/particle-emitter/examples/flamePolygonal.html)
-   [高级多边形链上的火焰](https://pixijs.github.io/particle-emitter/examples/flamePolygonalAdv.html)
-   [火焰 - 有步骤的颜色](https://pixijs.github.io/particle-emitter/examples/flameStepped.html)
-   [有烟的火焰](https://pixijs.github.io/particle-emitter/examples/flameAndSmoke.html)
-   [火焰 - 喷出](https://pixijs.github.io/particle-emitter/examples/flameUneven.html)
-   [天然气](https://pixijs.github.io/particle-emitter/examples/gas.html)
-   [烟泡](https://pixijs.github.io/particle-emitter/examples/bubbles.html)
-   [泡泡喷出](https://pixijs.github.io/particle-emitter/examples/bubbleSpray.html)
-   [泡泡流线](https://pixijs.github.io/particle-emitter/examples/bubbleStream.html)
-   [泡泡流 - 跟踪路径](https://pixijs.github.io/particle-emitter/examples/bubbleStreamPath.html)
-   [垂直泡泡](https://pixijs.github.io/particle-emitter/examples/bubblesVertical.html)
-   [卡通烟](https://pixijs.github.io/particle-emitter/examples/cartoonSmoke.html)
-   [卡通烟台.](https://pixijs.github.io/particle-emitter/examples/cartoonSmoke2.html)
-   [卡通烟花](https://pixijs.github.io/particle-emitter/examples/cartoonSmokeBlast.html)
-   [雪](https://pixijs.github.io/particle-emitter/examples/snow.html)
-   [闪光点](https://pixijs.github.io/particle-emitter/examples/sparks.html)
-   [喷泉](https://pixijs.github.io/particle-emitter/examples/fountain.html)
-   [动画 Coins](https://pixijs.github.io/particle-emitter/examples/coins.html)
-   [动画泡泡](https://pixijs.github.io/particle-emitter/examples/animatedBubbles.html)
-   [宇宙飞船销毁 -- -- 有秩序的艺术](https://pixijs.github.io/particle-emitter/examples/spaceshipDestruction.html)
-   [颗粒容器性能](https://pixijs.github.io/particle-emitter/examples/particleContainerPerformance.html)

## 贡献者说明

这个项目使用 `yarn` 而不是说 `npm` 利用试验工作空间的特点,使在可能情况下有分享依赖关系的独立试验更加容易.

## 许可证

版权(c)2015年 [云宝宝](http://github.com/cloudkidstudio)

根据麻省理工学院的许可获释.

## 常见问题

### @barvynkoa/particle-emitter 是什么？

\[叉 为 Pixi\.js 发射粒子

### 如何安装 @barvynkoa/particle-emitter？

在项目目录运行 npm install @barvynkoa/particle-emitter，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：pixi\.js（\>=6\.0\.4 \<9\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @barvynkoa/particle-emitter 支持 TypeScript 吗？

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

### @barvynkoa/particle-emitter 支持 ESM 还是 CommonJS？

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

### @barvynkoa/particle-emitter 可以商用吗？

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

### @barvynkoa/particle-emitter 的下载量有多少？

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

### @barvynkoa/particle-emitter 还在维护吗？

最新版本 0\.0\.1 发布于 2024/05/27（2 年前）；至今共发布 1 个版本，其中过去 12 个月发布了 0 个；首次发布于 2024/05/27。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

