star-bg2

1.1.0 • Public • Published

Star BG 🌟

Implement Star BG with JavaScript

<script src="https://unpkg.com/star-bg@1.1.0/starbg.min.js" defer>
<script>
    var stars = new STAR();
    stars.init();
</script>

Options

<script src="https://unpkg.com/star-bg@1.1.0/starbg.min.js" defer>
<script>
    var stars = new STAR();
    stars.init({
        color:'#fff', //colors of stars
        opacity: 0.4 // Opacity of stars
    });
</script>

Destroy Stars

<script src="https://unpkg.com/star-bg@1.1.0/starbg.min.js" defer>
<script>
    var stars = new STAR();
    stars.init({
        color:'#fff', //colors of stars
        opacity: 0.4 // Opacity of stars
    });
    stars.destroy();
</script>

Implement Star BG with CSS & HTML

link the stylesheet

<link rel="stylesheet" href="https://unpkg.com/star-bg@1.1.0/starbg.min.css" />

Add these to the top of the body

<div class="stars" id="star-layer1"></div>
<div class="stars" id="star-layer2"></div>
<div class="stars" id="star-layer3"></div>

Add this to your stylesheet

:root{
    --starColor: #fff; /* Star Colors*/
}
.stars{
    opacity: 0.4;
}

Package Sidebar

Install

npm i star-bg2

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

283 kB

Total Files

6

Last publish

Collaborators

  • sihilelh