Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@pixi/graphics
Advanced tools
Draw primitive shapes such as lines, circles and rectangles to the display
@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.
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);
Konva is a 2D canvas library that provides a high-level API for drawing shapes, images, and text. It is similar to @pixi/graphics in that it allows for drawing and manipulation of 2D graphics, but it is more focused on providing a rich set of features for creating interactive and animated graphics.
p5.js is a JavaScript library that makes coding accessible for artists, designers, educators, and beginners. It is similar to @pixi/graphics in its ability to draw shapes and create graphics, but it is more focused on creative coding and has a broader scope, including sound and video manipulation.
Two.js is a two-dimensional drawing API for the web. It is similar to @pixi/graphics in that it provides a simple way to draw shapes and paths, but it is designed to be lightweight and easy to use, with a focus on vector graphics.
npm install @pixi/graphics
import { Graphics } from '@pixi/graphics';
const shapes = new Graphics();
FAQs
Draw primitive shapes such as lines, circles and rectangles to the display
The npm package @pixi/graphics receives a total of 97,916 weekly downloads. As such, @pixi/graphics popularity was classified as popular.
We found that @pixi/graphics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.