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

@pixi/graphics

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/graphics

Draw primitive shapes such as lines, circles and rectangles to the display

  • 6.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
125K
decreased by-17.99%
Maintainers
3
Weekly downloads
 
Created

What is @pixi/graphics?

@pixi/graphics is a package that provides a way to draw and manipulate 2D graphics in a web application using the PixiJS library. It allows developers to create shapes, lines, and complex graphics with ease, leveraging the power of WebGL for performance.

What are @pixi/graphics's main functionalities?

Drawing Basic Shapes

This feature allows you to draw basic shapes like circles, rectangles, and ellipses. The code sample demonstrates how to create a red circle with a radius of 50 pixels and add it to the stage.

const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000);
graphics.drawCircle(50, 50, 50);
graphics.endFill();
app.stage.addChild(graphics);

Line Drawing

This feature allows you to draw lines with specified styles. The code sample shows how to draw a blue line from the point (0, 0) to (100, 100) with a thickness of 2 pixels.

const graphics = new PIXI.Graphics();
graphics.lineStyle(2, 0x0000FF, 1);
graphics.moveTo(0, 0);
graphics.lineTo(100, 100);
app.stage.addChild(graphics);

Complex Shapes

This feature allows you to create complex shapes by defining paths. The code sample demonstrates how to draw a green square by defining its path and filling it.

const graphics = new PIXI.Graphics();
graphics.beginFill(0x00FF00);
graphics.moveTo(0, 0);
graphics.lineTo(100, 0);
graphics.lineTo(100, 100);
graphics.lineTo(0, 100);
graphics.closePath();
graphics.endFill();
app.stage.addChild(graphics);

Other packages similar to @pixi/graphics

FAQs

Package last updated on 22 Jul 2022

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