Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
clementroche committed Jan 18, 2024
1 parent 9779527 commit 58d6843
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions packages/lenis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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/>
Expand Down Expand Up @@ -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
Expand Down

2 comments on commit 58d6843

@vercel
Copy link

@vercel vercel bot commented on 58d6843 Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

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"

Please sign in to comment.