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

wave-flag-studio

v1.0.1

Published

Customizable 3D cloth flag simulation library powered by Three.js

Readme

Wave Flag Studio 🚩

A lightweight, customizable 3D flag simulation NPM library powered by Three.js and real-time cloth physics aerodynamics.

Installation & Usage

Option A: Via NPM (React, Vue, Next.js, Vite, Webpack)

npm install wave-flag-studio three
import { FlagStudio } from 'wave-flag-studio';

// Simple default initialization (loads embedded SVG flag, 5 m/s wind, 3.5m staff)
const studio = new FlagStudio('#viewer');

Option B: Via CDN Script Tag (Plain HTML / No Build Tool Needed)

Include Three.js and wave-flag-studio directly in any HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Flag Studio Demo</title>
  <style>
    body { margin: 0; overflow: hidden; background: #000; }
    #flag-container { width: 100vw; height: 100vh; }
  </style>
</head>
<body>
  <div id="flag-container"></div>

  <!-- Include Three.js & WaveFlagStudio -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
  <script src="https://unpkg.com/wave-flag-studio/dist/wave-flag-studio.umd.js"></script>
  <script>
    // Initialize FlagStudio directly in browser
    const studio = new WaveFlagStudio.FlagStudio('#flag-container', {
      flagImage: 'https://flagcdn.com/w640/in.png', // Any image URL or SVG
      windSpeed: 6
    });
  </script>
</body>
</html>

Custom Options

const studio = new FlagStudio('#viewer', {
  flagImage: '/my-custom-flag.png',              // URL, relative path, or Data URI (default: embedded SVG)
  windSpeed: 8,                                   // Wind speed in m/s (default: 5)
  windDirection: { x: 1, y: 0.05, z: 0.1 },      // Wind direction vector (default: { x: 1, y: 0.04, z: 0.08 })
  flagWidth: 1.35,                                // Flag width in meters (default: 1.35)
  flagHeight: 0.9,                                // Flag height in meters (default: 0.9)
  staffLength: 3.5,                               // Staff length in meters (default: 3.5)
  staffWidth: 0.045,                              // Staff diameter (default: 0.045)
  showStaff: true,                                // Show/hide vertical staff & ornament (default: true)
});

Dynamic API Methods

studio.setWindSpeed(10);                             // Update wind speed live
studio.setWindDirection({ x: 0.5, y: 0.1, z: 1.0 }); // Update wind direction live
studio.setFlagImage('/path/to/another-flag.jpg');     // Change flag image live
studio.destroy();                                    // Clean up resources on unmount

How to Publish to NPM & Host Online

1. Publish Package to NPM Registry

Run these commands in your project terminal:

# 1. Build production bundle
npm run build

# 2. Login to your free NPM account (create one at https://npmjs.com if needed)
npm login

# 3. Publish package publicly to NPM
npm publish --access public

Once published, your library will be available instantly on NPM (npm install wave-flag-studio) and CDN (https://unpkg.com/wave-flag-studio).

2. Host Live Website Demo Online (Free)

Option A: Vercel / Netlify (Recommended)

  1. Push your project to a GitHub repository (git push origin main).
  2. Go to vercel.com or netlify.com and click Import Project from GitHub.
  3. Set build command to npm run build and output directory to dist.
  4. Click Deploy — your live website link will be generated instantly (e.g. https://wave-flag-studio.vercel.app).

Option B: GitHub Pages

  1. Install gh-pages package: npm install -D gh-pages
  2. Add script to package.json: "deploy": "npm run build && gh-pages -d dist"
  3. Run npm run deploy. Your site is hosted live at https://<your-username>.github.io/wave-flag-studio/.