npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bear.js

v0.1.3

Published

🐻 bear.js - game engine using [pixi.js](http://www.pixijs.com/) to render. Inspired by [ELM](http://elm-lang.org/) and [Phaser](https://phaser.io/).

Readme

bear.js

🐻 bear.js - game engine using pixi.js to render. Inspired by ELM and Phaser.

Install

Add bear.js with npm/yarn or use unpkg

Examples

Counter example, the very basics. Source

Pong built with bear.js. Source

Api

game

Game init function

Parameters

  • GameArgs Object
    • GameArgs.state any Initial state of the game
    • GameArgs.update function Returns a new state each frame
    • GameArgs.render function Returns an array of sprite/text each frame
    • GameArgs.textures Array<{name: string, url: string}> List of textures that will be loaded before the game starts (optional, default [])
    • GameArgs.options Object Game options (optional, default {})
      • GameArgs.options.width number Game width (optional, default 500)
      • GameArgs.options.height number Game height (optional, default 500)
      • GameArgs.options.backgroundColor number Game background color (optional, default 0x111111)
  • landingpad Node

Examples

import { game } from "bear.js"

Returns Promise<PIXI.Application>

_Point

Point class

Parameters

x

x position

Type: number

y

y position

Type: number

length

The length of the point

Returns number

setX

Returns a copy with its x value changed

Parameters

Returns _Point

setY

Returns a copy with its y value changed

Parameters

Returns _Point

normalize

Returns a normalized copy

Returns _Point

directionTo

Returns a normalized copy pointing towards the provided point

Parameters

Returns _Point

add

Returns a copy subtracted by the provided point

Parameters

  • otherPoint _Point
    • otherPoint.x
    • otherPoint.y

Returns _Point

subtract

Returns a copy subtracted by the provided point

Parameters

  • otherPoint _Point
    • otherPoint.x
    • otherPoint.y

multiply

Returns a copy multiplied by the provided point

Parameters

  • otherPoint _Point
    • otherPoint.x
    • otherPoint.y

divide

Returns a copy divided by the provided point

Parameters

  • otherPoint _Point
    • otherPoint.x
    • otherPoint.y

clampX

Returns a copy with x clamped between the provided min and max

Parameters

Returns _Point

clampY

Returns a copy with y clamped between the provided min and max

Parameters

Returns _Point

invertX

Returns a copy with x inverted

Returns _Point

invertY

Returns a copy with y inverted

Returns _Point

invert

Returns a copy with both x and y inverted

Returns _Point

Point

Parameters

Examples

import { Point } from "bear.js"

Returns _Point

_Rectangle

Rectangle class

Parameters

  • $0 any
    • $0.position
    • $0.width
    • $0.height

position

Rectangle top left position

Type: _Point

width

Rectangle's width

Type: number

height

Rectangle's height

Type: number

left

x position at the left edge

Returns number

right

x position at the right edge

Returns number

top

y position at the top edge

Returns number

bottom

y position at the bottom edge

Returns number

center

Returns a copy with its x value changed

Returns _Point

intersects

Checks if the rectangle intersect with the provided one

Parameters

Returns boolean

Rectangle

Parameters

  • rectangleArgs Object
    • rectangleArgs.position _Point Upper left position of the rectangle
    • rectangleArgs.width number Width of the rectangle
    • rectangleArgs.height number Height of the rectangle

Examples

import { Rectangle } from "bear.js"

Returns _Rectangle

sprite

Used in the render function

Parameters

  • spriteOptions Object
    • spriteOptions.position _Point
    • spriteOptions.anchor _Point (optional, default Point(0,0))
    • spriteOptions.texture string name of loaded texture

Examples

import { sprite } from "bear.js"

Returns SpriteObject

text

Used in the render function

Parameters

Examples

import { text } from "bear.js"

Returns TextObject