Home

Awesome

ngx-particles

@omnedia/ngx-particles is an Angular library that provides a dynamic and interactive particle animation effect. The particles react to mouse movements, creating a visually engaging and customizable background for your Angular components.

Features

Installation

Install the library using npm:

npm install @omnedia/ngx-particles

Usage

Import the NgxParticlesComponent in your Angular module or component:

import { NgxParticlesComponent } from '@omnedia/ngx-particles';

@Component({
  ...
  imports: [
    ...
    NgxParticlesComponent,
  ],
  ...
})

Use the component in your template:

<om-particles
  [quantity]="150"
  [size]="0.5"
  [circleColor]="'#ff69b4'"
  [staticity]="60"
  [ease]="40"
  [particleSpeed]="1"
  [vx]="0.1"
  [vy]="0.1"
  styleClass="custom-particles"
>
  <h1>Your content here</h1>
</om-particles>

API

<om-particles
  [quantity]="quantity"
  [size]="size"
  [circleColor]="circleColor"
  [staticity]="staticity"
  [ease]="ease"
  [particleSpeed]="particleSpeed"
  [vx]="vx"
  [vy]="vy"
  styleClass="your-custom-class"
>
  <ng-content></ng-content>
</om-particles>

Example

<om-particles
  [quantity]="200"
  [size]="0.6"
  [circleColor]="'#00ffcc'"
  [staticity]="70"
  [ease]="30"
  [particleSpeed]="2"
  [vx]="0.05"
  [vy]="0.05"
  styleClass="particles-background"
>
  <div class="content">Interactive Particle Background</div>
</om-particles>

This example creates a particle background with 200 particles, cyan-colored, and with custom motion dynamics. The particles will move more fluidly in response to mouse movements.

Styling

To further customize the appearance of the particles or the container, use the styleClass input to apply your own CSS classes.

.particles-background {
  background-color: #000;
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.content {
  position: relative;
  z-index: 1;
  color: white;
  text-align: center;
  padding-top: 50px;
}

This will create a fullscreen particle background with a centered text content overlay.

Contributing

Contributions are welcome. Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.