@adityapurwa/starflies

1.0.1 • Public • Published

Starflies

Size Version Vulnerabilities License

Add starflies to a website.

Why?

Because starry night is beautiful.

Demo

https://thatskywish.netlify.app

Install

$ npm install --save @adityapurwa/starflies

Usage

const starflies = require('@adityapurwa/starflies');

document.addEventListener('DOMContentLoaded', () => {
    starflies();
});

Parameters

Call the starflies([stars], [background]) function to attach the starflies effect to the current page.

stars

The stars to be rendered.

Default:

[
    ...generateStars(70),
    ...generateStars(100, 2, 0.1, 0.1),
    ...generateStars(400, 1, 0.1, 0.05),
]

By default, it generates three layers of stars with various sizes to simulate a Parallax effect.

The array of stars that will be rendered, you can use the #generateStars function to generate the stars.

background

The background color of the canvas.

Default: #1b1f33

API

generateStars

Generate stars based on the given parameters.

  • count - The number of stars to generate.
  • minSize - The minimum size of the stars.
  • maxSize - The maximum size of the stars.
  • maxVelocity - The maximum velocity of the stars.

starflies

Attach the starflies effect to the current page.

  • stars - The stars to be rendered.
  • background - The background color of the canvas.

License

MIT © Aditya Purwa

Package Sidebar

Install

npm i @adityapurwa/starflies

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

6.64 kB

Total Files

5

Last publish

Collaborators

  • adityapurwa