Getting started
Installation
Install pixi-silk with npm, pnpm, yarn or bun next to pixi.js v8. It needs WebGL2 and ships tree-shakeable ESM with TypeScript types, about 15 kB gzipped.
Updated pixi-silk 0.1.0
pixi-silk is on npm. Its one peer dependency is pixi.js version 8.
npm install pixi-silk pixi.js
pnpm add pixi-silk pixi.js
yarn add pixi-silk pixi.js
bun add pixi-silk pixi.js
Import#
Import everything from the package root. The package is ESM only, with one file per module and
TypeScript declarations. CommonJS code can still require() it on Node 20.19+ and 22.12+. Your
bundler keeps only what you import, because the package is side-effect free. SilkGraphics with
its shader is about 15 kB gzipped. The motion helpers alone are under 0.5 kB.
import { createSilkApp, SilkGraphics, linear, conic } from 'pixi-silk';
Requirements#
- PixiJS 8.6 or newer.
pixi.jsis a peer dependency, so your app owns the renderer. - WebGL2, which every current browser supports. The WebGPU renderer is not supported yet. Create
your application with
preference: 'webgl'.createSilkAppdoes this for you. - Any bundler that understands ES modules (Vite, webpack, Rollup, esbuild, Parcel), or a
<script type="module">with an import map.
Without a bundler#
<script type="importmap">
{ "imports": {
"pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.min.mjs",
"pixi-silk": "https://cdn.jsdelivr.net/npm/pixi-silk/dist/index.js"
} }
</script>
<script type="module">
import { createSilkApp, SilkGraphics } from 'pixi-silk';
</script>
Next, read the quick start.