2.0.1 • Published 2 years ago

pixi-graphpaper v2.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Pixi Graph Paper

Ruled graph paper, PIXI.Sprite instance able to be added to the display list via addChild().

pixi-graph-paper

Getting Started

To install, execute:

npm i pixi-graphpaper

Then, import into a project as:

import { GraphPaper } from "pixi-graphpaper";

Usage

By default, a dark theme graph paper will be applied in a 1000 x 1000 pixel grid, with:

  • Major grid every 100-pixels
  • Intermediate grid every 50-pixels
  • Minor grid every 10-pixels

Instantiate and add to the display list:

import { GraphPaper } from "pixi-graphpaper";

let paper = new GraphPaper();
stage.addChild(paper);

Options may be passed to the constructor:

let paper = new GraphPaper({
  graphWidth: 2000,
  graphHeight: 2000,
});

Or, set via properties:

let paper = new GraphPaper();

paper.graphWidth = 2000;
paper.graphHeight = 2000;

Properties

The following properties may be set on a GraphPaper instance:

TypeParamDescription
numberbackgroundFillAlphaOpacity of the background fill
numberbackgroundFillColorColor of the background
booleanbackgroundVisibleWhether background is visible
numbergraphHeightWidth of the graph
numbergraphWidthHeight of the graph
numberintermediateGridSizeGrid size of intermediate lines between major and minor rules
booleanintermediateGridVisibleWhether intermediate grid rule is visible
numberintermediateStrokeAlphaOpacity of the intermediate rule stroke
numberintermediateStrokeColorColor of the intermediate rule stroke
numberintermediateStrokeWidthWidth of the intermediate rule stroke
numbermajorGridSizeGrid size of the major rule
booleanmajorGridVisibleWhether major grid rule is visible
numbermajorStrokeAlphaOpacity of the major rule stroke
numbermajorStrokeColorColor of the major rule stroke
numbermajorStrokeWidthWidth of the major rule stroke
numberminorGridSizeGrid size of the minor rule
booleanminorGridVisibleWhether minor grid rule is visible
numberminorStrokeAlphaOpacity of the minor rule stroke
numberminorStrokeColorColor of the minor rule stroke
numberminorStrokeWidthWidth of the minor rule stroke

Graph Paper Styles

Optionally, there are built-in styles via the GraphStyle class.

blueprint

Apply via the constructor:

import { GraphPaper, GraphStyle } from "pixi-graphpaper";

let paper = new GraphPaper({
  ...GraphStyle.BLUEPRINT,
  graphWidth: 2000,
  graphHeight: 2000,
});
2.0.1

2 years ago

2.0.0

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago