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

@emmaly/starfield

v0.1.4

Published

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Demo](https://img.shields.io/badge/Demo-View%20site-blue)](https://emmaly.github.io/starfield/)

Downloads

10

Readme

Emmaly's Starfield Component

License: MIT Demo

Live Demo: https://emmaly.github.io/starfield/

Provides a mesmerizing animated starfield as a Svelte component, rendering thousands of twinkling stars with smooth animations, perfect for backgrounds, loading screens, or just adding some magic to your project.

Built with performance in mind using the Canvas 2D API, so your starfield should run smoothly even on lower-end devices.

Installation

For New Projects

The easiest way to get started:

npm install github:emmaly/starfield svelte

Or add to your package.json:

{
  "dependencies": {
    "@emmaly/starfield": "github:emmaly/starfield",
    "svelte": "^4.0.0"
  }
}

For Local Development

If you're working locally or contributing:

# Clone the repository
git clone https://github.com/emmaly/starfield.git
cd starfield

# Install root dependencies
npm install

# Install and run the demo
cd examples/starfield-demo
npm install
npm run dev

Basic Usage

Get started with just a few lines of code:

<script>
  import Starfield from '@emmaly/starfield';
</script>

<!-- Simple starfield with default settings -->
<Starfield />

Advanced Usage with Controls

Want to let users customize the starfield? Here's how to add interactive controls:

<script>
  import Starfield from '@emmaly/starfield';
  let speed = 0.25;
  let density = 2.0;
</script>

<Starfield initialSpeed={speed} initialDensity={density} maxDensity={6}>
  <!-- Speed control -->
  <div class="controls" slot="speed" let:setSpeedTarget let:speedFactor>
    <label for="speed-range">Speed</label>
    <input 
      id="speed-range" 
      type="range" 
      min="0" 
      max="3" 
      step="0.01" 
      bind:value={speed}
      on:input={(e) => setSpeedTarget(parseFloat(e.currentTarget.value), 600)} 
    />
    <span>{speed.toFixed(2)}</span>
  </div>
  
  <!-- Density control -->
  <div class="controls" slot="density" let:setDensityTarget let:densityFactor let:maxDensity>
    <label for="density-range">Density</label>
    <input 
      id="density-range" 
      type="range" 
      min="0.3" 
      max={maxDensity} 
      step="0.01" 
      bind:value={density}
      on:input={(e) => setDensityTarget(parseFloat(e.currentTarget.value), 700)} 
    />
    <span>{density.toFixed(2)}×</span>
  </div>
</Starfield>

Configuration Options

| Property | Type | Default | Description | |----------|------|---------|-------------| | initialSpeed | number | 0.25 | How fast the stars move (0 = stationary, 3 = very fast) | | initialDensity | number | 2.0 | How many stars to show (higher = more stars) | | maxDensity | number | 6 | Maximum allowed density value |

Interactive Slots

The component provides slots with helper functions for creating interactive controls:

Speed Slot

  • setSpeedTarget(value, ms) - Smoothly animate to a new speed over ms milliseconds
  • speedFactor - Current speed multiplier

Density Slot

  • setDensityTarget(value, ms) - Smoothly animate to a new density over ms milliseconds
  • densityFactor - Current density multiplier
  • maxDensity - The maximum density value

Development

Want to modify the component or see it in action?

  1. Run the demo:

    # From the repo root
    cd examples/starfield-demo
    npm run dev
  2. Edit the component: Make changes to src/Starfield.svelte

  3. See updates live: The demo automatically reflects your changes when you reload the page

Tips & Ideas

  • Background Effect: Set a low speed (0.1-0.3) for a subtle background animation
  • Loading Screen: Use higher speed (1-2) with medium density for an engaging loading effect
  • Interactive Experience: Combine both slots to let users customize their experience
  • Responsive Design: The starfield automatically adapts to its container size

Enjoy your starfield! If you create something cool with this component, we'd love to see it!

License

Released under the MIT License.