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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nickolasddiaz/physics-banner

v1.0.0

Published

A rigid body physics simulation for ascii art, build using typescript and HTMLcanvas element. It uses one dependecy opentype.js for geting paths from a font.

Readme

Physics-Banner

A rigid body physics simulation for ascii art, build using typescript and HTMLcanvas element. It uses one dependecy opentype.js for geting paths from a font.

How to Install

npm install @nickolasddiaz/physics-banner

How to Use

import PhysicsBanner from "@nickolasddiaz/physics-banner";

physics_banner = new PhysicsBanner(yourHTMLCanvasElement, font_url(WOFF/OTF/TTF type font and not WOFF2), "black", font_size);
await physics_banner.setup();

const ascii_art = ... // multi-line string
physics_banner.spawn_string(ascii_art);

File Structure

.
├── index.html                              # HTML for the demo
└── src                                     # Mono-repo for libary and demo
    ├── ascii_art.txt                       # Text file for the ascii art
    ├── demo.ts                             # Demo code using tweakpane
    └── lib                                 # Libary implementation
        ├── PhysicsObject
        │   ├── PhysicsObject.ts            # Class to manage the character body, handles updating and drawing characters
        │   └── checkCollision.ts           # Function to handle the SAT collision detection and response of the PhysicsObject.ts
        ├── collision
        │   ├── quadtree.ts                 # Used to efficiently query for PhysicsObjects and perform a bounding box test
        │   └── rectangle.ts                # Helper class for quadtree.ts to split quadrants
        ├── font
        │   └── PolygonCache.ts             # Stores convex hull polygon points using from opentype.js libary, offscreencanvas for drawing, and width/height for each character
        ├── geometry
        │   ├── point.ts                    # Extends vec2.ts to add an instance of PhysicsObject.ts used for the quadtree.ts
        │   └── vec2.ts                     # Class to represent a vector 2 with common operations
        └── index.ts                        # Exported class for the libary
graph TD;
    A[PhysicsObject.ts/index.ts] <--> |Gets polygon points from characters| B[PolygonCache.ts using opentype.js];
    A --> C[Update Loop/requestAnimationFrame]
    C --> D[Clear and Insert every entity into quadtree.ts]
    D --> E[Query and perform AABB bounding box]
    E --> |AABB Hit| F[compute axes of entity A&B in checkCollision.ts]
    F --> G[Check if all axes overlap: SAT detection]
    G --> |Entities are colliding| H[Calculate and Apply MTV, angular velocity and velocity]
    H --> C
    E --> |AABB miss| C
    G --> |Entities are not colliding| C
    

QuadTree Implementation

Adapted from the coding train, quadtree.js

SAT Theorem

Adapted from danielszabo88, 15 - Separating Axis Theorem and dyn4j article )

Minimum Translation Vector

Adapted from danielszabo88, 16 - Minimum Translation Vector

Rotational Collision

Adapted from danielszabo88, 14 - Rotational Collision and Dr. Nicolas Pronost

Convex Hull using Graham Scan Algorithm

Adapted from geeksforgeeks, Convex Hull using Graham Scan

How to run the project

  1. Git clone the respository

    git clone https://github.com/nickolasddiaz/Physics-Banner.git && cd Physics-Banner
  2. Development Server

    npm run dev
  3. Build the libary

    npm run build:lib
  4. Build the docs and demo

    npm run build:demo
  5. Preview the demo

    npm run preview