ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - DerStimmler/ngx-parallax-stars: Angular library to create beautiful stars with parallax effect
Angular library to create beautiful stars with parallax effect - DerStimmler/ngx-parallax-stars
Visit Site

GitHub - DerStimmler/ngx-parallax-stars: Angular library to create beautiful stars with parallax effect

GitHub - DerStimmler/ngx-parallax-stars: Angular library to create beautiful stars with parallax effect

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.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory