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

murphyjs

v1.0.2

Published

A simple way to implement scroll based animations in your components.

Downloads

8

Readme

Why use murphy

  • ⚡️ Lightweight library (only 1.7KB gzipped).

  • 🍎 Easy and fast implementation.

  • 🎮 Total control of IntersectionObserver parameters.

  • 🎨 Full customization of time, duration, ease, delay and distance of each element individually.

  • 🎁 Some animations implemented by default.

  • 🏝 Plug and play solution to landing pages and simple projects.

  • ❎ Native fallback to not supported browsers.

Getting started

Download

Via npm:

$ npm install murphyjs

Via file include:

Download file here and link in your HTML.

<script src="./murphy/index.js"></script>

Usage

Just do three steps:

⛳   Tag your HTML

In your markup, decore your element with attribute data-murphy.

<div data-murphy="left-to-right">Any content here</div>

The default effect of murphy is bottom-to-top, but it's possible use top-to-bottom, left-to-right and right-to-left too.

🔌   Reset your CSS

In your CSS, reset all the tagged elements.

*[data-murphy] {
  opacity: 0;
}

🚀   Start murphy

In Javascript side, just import and run play when your page is completely loaded to start monitoring decorated elements.

Import
import murphy from "murphyjs";
And trigger
murphy.play()

Or call from window

If you added murphy via file include, just access murphy's functions in window:

window.murphy.play()
// or just
murphy.play()

That is enough to work! 🤟🏿

Examples

1. This data-attributes:

<p data-murphy="bottom-to-top">Bottom to top</p>
<p data-murphy="top-to-bottom">Top to bottom</p>
<p data-murphy="left-to-right">Left to right</p>
<p data-murphy="right-to-left">Right to left</p>

Will result in that:

2. To do the same effect that murphy's logo, use:

<p data-murphy="bottom-to-top">m</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="400">u</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="500">r</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="600">p</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="700">h</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="800">y</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="900">.</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="1000">j</p>
<p data-murphy="bottom-to-top" data-murphy-animation-delay="1100">s</p>

Result:

🚨 Important

These animations are triggered when scrolling the page, but when the tagged elements are already within the bounds of the screen, everything works like appearance animations that React Transition Group already does. So if you need animations on the first load of site, murphy is for you!

Documentation

Attributes

You can configure the animation of each decorated element individually. Beyond the data-murphy attribute, other attributes are available:

| Attribute | Value type | Default value | What controls | | ------ | ------ | --------- | --------- | | data-murphy | String | 'bottom-to-top' | - | | data-murphy-appearance-distance | Int | 50 (px) | - | | data-murphy-element-distance | Int | 30 (px) | - | | data-murphy-ease | String | 'ease' (can be a cubic-bezier) | - | | data-murphy-animation-delay | Int | 300 (ms) | - | | data-murphy-element-threshold | Int | 1 | - | | data-murphy-animation-duration | Int | 300 (ms) | - |

Methods

| Method | What happens | | ------ | --------- | | play | Start monitoring on element in DOM tagged with data-murphy | | reset | Resets all data-murphy elements to their initial state. |

Browser support

| Chrome | Safari | IE / Edge | Firefox | Opera | | ------ | ------ | --------- | ------- | ----- | | 58+ | 12.1+ | Not (yet) supported | 55+ | 62+ |

License

The code is available under the MIT License.