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

@liamsteele/phaser-texture-util

v1.0.6

Published

A set of utilities for handling textures in Phaser

Downloads

610

Readme

phaser-texture-util

This repo contains a few texture helpers I've used to make Phaser development a bit nicer.

DynamicTextureManager

DynamicTextureManager allows you to create a DynamicTexture at runtime and add other textures to it dynamically. It handles filling the texture in a reasonably efficient way. You can add textures, texture frames, or whole atlases.

This allows you to consolidate many smaller textures into a single larger texture, improving rendering performance by reducing texture swaps. If you're using small textures you may be able fit them all into a single dynamic texture. At the least you should make sprites which are on the same layer together use the same dynamic texture since they will be next to each other on the display list.

It doesn't always tightly pack textures, instead it uses a row-based approach. E.g. when you add a texture with height 16, it will assign one row of 16 pixels and pop that texture as the first one in that row. Whenever you add another texture of the same height (width doesn't matter), it will use that existing row. If you add a texture of a different height, it makes a new row. It will only be inefficient if you have a lot of textures with different heights which should be rare.

You can use this to batch generated textures which you can only do (in a simple way) at runtime.

Usage:

// Inside a Phaser.Scene (usually preloader)
const dynamicTextureManager = new DynamicTextureManager(this);
this.dynamicTextureManager.createDynamicTexture('sprites', 2048, 2048, true);
// Start batch mode for efficient drawing (optional)
dynamicTextureManager.dynamicTexture.beginDraw();
// Add textures to the dynamic texture
dynamicTextureManager.addTextureToDynamicTexture('existingTextureWithoutFrames', 'newFrameName1');
dynamicTextureManager.addFrameToDynamicTexture('existingTextureWithFrames', 'existingFrameName', 'newFrameName2');
dynamicTextureManager.addTextureAtlasToDynamicTexture(this.textures.get('existingTextureAtlas'));
const texture = 
// End batch mode and commit all draws (optional, required if you used startDraw)
dynamicTextureManager.dynamicTexture.endDraw();

TextureColorExtractor

TextureColorExtractor allows you to find the unique colours in a texture. These could be used with TextureRecolorer to generate different sprites.

TextureRecolorer

TextureRecolorer allows you to replace colours in a texture. This is useful because tinting is done at runtime and doesn't allow much control over the actual color. This allows you to create alternate versions of textures easily which are stored as actual textures so they're efficient.

Plans

I have no plans to maintain or extend this, and the interfaces are just what I wanted. Feel free to fork/copy/use the code however you like.