basementstudio / scrollytelling

A library for creating Scrollytelling animations, powered by React & GSAP.
http://scrollytelling.basement.studio
Other
1.1k stars 33 forks source link
animations basement gsap library react scrollytelling

BSMNT Scrollytelling

BSMNT Scrollytelling is a library for creating Scrollytelling animations. It's powered by GSAP ScrollTrigger, but abstracts away some things to make it work better with React.

Frame 7


πŸ‘‡ New documentation here! πŸ‘‡


Installation

To get started, we'll need the @bsmnt/scrollytelling package, as well as the required peer dependency: GSAP.

yarn add @bsmnt/scrollytelling gsap

Why

At basement, we've built a bunch of websites that use scroll animations. Over the years, we faced some issues that required solutions that we copy-pased throughout different project. We decided to build a library to share how we build these with the world.

Challenges we faced

What

We aimed at componentizing a way of building scroll animations that could:

As an added benefit, going "component-based" allowed us to:

A simple example of how this works:

117 (1)

Exports

Demo

We did a small demo to showcase this library in action. This is the best place to see how the library works in a real world scenario. Check it out:

Examples

Troubleshooting

"My simple animation is not doing anything on scroll" Please check your `start` and `end` values for your `Root` component. A typical issue comes when: 1. your animation _"starts when the start of the scroller hits the start of the viewport"_, 2. your animation _"ends when the bottom of the scroller hits the bottom of the viewport"_, 3. the element your `Root` wraps around is only `100vh` tall, so the animation's duration is 0. To fix this, either add more height to the element your `Root` wraps, or tweak the `end` value to be something like `bottom start`, which would mean "when the bottom of the scroller hits the start of the viewport".

GSAP files are subject to GreenSock's standard license which can be found at https://greensock.com/standard-license/