Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelchanrion committed Dec 22, 2023
1 parent 06ff1b4 commit c0f94d3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]
[![Codecov][codecov-src]][codecov-href]
<!-- [![Codecov][codecov-src]][codecov-href] -->

Easily create responsive parallax effect and scroll animations on any element using data attributes.

- 👀 The element only animates while inside the viewport.
- 🎯 The element will have its normal position when in the middle of the viewport.
- 🎨 Animate any property from and/or to any value.
- 🎨 Animate any property from/to any value.
- 🌈 Apply breakpoint-specific speeds.
- ⚙️ Customize the data-attribute names (hell, even use classes if you want!).
- 🩻 Add helpful markers during development/troubleshooting
Expand Down Expand Up @@ -70,7 +70,7 @@ You can specify the speed depending on a breakpoint.
```html
<div data-scroll-speed="md:0.5 lg:0.2">Oowee!</div>
```
> In this example, the speed will be 0.5 starting at medium screens and 0.2 on starting at large screens.
> In this example, the speed will be 0.5 starting at medium screens and 0.2 starting at large screens.
#### Clamp

Expand All @@ -86,7 +86,7 @@ Your element is above the fold and you want it to start from its normal position

The style from which the element will animate from. See it as a `gsap.from()`

> Beware that the value has to be valid JSON.
> Beware that the value has to be valid JSON. For functions, use the `getFrom` option.
```html
<div data-scroll-from='{"backgroundColor": "black"}'>Oowee!</div>
Expand All @@ -98,7 +98,7 @@ The style from which the element will animate from. See it as a `gsap.from()`

The style to which the element will animate to. See it as a `gsap.to()`

> Beware that the value has to be valid JSON.
> Beware that the value has to be valid JSON. For functions, use the `getTo` option.
```html
<div data-scroll-from='{"rotate": 360}'>Oowee!</div>
Expand Down Expand Up @@ -222,7 +222,7 @@ useDataScroll({
### getFrom

A function that returns the style to animate the element from.
- type: `(target: HTMLElement) => string | void`
- type: `(target: HTMLElement) => gsap.TweenVars | void`
- default:
```ts
(target: HTMLElement) => {
Expand Down Expand Up @@ -252,10 +252,11 @@ A function that returns the style to animate the element to. See [getFrom](#getf

## Roadmap

[] tests
[] playground
[] Add data-scroll-progress
[] Add hooks for ScrollTrigger like toggleClass, onEnter, onLeave, etc.
- [x] documentation
- [] tests
- [] playground
- [] Add data-scroll-progress
- [] Add hooks for ScrollTrigger like toggleClass, onEnter, onLeave, etc.

## Development

Expand Down

0 comments on commit c0f94d3

Please sign in to comment.