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

ngx-sparklefall

v1.0.1

Published

Angular directive and component for SparkleFall - Beautiful falling sparkle animations

Downloads

10

Readme

✨ NGX SparkleFall

Angular directive and component for SparkleFall - Beautiful, customizable falling sparkle animations.

📦 Installation

npm install ngx-sparklefall sparklefall
# If using a bundler (Angular CLI), also import the CSS once in your global styles or in component:
# styles.css: @import 'sparklefall/styles.css';
# or
yarn add ngx-sparklefall sparklefall

🚀 Quick Start

Using the Component

import { SparkleFallComponent } from 'ngx-sparklefall';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [SparkleFallComponent],
  template: `
    <sparkle-fall>
      <h1>✨ Sparkly Content!</h1>
    </sparkle-fall>
  `
})
export class AppComponent {}

Using the Directive

import { SparkleFallDirective } from 'ngx-sparklefall';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [SparkleFallDirective],
  template: `
    <div sparkleFall [sparkleFallEnabled]="true">
      <h1>✨ Sparkly Content!</h1>
    </div>
  `
})
export class AppComponent {}

Using the Module (for non-standalone components)

import { SparkleFallModule } from 'ngx-sparklefall';

@NgModule({
  imports: [SparkleFallModule],
  // ...
})
export class AppModule {}

🎨 Examples

Component with Custom Options

@Component({
  template: `
    <sparkle-fall
      [sparkles]="['✨', '⭐', '💫', '🌟']"
      [interval]="800"
      [maxSparkles]="50"
      [wind]="0.3"
      [colors]="['#FFD700', '#FFA500', '#FF8C00']"
    >
      <div>Your content here</div>
    </sparkle-fall>
  `
})
export class SparklyComponent {}

Directive with Binding

@Component({
  template: `
    <div 
      sparkleFall
      [sparkleFallEnabled]="isSparkly"
      [sparkleFallWind]="windStrength"
      [sparkleFallMaxSparkles]="100"
    >
      <button (click)="toggleSparkles()">Toggle Sparkles</button>
    </div>
  `
})
export class DirectiveExample {
  isSparkly = true;
  windStrength = 0.5;
  
  toggleSparkles() {
    this.isSparkly = !this.isSparkly;
  }
}

Controlled Animation

@Component({
  template: `
    <sparkle-fall
      #sparkleComponent
      [paused]="isPaused"
      (sparkleStart)="onStart()"
      (sparkleStop)="onStop()"
    >
      <div>Controlled sparkles!</div>
    </sparkle-fall>
    
    <button (click)="sparkleComponent.burst(20)">Burst!</button>
    <button (click)="isPaused = !isPaused">Toggle Pause</button>
  `
})
export class ControlledSparkles {
  isPaused = false;
  
  onStart() {
    console.log('Sparkles started!');
  }
  
  onStop() {
    console.log('Sparkles stopped!');
  }
}

📋 Component Properties

| Input | Type | Default | Description | |-------|------|---------|-------------| | enabled | boolean | true | Enable/disable sparkles | | sparkles | string[] | ['✨', '⭐', '💫', '🌟'] | Array of sparkle characters | | colors | string[] \| null | null | Custom colors (null for emoji colors) | | interval | number | 800 | Time between new sparkles (ms) | | minSize | number | 10 | Minimum sparkle size (px) | | maxSize | number | 30 | Maximum sparkle size (px) | | minDuration | number | 2 | Minimum fall duration (seconds) | | maxDuration | number | 5 | Maximum fall duration (seconds) | | wind | number | 0 | Wind effect (-1 to 1) | | spin | boolean | true | Enable rotation | | maxSparkles | number | 50 | Max sparkles on screen | | autoStart | boolean | true | Start automatically | | paused | boolean | false | Pause/resume sparkles | | wrapperClass | string | '' | CSS class for wrapper div | | wrapperStyles | object | {} | Inline styles for wrapper |

Component Outputs

| Output | Type | Description | |--------|------|-------------| | sparkleStart | EventEmitter<void> | Emits when sparkles start | | sparkleStop | EventEmitter<void> | Emits when sparkles stop |

Component Methods

  • start() - Start sparkle animation
  • stop() - Stop spawning new sparkles
  • clear() - Remove all sparkles
  • burst(count: number) - Create a burst of sparkles

📋 Directive Properties

All directive inputs are prefixed with sparkleFall:

  • sparkleFallEnabled - Enable/disable sparkles
  • sparkleFallInterval - Time between sparkles
  • sparkleFallSparkles - Array of sparkle characters
  • sparkleFallColors - Custom colors
  • sparkleFallWind - Wind effect
  • etc.

🎯 Use Cases

Hero Section

@Component({
  template: `
    <sparkle-fall
      [maxSparkles]="100"
      [wrapperStyles]="{ minHeight: '100vh' }"
    >
      <app-hero-content />
    </sparkle-fall>
  `
})
export class HeroComponent {}

Celebration Mode

@Component({
  template: `
    <button (click)="celebrate()">🎉 Celebrate!</button>
    
    <sparkle-fall
      *ngIf="celebrating"
      [sparkles]="['🎉', '🎊', '🎈', '🎆', '✨']"
      [interval]="200"
      [maxSparkles]="100"
      [wrapperStyles]="{
        position: 'fixed',
        inset: 0,
        pointerEvents: 'none',
        zIndex: 10000
      }"
    />
  `
})
export class CelebrationComponent {
  celebrating = false;
  
  celebrate() {
    this.celebrating = true;
    setTimeout(() => this.celebrating = false, 5000);
  }
}

Button Click Effect

@Component({
  template: `
    <button 
      #sparkleBtn
      sparkleFall
      [sparkleFallEnabled]="false"
      [sparkleFallMaxSparkles]="30"
      (click)="handleClick(sparkleBtn)"
    >
      Click Me!
    </button>
  `
})
export class SparkleButton {
  handleClick(directive: any) {
    directive.burst(30);
    setTimeout(() => directive.clear(), 3000);
  }
}

Form Success

@Component({
  template: `
    <form (ngSubmit)="onSubmit()">
      <sparkle-fall
        [enabled]="showSuccess"
        [sparkles]="['✅', '🎉', '✨']"
        [maxSparkles]="50"
      >
        <input type="text" />
        <button type="submit">Submit</button>
      </sparkle-fall>
    </form>
  `
})
export class FormComponent {
  showSuccess = false;
  
  onSubmit() {
    this.showSuccess = true;
    setTimeout(() => this.showSuccess = false, 3000);
  }
}

🔧 Configuration Tips

Performance

// Reduce sparkles on mobile
@Component({
  template: `
    <sparkle-fall
      [maxSparkles]="isMobile ? 20 : 50"
      [interval]="isMobile ? 1200 : 800"
    >
      <app-content />
    </sparkle-fall>
  `
})
export class ResponsiveSparkles {
  isMobile = window.innerWidth < 768;
}

Dynamic Themes

@Component({
  template: `
    <sparkle-fall [sparkles]="currentTheme.sparkles" [colors]="currentTheme.colors">
      <app-content />
    </sparkle-fall>
  `
})
export class ThemedSparkles {
  themes = {
    holiday: {
      sparkles: ['❄️', '🎄', '🎅', '🎁'],
      colors: null
    },
    gold: {
      sparkles: ['●', '◆', '■'],
      colors: ['#FFD700', '#FFA500']
    }
  };
  
  currentTheme = this.themes.holiday;
}

📝 License

MIT

🔗 Links


Made with ✨ by Theresa Summa