Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pixi.js

Package Overview
Dependencies
Maintainers
2
Versions
419
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixi.js

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

  • 4.8.9
  • legacy
  • latest-4.x
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58K
decreased by-61.56%
Maintainers
2
Weekly downloads
 
Created

What is pixi.js?

Pixi.js is a fast 2D rendering engine that uses WebGL and HTML5 Canvas to create interactive graphics and animations. It is widely used for creating games, interactive applications, and other visual content on the web.

What are pixi.js's main functionalities?

Creating a Basic Application

This code initializes a new Pixi.js application with a specified width and height, and appends the canvas element to the document body.

const app = new PIXI.Application({ width: 800, height: 600 });
document.body.appendChild(app.view);

Loading and Displaying a Sprite

This code loads an image and creates a sprite from it. The sprite is then positioned at the center of the canvas and added to the stage.

PIXI.Loader.shared.add('bunny', 'path/to/bunny.png').load((loader, resources) => {
  const bunny = new PIXI.Sprite(resources.bunny.texture);
  bunny.x = app.renderer.width / 2;
  bunny.y = app.renderer.height / 2;
  bunny.anchor.set(0.5);
  app.stage.addChild(bunny);
});

Animating a Sprite

This code adds an animation loop that rotates the sprite continuously. The `delta` parameter ensures smooth animation regardless of the frame rate.

app.ticker.add((delta) => {
  bunny.rotation += 0.1 * delta;
});

Creating Graphics

This code creates a new graphics object, draws a filled rectangle, and adds it to the stage.

const graphics = new PIXI.Graphics();
graphics.beginFill(0xDE3249);
graphics.drawRect(50, 50, 100, 100);
graphics.endFill();
app.stage.addChild(graphics);

Other packages similar to pixi.js

FAQs

Package last updated on 16 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc