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

@pixi/core

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/core

Core PixiJS

  • 7.2.0-beta.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
105K
decreased by-11.34%
Maintainers
2
Weekly downloads
 
Created

What is @pixi/core?

@pixi/core is a core module of the PixiJS library, which is a fast, lightweight 2D rendering engine for creating interactive graphics, games, and other visual content using WebGL and HTML5 canvas.

What are @pixi/core's main functionalities?

Creating a Renderer

This code demonstrates how to create a renderer using @pixi/core. The renderer is responsible for rendering the graphics to the screen. The example creates a renderer with a width of 800 pixels and a height of 600 pixels, and appends the renderer's view (canvas element) to the document body.

const { Renderer } = require('@pixi/core');
const renderer = new Renderer({ width: 800, height: 600 });
document.body.appendChild(renderer.view);

Creating a Texture

This code demonstrates how to create a texture using @pixi/core. Textures are used to apply images to graphics. The example creates a base texture from an image file and then creates a texture from the base texture.

const { Texture, BaseTexture } = require('@pixi/core');
const baseTexture = new BaseTexture('path/to/image.png');
const texture = new Texture(baseTexture);

Creating a Sprite

This code demonstrates how to create a sprite using @pixi/core. Sprites are basic objects for rendering images. The example creates a sprite from a texture, sets its position, and adds it to the renderer's stage.

const { Sprite } = require('@pixi/core');
const sprite = new Sprite(texture);
sprite.x = 100;
sprite.y = 150;
renderer.stage.addChild(sprite);

Rendering the Stage

This code demonstrates how to render the stage using @pixi/core. The stage is the root container for all display objects. The example sets up an animation loop that continuously renders the stage.

function animate() {
  requestAnimationFrame(animate);
  renderer.render(renderer.stage);
}
animate();

Other packages similar to @pixi/core

FAQs

Package last updated on 24 Feb 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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc