-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9779527
commit 58d6843
Showing
1 changed file
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,17 +33,12 @@ using scripts: | |
<script src="https://unpkg.com/@studio-freight/[email protected]/dist/lenis.min.js"></script> | ||
``` | ||
|
||
<br/> | ||
|
||
### React | ||
|
||
See documentation for [react-lenis](https://github.com/studio-freight/lenis/tree/main/packages/react-lenis). | ||
|
||
<br> | ||
|
||
## Setup | ||
|
||
Basic setup: | ||
### Basic: | ||
|
||
```js | ||
const lenis = new Lenis() | ||
|
@@ -60,6 +55,27 @@ function raf(time) { | |
requestAnimationFrame(raf) | ||
``` | ||
|
||
### GSAP ScrollTrigger: | ||
```js | ||
const lenis = new Lenis() | ||
|
||
lenis.on('scroll', (e) => { | ||
console.log(e) | ||
}) | ||
|
||
lenis.on('scroll', ScrollTrigger.update) | ||
|
||
gsap.ticker.add((time)=>{ | ||
lenis.raf(time * 1000) | ||
}) | ||
|
||
gsap.ticker.lagSmoothing(0) | ||
``` | ||
|
||
### React: | ||
See documentation for [react-lenis](https://github.com/studio-freight/lenis/tree/main/packages/react-lenis). | ||
|
||
|
||
|
||
|
||
<br/> | ||
|
@@ -192,19 +208,6 @@ html.lenis { | |
<a href="#anchor" onclick="lenis.scrollTo('#anchor')">scroll to anchor</a> | ||
``` | ||
|
||
### GSAP ScrollTrigger integration | ||
```js | ||
const lenis = new Lenis() | ||
|
||
lenis.on('scroll', ScrollTrigger.update) | ||
|
||
gsap.ticker.add((time)=>{ | ||
lenis.raf(time * 1000) | ||
}) | ||
|
||
gsap.ticker.lagSmoothing(0) | ||
``` | ||
|
||
<br> | ||
|
||
## Limitations | ||
|
58d6843
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
lenis – ./
lenis-studio-freight.vercel.app
lenis.vercel.app
lenis.studiofreight.com
lenis-git-main-studio-freight.vercel.app
58d6843
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"⚡️ Lighthouse report for the changes in this commit:
🔴 Performance: 31
🟠 Accessibility: 88
🟢 Best practices: 100
🟠 SEO: 67
🔴 PWA: 0
Lighthouse ran on https://gsap.com/requires-membership/?plugin=SplitText&source=trial"