1.0.9994 • Published 6 years ago
react-drizzle v1.0.9994
react-drizzle
A react library to help sequence reveal animations on scroll.

Install
npm install --save react-drizzleRequires Peer Dependency: gsap
npm install --save gsapUsage
import React, { Component } from 'react'
import Drizzle, { DrizzleSettings } from 'react-drizzle'
class Example extends Component {
render() {
return (
<DrizzleSettings speed={2}>
<Drizzle type="text" group="my-group-namespace">
<h1>
Text you<br></br> want to<br></br>Animate
</h1>
</Drizzle>
<Drizzle type="fade-up" group="my-group-namespace">
{/* it will wait to load image before revealing the group */}
<img
width="130"
height="auto"
src="https://images.unsplash.com/photo-1532264523420-881a47db012d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=100"
></img>
</Drizzle>
<Drizzle type="fade-up" group="second-group">
<img
width="130"
height="auto"
src="https://images.unsplash.com/photo-1532264523420-881a47db012d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=100"
></img>
</Drizzle>
</DrizzleSettings>
)
}
}Attributes
<Drizzle>
type:fadeortext. Can take a direction:-up,-down,-left,-right, ex:type="fade-down"
order: Number - if this isn't set, it picks the order based off creation order. Elements with an order set always rank higher than elements without an order. The plugin sets a calculated order — for example, if two elements have the order 1, 5, 7, the calculated orders get set to 0, 1, 2.speed: Number in seconds (default: 1) - the time it takes for a single Drizzle element to appear. This is multiplied by its calculated order.delay: Number in seconds (default: 0) - the amount of time to wait to reveal the item, after it is ready to reveal.distance: Number - pixel distance (default: 25). Used for movement, such as afade-uponAppear: Function - callback that triggers when the item is ready to reveal, e.g. when the item moves into view.visibilityRootMarginString or Number - (default: 0) Margin around the root. See Intersection Observer APIvisibilityThresholdArray or Number - (default: 0.3) Indicates at what percentage of the target's visibility the observer's callback should be executed Intersection Observer APIcontainerSx: Extend sx props to the container elementcontainerStyle: Extend style props to the container elementsx: Extend sx props to the underlying animation elementstyle: Extend style props to the underlying animation element
<DrizzleSettings> - global settings applied to all child <Drizzle> elements
- Can set defaults for
speed,delay,distance,visibilityRootMargin,visibilityThreshold. staggerSpeed: Number in seconds (default: 0.1) - the time to wait between revealing Drizzle items within the group.ease: String (default: 'Power2.easeOut') - a GSAP tween. ex:ease={'elastic.out(1, 0.3)'}waitForChildImages: Boolean (default: true) - doesn't reveal group until images in the group are loaded.textLineStaggerSpeed: Number in seconds (default: 0.1) - fortype="text"; the time to wait between revealing lines of text.
Order of operations:
Drizzle is on screen, wait for staggerSpeed, wait for delay speed, then display its children.
License
MIT © UseAllFive
1.0.9993
6 years ago
1.0.9994
6 years ago
1.0.9992
6 years ago
1.0.9991
6 years ago
1.0.999
6 years ago
1.0.998
6 years ago
1.0.997
6 years ago
1.0.996
6 years ago
1.0.995
6 years ago
1.0.994
6 years ago
1.0.992
6 years ago
1.0.993
6 years ago
1.0.991
6 years ago
1.0.99
6 years ago
1.0.98
6 years ago
1.0.97
6 years ago
1.0.96
6 years ago
1.0.95
6 years ago
1.0.94
6 years ago
1.0.93
6 years ago
1.0.92
6 years ago
1.0.9
6 years ago
1.0.91
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago