0.0.6 • Published 1 year ago

reveal-on-scroll-react v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Scroll Reveal

Add scroll animations to your React application super fast!

This library is based on framer-motion and react-intersection-observer. Many thanks to their contributions!

Installation

npm i --save reveal-on-scroll-react

Getting Started

IDEA: Simply replace the scroll reveal components with your existing HTML tags.

But first you need to import the library:

import { ScrollReveal } from "reveal-on-scroll-react";

Now you can start replacing your tags. Let's consider the following example:

function HelloWorld() {
    return (
        <div className="center">
            <h1 className="color-blue">Hello World</h1>
        </div>
    )
}

This allows us to add a fade in and slide animation like so:

function HelloWorld() {
    return (
        <ScrollReveal.div className="center"> 
            <ScrollReveal.h1 animation="slide-in-bottom" className="color-blue">Hello World</ScrollReveal.h1>
        </ScrollReveal.div>
    )
}

Notice: If no animation has been specified, the default animation is "fade-in" meaning the animation property is not required.

Currently there are 4 different types of animations "fade-in" | "slide-in-bottom" | "slide-in-right" | "slide-in-left"

Properties

PropertyDefault ValueDescription
animation"fade-in"The animation preset
threshold0.5Configure the viewport threshold 0 - 1
duration1Duration of the animation in seconds
easing"easeOut"Easing function
delay0Delay the animation
value-Offset before the animation has started
0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago