Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 746 Bytes

README.md

File metadata and controls

26 lines (18 loc) · 746 Bytes

pixi-fittext

pixi-fittext is a module for PIXI.js that changes the scale depending on the length of the string. It is a premise used for game project using pixi.js.

Install

# install this module
npm install @drecom/pixi-fittext

Usage

const requiredWidth = 240;

// FitText extends PIXI.Text, The parameter same as PIXI.Text except for the requiredWidth.
const fitText = new FitText("Hello FitText!", requiredWidth, { fill: 0xFFFFFF });

// when set text property, FitText adjust x scale automaticaly.
fitText.text = "adjust x scale auto.";

fittext1
fittext2