Socket
Socket
Sign inDemoInstall

@pixi/text

Package Overview
Dependencies
0
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/text


Version published
Maintainers
3
Created

Package description

What is @pixi/text?

@pixi/text is a package within the PixiJS library that provides functionality for creating and manipulating text objects in a 2D WebGL renderer. It allows developers to add, style, and animate text in their PixiJS applications.

What are @pixi/text's main functionalities?

Basic Text Creation

This feature allows you to create a basic text object and add it to the PixiJS stage. The text can be positioned using the x and y properties.

const app = new PIXI.Application();
document.body.appendChild(app.view);
const basicText = new PIXI.Text('Hello Pixi!');
basicText.x = 50;
basicText.y = 100;
app.stage.addChild(basicText);

Styled Text

This feature allows you to create text with various styles such as font family, size, color, stroke, and drop shadow. The TextStyle object is used to define these styles.

const style = new PIXI.TextStyle({
  fontFamily: 'Arial',
  fontSize: 36,
  fill: 'white',
  stroke: '#ff3300',
  strokeThickness: 4,
  dropShadow: true,
  dropShadowColor: '#000000',
  dropShadowBlur: 4,
  dropShadowAngle: Math.PI / 6,
  dropShadowDistance: 6,
});
const richText = new PIXI.Text('Styled Text', style);
richText.x = 50;
richText.y = 150;
app.stage.addChild(richText);

Text Animation

This feature allows you to animate text objects. In this example, the text is rotated continuously using the app's ticker.

const animatedText = new PIXI.Text('Animating Text');
animatedText.x = 50;
animatedText.y = 200;
app.stage.addChild(animatedText);
app.ticker.add(() => {
  animatedText.rotation += 0.01;
});

Other packages similar to @pixi/text

Readme

Source

@pixi/text

Installation

npm install @pixi/text

Usage

import * as text from '@pixi/text';

FAQs

Last updated on 25 Oct 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc