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

react-spring-pop

v1.4.0

Published

![React Spring POP! Logo](https://github.com/alexvcasillas/react-spring-pop/blob/master/logo/react-spring-pop-logo.png?raw=true)

Downloads

131

Readme

React Spring POP!

React Spring POP! Logo

Contents

  1. Introduction
  2. Motivation
  3. Installation
  4. Basic usage
  5. Demo
  6. Others

Introduction

React Spring POP! is a physics based animation library for your React application. It uses React Spring to generate performant off-thread calculations for the physics based animations and the Intersection Observer API with the @alexvcasillas/use-observer library which both of them are pretty cool and my defaults to go.

Motivation

I started working on animating some components when they appeared at the viewport to make cool landing pages animations and other cool applications' stuff. Then I realized that this could potentially be useful for many other developers out there in the wild, so I decided to create this library just for you to have this things out-of-the-box and not having to deal with configs and bla bla bla.

Installation

yarn add react-spring-pop react react-spring
npm i -s react-spring-pop react react-spring

This project has two peer dependecies which are: React and React Spring. You will need both of the installed in your project in order for React Spring POP! to work properly.

Basic usage

import { PopIn } from "react-spring-pop";

function App() {
  return (
    <PopIn>
      {/* Whatever your want to pop-in here! */}
    </PopIn>
  )
}

Demo

You can check a demo featuring all of the animations on the always marvelous CodeSandbox.io

Pop Animations

React Spring POP! comes out-of-the-box with a few components to deal with pop in animations. Those components are the following.

  • PopIn
  • PopInLeft
  • PopInRight
  • PopInTop
  • PopInBottom

This components will accept the following props to configure a little its behaviour:

prop: element;
  type: string;
  default: 'div';

prop: once;
  type: boolean;
  default: false;

prop: threshold;
  type: number;
  default: 0;
  min: 0;
  max: 1;

prop: tension;
  type: number;
  default: 180;
  min: 1;
  max: 500;

prop: friccion;
  type: number;
  default: 12;
  min: 1;
  max: 500;

prop: mass;
  type: number;
  default: 1;
  min: 1;
  max: 500;

The element property indicates which kind of HTML element would you like to generate for this animated component.

The once property indicates if the animation should be only triggered once and no more, so it will only get triggered the first time the element is on the viewport with the given threshold.

The threshold property indicates how much of the component needs to be displayed within the viewport to trigger the animation. It will take a number from 0 to 1 to indicate the percentage of the component that's on the viewport, meaning that 0.5 will be equals to the 50% of the component.

The tension property indicates the spring energetic load.

The friccion property indicates the spring resistance.

The mass property indicates the spring mass.

Fade Animations

React Spring POP! comes out-of-the-box with a few components to deal with fade in animations. Those components are the following.

  • FadeIn
  • FadeInLeft
  • FadeInRight
  • FadeInTop
  • FadeInBottom

This components will accept the following prop to configure a little its behaviour:

prop: element;
  type: string;
  default: 'div';

prop: once;
  type: boolean;
  default: false;

prop: threshold;
  type: number;
  default: 0;
  min: 0;
  max: 1;

The element property indicates which kind of HTML element would you like to generate for this animated component.

The once property indicates if the animation should be only triggered once and no more, so it will only get triggered the first time the element is on the viewport with the given threshold.

The threshold property indicates how much of the component needs to be displayed within the viewport to trigger the animation. It will take a number from 0 to 1 to indicate the percentage of the component that's on the viewport, meaning that 0.5 will be equals to the 50% of the component.

Bounce Animations

React Spring POP! comes out-of-the-box with a few components to deal with bounce in animations. Those components are the following.

  • BounceInLeft
  • BounceInRight
  • BounceInTop
  • BounceInBottom

This components will accept the following props to configure a little its behaviour:

prop: element;
  type: string;
  default: 'div';

prop: once;
  type: boolean;
  default: false;

prop: threshold;
  type: number;
  default: 0;
  min: 0;
  max: 1;

prop: tension;
  type: number;
  default: 180;
  min: 1;
  max: 500;

prop: friccion;
  type: number;
  default: 12;
  min: 1;
  max: 500;

prop: mass;
  type: number;
  default: 1;
  min: 1;
  max: 500;

The element property indicates which kind of HTML element would you like to generate for this animated component.

The once property indicates if the animation should be only triggered once and no more, so it will only get triggered the first time the element is on the viewport with the given threshold.

The threshold property indicates how much of the component needs to be displayed within the viewport to trigger the animation. It will take a number from 0 to 1 to indicate the percentage of the component that's on the viewport, meaning that 0.5 will be equals to the 50% of the component.

The tension property indicates the spring energetic load.

The friccion property indicates the spring resistance.

The mass property indicates the spring mass.

Others

If you want a more CSS-in-JS approach I've also developed Animated Styled Components which makes use of styled-components and pure CSS animation keyframes and it comes with a lot of ready to drop in animations!