0.5.0 • Published 1 year ago

pixi-ex v0.5.0

Weekly downloads
19
License
MIT
Repository
github
Last release
1 year ago

Features

  • Enhanced built-in functions
  • Convenience functions for creating sprites, texts etc.
  • Written in TypeScript
  • Zero dependencies

API

  • resize - Resize the canvas and retain the correct proportions

  • getGlobalPosition - Get the global position of a display object

  • getOverlappingArea - Get overlapping area of two display objects

  • drawHitArea - Debug your display objects hit areas

  • onClick - Sets interactive to true, changes mouse cursor to pointer and adds a click listener to the display object.

  • handleResize - Make text objects look good even when resized

  • getAllChildren - Get all children (including the input display object) from this point in the hierarchy.

  • centerX - Center a display object on the horizontal axis.

  • centerY - Center a display object on the vertical axis.

  • useAutoFullScreen - Automatically resize canvas to be full screen.

  • getGameScale - Get the game scale after resize

Constructors

Benefits:

  • Always adds the object to a parent
  • No need to use the new keyword ("new Sprite" -> "sprite")
  • AnimatedSprite auto-plays
  • Enforces a TextStyle to be set on Text
sprite(parent: Container, texture?: Texture): Sprite
animatedSprite(parent: Container, textures?: Texture[]): AnimatedSprite
text(parent: Container, textStyle: Partial<ITextStyle>, textContent?: string): Text
container(parent: Container): Container
graphics(parent: Container): Graphics
rectangle(rectangle: {
  x: number
  y: number
  width: number
  height: number
}): Rectangle

Enhanced built-ins

beginFill(graphics: Graphics, color: number): Graphics

Also calls clear

setPosition(
  displayObject: Container,
  position: { x: number; y: number },
): void

Accepts a position object

drawRect(
  graphics: Graphics,
  rectangle: Rectangle | { x: number; y: number; width: number; height: number },
): Graphics

Accepts a Rectangle

Helpers

  • getWidth

  • getHeight

  • centerX

  • centerY

  • getAllChildren

  • centerPivot


:package: Install

npm install pixi-ex

Example usage

Check out app/index.js for example usages

0.5.0

1 year ago

0.4.0

1 year ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.2.0-0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

5 years ago

0.0.2

5 years ago