Socket
Socket
Sign inDemoInstall

@pixi/display

Package Overview
Dependencies
0
Maintainers
2
Versions
119
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/display


Version published
Maintainers
2
Created

Package description

What is @pixi/display?

@pixi/display is a part of the PixiJS library, which is a fast 2D rendering engine for creating interactive graphics and animations. The @pixi/display package specifically handles the display hierarchy, allowing you to manage and render display objects such as sprites, containers, and graphics.

What are @pixi/display's main functionalities?

Creating a Container

A Container is a basic building block in PixiJS that can hold and manage multiple display objects. This code creates a new Container and adds it to the stage.

const app = new PIXI.Application();
document.body.appendChild(app.view);
const container = new PIXI.Container();
app.stage.addChild(container);

Adding a Sprite to a Container

Sprites are basic display objects that can be rendered. This code creates a Sprite from a texture and adds it to the previously created Container.

const texture = PIXI.Texture.from('path/to/image.png');
const sprite = new PIXI.Sprite(texture);
container.addChild(sprite);

Handling Interactivity

PixiJS allows you to make display objects interactive. This code makes a Sprite interactive and sets up an event listener for pointerdown events.

sprite.interactive = true;
sprite.buttonMode = true;
sprite.on('pointerdown', () => {
  console.log('Sprite clicked!');
});

Animating Display Objects

PixiJS provides a ticker that can be used to update and animate display objects. This code rotates a Sprite continuously.

app.ticker.add((delta) => {
  sprite.rotation += 0.01 * delta;
});

Other packages similar to @pixi/display

Readme

Source

@pixi/display

Installation

npm install @pixi/display

Usage

import * as application from '@pixi/display';

FAQs

Last updated on 02 Mar 2023

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc