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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-parallax-stars

v3.0.0

Published

Angular library to create beautiful stars with parallax effect.

Downloads

3

Readme

ngx-parallax-stars

npm version npm downloads build GitHub license

banner

Angular library to create beautiful stars with parallax effect

Demo

https://derstimmler.github.io/ngx-parallax-stars/

Installation

Available on npm.

npm install ngx-parallax-stars

Usage

Just import the standalone NgxParallaxStarsComponent into the component you want to use it in.

import NgxParallaxStarsComponent from 'ngx-parallax-stars';

@Component({
  selector: 'app-main',
  standalone: true,
  imports: [
    CommonModule,
    NgxParallaxStarsComponent,
  ],
  templateUrl: './main.component.html',
  styleUrls: ['./main.component.scss']
})
export class MainComponent {

}

Then add the following to the template:

<ngx-parallax-stars></ngx-parallax-stars>

The component behaves like any other block element, so you can easily change its dimensions and styles with CSS.

Configuration

Star layers

The parallax effect is created by multiple layers of stars moving at different speeds.

By default, the component renders some predefined layers. You can override these with your own custom layers as follows:

layers: StarLayer[] = [
  {
    color: '#ffffff',
    speed: 10,
    density: 7,
    size: 1,
    direction: 'up',
    blur: 5,
    glow: 1,
    isRound: false,
  },
  {
    color: '#ffffff',
    speed: 15,
    density: 2,
    size: 2,
    direction: 'up',
    blur: 1,
    glow: 2,
    isRound: false,
  },
  {
    color: '#ffffff',
    speed: 20,
    density: 1,
    size: 3,
    direction: 'up',
    blur: 0,
    glow: 5,
    isRound: false,
  }
];
<ngx-parallax-stars [layers]="layers"></ngx-parallax-stars>

| Property | Description | |---------------------|----------------------------------------------------------------------------------------------------------------------------------------| | color: string | Sets the color of the stars. All colors you can use in CSS should work e.g. white, #ffffff, rgb(255,255,255), hsl(0, 0%, 100%) | | speed: number | Sets the moving speed of the stars | | density: number | Specifies how many stars should be rendered per 100 by 100px area | | size: number | Specifies the size of every star in px | | direction: string | Determines the moving direction. Possible values are: up, down, left, right | | blur: number | Sets the amount of blur for every star | | glow: number | Sets the glow radius in px | | isRound: boolean | Set to true to make the stars round instead of square |

When you update the layers input binding, the component will automatically be re-rendered.

Responsive mode

If responsive mode is enabled, the component will automatically be re-rendered when its size changes. This is important if the component grows after the initial render. Otherwise, the extra space will be empty.

Responsive mode is enabled by default, but can be disabled as follows:

<ngx-parallax-stars [responsive]="false"></ngx-parallax-stars>

Development

Install dependencies with: pnpm install

Run pnpm demo to run the demo app on a local development server. You can access it on http://localhost:4200.

Run pnpm test to test all projects.

Run pnpm lint to lint all projects.

Run pnpm build to build all projects. You can find the output under /dist.

Since it's a nx workspace you can use the common nx commands for everything else.

Shout-Out

This library is inspired by this codepen.