Comparing version 1.1.14-dev.0 to 1.1.14-dev.3
{ | ||
"name": "lenis", | ||
"version": "1.1.14-dev.0", | ||
"version": "1.1.14-dev.3", | ||
"type": "module", | ||
@@ -40,3 +40,3 @@ "sideEffects": false, | ||
"postversion": "pnpm build && pnpm readme", | ||
"publish": "npm publish", | ||
"publish:main": "npm publish", | ||
"publish:dev": "npm publish --tag dev" | ||
@@ -43,0 +43,0 @@ }, |
@@ -59,14 +59,18 @@ [](https://github.com/darkroomengineering/lenis) | ||
```js | ||
const lenis = new Lenis() | ||
// Initialize Lenis | ||
const lenis = new Lenis(); | ||
// Listen for the scroll event and log the event data | ||
lenis.on('scroll', (e) => { | ||
console.log(e) | ||
}) | ||
console.log(e); | ||
}); | ||
// Use requestAnimationFrame to continuously update the scroll | ||
function raf(time) { | ||
lenis.raf(time) | ||
requestAnimationFrame(raf) | ||
lenis.raf(time); | ||
requestAnimationFrame(raf); | ||
} | ||
requestAnimationFrame(raf) | ||
requestAnimationFrame(raf); | ||
``` | ||
@@ -112,15 +116,22 @@ | ||
```js | ||
const lenis = new Lenis() | ||
// Initialize a new Lenis instance for smooth scrolling | ||
const lenis = new Lenis(); | ||
// Listen for the 'scroll' event and log the event data to the console | ||
lenis.on('scroll', (e) => { | ||
console.log(e) | ||
}) | ||
console.log(e); | ||
}); | ||
lenis.on('scroll', ScrollTrigger.update) | ||
// Synchronize Lenis scrolling with GSAP's ScrollTrigger plugin | ||
lenis.on('scroll', ScrollTrigger.update); | ||
gsap.ticker.add((time)=>{ | ||
lenis.raf(time * 1000) | ||
}) | ||
// Add Lenis's requestAnimationFrame (raf) method to GSAP's ticker | ||
// This ensures Lenis's smooth scroll animation updates on each GSAP tick | ||
gsap.ticker.add((time) => { | ||
lenis.raf(time * 1000); // Convert time from seconds to milliseconds | ||
}); | ||
gsap.ticker.lagSmoothing(0) | ||
// Disable lag smoothing in GSAP to prevent any delay in scroll animations | ||
gsap.ticker.lagSmoothing(0); | ||
``` | ||
@@ -152,3 +163,3 @@ | ||
| `syncTouchLerp` | `number` | `0.075` | Lerp applied during `syncTouch` inertia | | ||
| `touchInertiaMultiplier` | `number` | `35` | Manage the the strength of `syncTouch` inertia | | ||
| `touchInertiaMultiplier` | `number` | `35` | Manage the strength of syncTouch inertia | | ||
| `wheelMultiplier` | `number` | `1` | The multiplier to use for mouse wheel events | | ||
@@ -155,0 +166,0 @@ | `touchMultiplier` | `number` | `1` | The multiplier to use for touch events | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
340
0
129244
9
1585