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

@baianat/flux.js

v0.0.2

Published

Flux.js is a JavaScript package that enables parallax scrolling effect on selected elements. With optimizations to Reduce **Jank**.

Downloads

3

Readme

Flux.js

Flux.js is a JavaScript package that enables parallax scrolling effect on selected elements. With optimizations to Reduce Jank.

Supported Effects

The following are supported effects

  • Translate (Y, X)
  • Rotate
  • Scale
  • Opacity
  • Add custom class

Examples

Example

Getting Started

Install

First step is to install it using yarn or npm

npm install @baianat/flux.js

# or use yarn
yarn add @baianat/flux.js

Include necessary files

<body>
  ...
  <script type="text/javascript" src="dist/js/flux.js"></script>
</body>

Usage

You create new Flux object and pass array of elements, that you want to add effect to it.

  const fluxer = new Flux(
    [{
      // Item 1 option
    }, {
      // Item 2 option
    }],

    // settings
    {
      // breakpoint disables transformations, opacity and class toggling.
      breakpoint: 500, // defaults 0
      // if animation ends when the element gets out out of viewport
      outOfViewport: false, // defaults true
      // viewport ratio when animation should finish value from [0.1, 1]
      finishRatio: 1
    }
  );

Items Options

{
  // Element css selector or DOM element
  element: '#square1',
  // viewport ratio when animation should finish value from [0.1, 1]
  finishRatio: 1
  // Translate object values
  translate: {
    // translate unit, it can be 'px' or '%', defaults is 'px'
    unit: '%'
    // Y offsets, first value is the starting position, second is the ending position in px
    y: [-200, 200],
    // X offsets, first value is the starting position, second is the ending position in px
    x: [0, 10]
  },
  // Rotate values, first value is the starting degree, second is the ending degree
  // Accepts value between -360 : 360.
  rotate: [-45, 45],
  // Scale values, first value is the starting scale, second is the ending scale
  // Accepts fraction values.
  scale: [0.5, 1.4],
  // Opacity values, first value is the starting opacity, second is the ending opacity
  // Accepts value between 0 : 1, fractions are allowed
  opacity: [0, 1],
  // A class to be added when the element is in the viewport
  // It you want to toggle the class state when element in/out of the viewport
  // You can pass an object {'is-active': 'toggle'}
  class: 'is-active',
  // To disable transform and opacity changes.
  // It usually uses when working with class.
  omit: true (deprecated 👎)
}

Methods

flux.update([force])

  • force <boolean>

Updates elements in viewport position according to the current scroll, using force will update all elements event those that are not visible in the viewport

flux.reload()

Recalculates all elements bounding rectangle and regenerates its data then force update it.

Browser Support

This package is using Intersection Observer API to check if the element in the viewport, since it's not supported in all browsers you will need to add a polyfill to use it.