forked from pixijs/pixijs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
147 changed files
with
6,975 additions
and
6,763 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2013-2018 Mathew Groves, Chad Engler | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# @pixi/node | ||
|
||
**We are now a part of the [Open Collective](https://opencollective.com/pixijs) 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!** | ||
|
||
<div align="center"> | ||
<a href="https://opencollective.com/pixijs/donate" target="_blank"> | ||
<img src="https://opencollective.com/pixijs/donate/button@2x.png?color=blue" width=250 /> | ||
</a> | ||
</div> | ||
|
||
## Setup | ||
|
||
### Install | ||
|
||
``` | ||
npm install @pixi/node | ||
``` | ||
|
||
There is no default export. The correct way to import PixiJS is: | ||
|
||
```js | ||
import * as PIXI from "@pixi/node"; | ||
``` | ||
|
||
### Error installing canvas package | ||
|
||
The [canvas](https://www.npmjs.com/package/canvas) library currently being used does not have a pre-built version for every environment. | ||
When the package detects an unsupported environment, it will try to build from source. | ||
|
||
To build from source you will need to make sure you have the following dependencies installed and then reinstall: | ||
|
||
`brew install pkg-config cairo pango libpng jpeg giflib librsvg` | ||
|
||
## Basic Usage Example | ||
|
||
```js | ||
import { Application, Sprite, Assets } from '@pixi/node'; | ||
import path from 'path'; | ||
import { writeFileSync } from 'fs'; | ||
|
||
// This package requires the new asset loader to be used. | ||
// Initialize the new assets loader | ||
await Assets.init(); | ||
|
||
// The application will create a renderer using WebGL. It will also setup the ticker | ||
// and the root stage Container. | ||
const app = new Application(); | ||
|
||
// load a sprite | ||
const bunnyTexture = await Assets.load(path.join(process.cwd(), 'assets/bunny.png')); | ||
// create sprite from texture | ||
const bunny = Sprite.from(bunnyTexture); | ||
|
||
// Setup the position of the bunny | ||
bunny.x = app.renderer.width / 2; | ||
bunny.y = app.renderer.height / 2; | ||
|
||
// Rotate around the center | ||
bunny.anchor.x = 0.5; | ||
bunny.anchor.y = 0.5; | ||
|
||
// Add the bunny to the scene we are building. | ||
app.stage.addChild(bunny); | ||
|
||
// Listen for frame updates | ||
app.ticker.add(() => { | ||
// each frame we spin the bunny around a bit | ||
bunny.rotation += 0.01; | ||
}); | ||
|
||
// extract and save the stage | ||
app.renderer.render(app.stage); | ||
const base64Image = app.renderer.plugins.extract | ||
.canvas(app.stage) | ||
.toDataURL('image/png'); | ||
|
||
const base64Data = base64Image.replace(/^data:image\/png;base64,/, ''); | ||
const output = `./test.png`; | ||
|
||
writeFileSync(output, base64Data, 'base64'); | ||
``` | ||
|
||
### License | ||
|
||
This content is released under the (http://opensource.org/licenses/MIT) MIT License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"name": "@pixi/node", | ||
"version": "6.5.0", | ||
"description": "Bundle for PixiJS with support for NodeJS", | ||
"homepage": "http://pixijs.com/", | ||
"bugs": "https://github.com/pixijs/pixi.js/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/pixijs/pixi.js.git" | ||
}, | ||
"license": "MIT", | ||
"author": "PixiJS Team", | ||
"main": "dist/cjs/node.cjs", | ||
"module": "dist/esm/node.mjs", | ||
"types": "index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./index.d.ts", | ||
"default": "./dist/esm/node.mjs" | ||
}, | ||
"require": { | ||
"types": "./index.d.ts", | ||
"default": "./dist/cjs/node.cjs" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"*.d.ts" | ||
], | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"@pixi/app": "6.5.0", | ||
"@pixi/assets": "6.5.0", | ||
"@pixi/constants": "6.5.0", | ||
"@pixi/core": "6.5.0", | ||
"@pixi/display": "6.5.0", | ||
"@pixi/extract": "6.5.0", | ||
"@pixi/filter-alpha": "6.5.0", | ||
"@pixi/filter-blur": "6.5.0", | ||
"@pixi/filter-color-matrix": "6.5.0", | ||
"@pixi/filter-displacement": "6.5.0", | ||
"@pixi/filter-fxaa": "6.5.0", | ||
"@pixi/filter-noise": "6.5.0", | ||
"@pixi/graphics": "6.5.0", | ||
"@pixi/math": "6.5.0", | ||
"@pixi/mesh": "6.5.0", | ||
"@pixi/mesh-extras": "6.5.0", | ||
"@pixi/mixin-cache-as-bitmap": "6.5.0", | ||
"@pixi/mixin-get-child-by-name": "6.5.0", | ||
"@pixi/mixin-get-global-position": "6.5.0", | ||
"@pixi/particle-container": "6.5.0", | ||
"@pixi/prepare": "6.5.0", | ||
"@pixi/runner": "6.5.0", | ||
"@pixi/settings": "6.5.0", | ||
"@pixi/sprite": "6.5.0", | ||
"@pixi/sprite-animated": "6.5.0", | ||
"@pixi/sprite-tiling": "6.5.0", | ||
"@pixi/spritesheet": "6.5.0", | ||
"@pixi/text": "6.5.0", | ||
"@pixi/text-bitmap": "6.5.0", | ||
"@pixi/ticker": "6.5.0", | ||
"@pixi/utils": "6.5.0", | ||
"@types/gl": "^4.1.0", | ||
"@types/xml2js": "^0.4.11", | ||
"canvas": "^2.9.1", | ||
"cross-fetch": "^3.1.5", | ||
"gl": "^5.0.0", | ||
"xml2js": "^0.4.23" | ||
}, | ||
"nodeDependencies": [ | ||
"fs", | ||
"path" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"transpile": "es6" | ||
} |
Oops, something went wrong.