Skip to content
项目

关于

Commonly used UI components for PixiJS

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
+1
15天
+2
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

It is a library that contains commonly used UI components, that are extensible to allow them to be used in any project

Here are some useful resources:

We are now a part of the Open Collective and with your support you can help us make PixiJS even better. To make a donation, simply click the button below and we'll love you forever!

Compatibility

Depending on your version of PixiJS, you'll need to figure out which major version of PixiUI to use.

PixiJS PixiUI
v7.x v1.x
v8.x v2.x

Install

npm install @pixi/ui

There is no default export. The correct way to import pixi-ui is:

Usage

import { Button } from '@pixi/ui';

const button = new Button();

button.onPress.connect(() => console.log('Button pressed!'));

Importing a single component

The package is side-effect free ("sideEffects": false), so a bundler only includes the components you actually import from @pixi/ui. You can also import a component from its own entry point:

import { Button } from '@pixi/ui/Button';
import { ScrollBox } from '@pixi/ui/ScrollBox';
import { Input } from '@pixi/ui/input';
import { Signal } from '@pixi/ui/utils/Signal';

Subpath imports need a module resolution that understands package exports (node16, nodenext or bundler in TypeScript). With the legacy node (node10) resolution, import from @pixi/ui instead.

Without a bundler

Every component is a separate ES module, so a browser can load just the ones you need with an import map:

<script type="importmap">
    {
        "imports": {
            "pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.min.mjs",
            "tweedle.js": "https://cdn.jsdelivr.net/npm/tweedle.js@2/dist/tweedle.es.js",
            "@pixi/ui/": "https://cdn.jsdelivr.net/npm/@pixi/ui@2/lib/"
        }
    }
</script>
<script type="module">
    import { Input } from '@pixi/ui/input/Input.mjs';
</script>

For a classic <script> tag, dist/pixi-ui.js contains the whole library and only needs the PIXI global.

To use any of the components you can go to it's page in the sandbox, and copy/paste the example code to your project (check the Code tab):

Components

Contribute

Want to be part of the PixiUI project? Great! All are welcome! We will get there quicker together :) Whether you find a bug, have a great feature request, or you fancy owning a task from the road map above, feel free to get in touch.

Make sure to read the Contributing Guide before submitting changes.

License

This content is released under the (http://opensource.org/licenses/MIT) MIT License.

Known Issues

This library requires Pixi v7.1.1 or higher as this is when the globalpointermove event was added See here for details

探索相关项目

加载中…