Skip to content
forked from pixijs/pixijs

The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.

License

Notifications You must be signed in to change notification settings

rafalou38/pixijs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This fork contains pre compiled pixi.js package without exports in package.json, I made it to use pixi.js with sveltekit

usage:

// use this
import * as PIXI from 'pixi.js/dist/cjs/pixi.js';
// and not this
import * as PIXI from 'pixi.js';

types:

// app.d.ts
declare module 'pixi.js/dist/cjs/pixi.js' {
	export * from 'pixi.js';
}

PixiJS — The HTML5 Creation Engine

pixi.js logo

The aim of this project is to provide a fast lightweight 2D library that works across all devices. The PixiJS renderer allows everyone to enjoy the power of hardware acceleration without prior knowledge of WebGL. Also, it's fast. Really fast.

Your support helps us make PixiJS even better. Make your pledge on Patreon and we'll love you forever!

Setup

PixiJS can be installed with npm to integration with Webpack, Browserify, Rollup, Electron, NW.js or other module backed environments.

Install

npm install pixi.js

There is no default export. The correct way to import PixiJS is:

import * as PIXI from 'pixi.js'

Basic Usage Example

// The application will create a renderer using WebGL, if possible,
// with a fallback to a canvas render. It will also setup the ticker
// and the root stage PIXI.Container.
const app = new PIXI.Application();

// The application will create a canvas element for you that you
// can then insert into the DOM.
document.body.appendChild(app.view);

// load the texture we need
app.loader.add('bunny', 'bunny.png').load((loader, resources) => {

    // This creates a texture from a 'bunny.png' image.
    const bunny = new PIXI.Sprite(resources.bunny.texture);

    // 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;
    });
});

License

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

Analytics

About

The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.

Resources

License

Stars

Watchers

Forks

Packages

No packages published