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

@janmarkuslanger/floatingjs

v0.0.1

Published

Floating.js is a lightweight library for creating animated floating elements on your webpage. Perfect for festive effects like snowflakes, sparkles, or any other decorative floating items. ๐Ÿš€

Downloads

56

Readme

Floating.js ๐ŸŽ‰

Floating.js is a lightweight library for creating animated floating elements on your webpage. Perfect for festive effects like snowflakes, sparkles, or any other decorative floating items. ๐Ÿš€


Features โœจ

  • Customizable elements: Use text, emojis, or even HTML elements.
  • Control animation frequency: Adjust the number of floating elements and the interval between appearances.
  • Lightweight and modular: No external dependencies.
  • Easy-to-use API: Start with minimal setup.

Installation

You can include Floating.js in your project via npm:

npm install --save @janmarkuslanger/floatingjs

Usage

Hereโ€™s how to get started with Floating.js:

1. Import the Library

import { Floating } from '@janmarkuslanger/floatingjs';

2. Initialize the Floating Effect

const floating = new Floating({
  elements: ['โ„๏ธ', 'โœจ', '๐ŸŽ‰', 'โญ๏ธ'], // Elements to float (strings or custom HTML elements)
  maxElements: 20,                  // Maximum number of floating elements (default: 10)
  interval: 1000,                   // Interval in milliseconds between new elements (default: 2000)
});

3. Start or Stop the Animation

// Start the animation
floating.start();

// Stop the animation
floating.stop();

Options ๐Ÿ› ๏ธ

| Option | Type | Default | Description | |---------------|---------------------------|-------------------|-----------------------------------------------------------------------------| | elements | string[] or Function[] | [] | Elements to float. Strings (e.g., 'โญ๏ธ') or functions returning HTML elements. | | maxElements | number | 10 | Maximum number of floating elements visible at any time. | | interval | number (ms) | 2000 | Interval between the creation of new floating elements (in milliseconds). | | root | HTMLElement | document.body | The container where floating elements will be appended. |


Example ๐ŸŽจ

import { Floating } from 'floating-js';

const snowflakes = new Floating({
  elements: ['โ„๏ธ', 'โ…', 'โ†'], // Snowflake shapes
  maxElements: 30,
  interval: 500,
});

// Start the animation
snowflakes.start();

Advanced Usage ๐Ÿš€

const customFloating = new Floating({
  elements: [
    'โœจ',
    () => {
      const customElement = document.createElement('div');
      customElement.textContent = 'Custom!';
      customElement.style.color = 'gold';
      return customElement;
    },
  ],
  maxElements: 15,
  interval: 800,
});

customFloating.start();

Contributing ๐Ÿค

We welcome contributions! If you have suggestions, feature requests, or find a bug, please open an issue or submit a pull request.


License ๐Ÿ“œ

This project is licensed under the MIT License.