Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit aeee8e6

Browse files
committed
forgot about options
1 parent 46a2698 commit aeee8e6

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuxt-lenis",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"license": "MIT",
55
"type": "module",
66
"repository": {

playground/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ref, inject, watch, onMounted } from 'vue'
2222
const scrollState = inject('scrollState')
2323
const lenisRef = ref(null)
2424
const vsOptions = ref({
25-
duration: 3,
25+
duration: .2,
2626
direction: 'Horizontal',
2727
touchMultiplier: 20,
2828
infinite: false

src/runtime/components/lenis.vue

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
onBeforeUnmount,
1313
inject,
1414
onUpdated,
15+
reactive
1516
} from "vue";
1617
export default defineComponent({
1718
props: ["options"],
@@ -24,21 +25,24 @@ export default defineComponent({
2425
/**
2526
* Starting options - for full list of options visit https://github.com/studio-freight/lenis
2627
*/
27-
const lenisOptions = Object.assign(
28-
{},
29-
{
30-
duration: 1.2,
31-
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
32-
direction: "vertical",
33-
gestureDirection: "vertical",
34-
smooth: true,
35-
mouseMultiplier: 1,
36-
smoothTouch: false,
37-
touchMultiplier: 2,
38-
infinite: false,
39-
},
40-
options || {}
28+
const lenisOptions = reactive(
29+
Object.assign(
30+
{},
31+
{
32+
duration: 1.2,
33+
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
34+
direction: "vertical",
35+
gestureDirection: "vertical",
36+
smooth: true,
37+
mouseMultiplier: 1,
38+
smoothTouch: false,
39+
touchMultiplier: 2,
40+
infinite: false,
41+
},
42+
options || {}
43+
)
4144
);
45+
4246
// On mounted set new Lenis instance
4347
onMounted(() => {
4448
initLenis();
@@ -54,9 +58,10 @@ export default defineComponent({
5458
lenisVS.value.destroy();
5559
lenisVS.value = new Lenis();
5660
});
61+
5762
const initLenis = () => {
5863
if (process.client) {
59-
lenisVS.value = new Lenis();
64+
lenisVS.value = new Lenis(lenisOptions);
6065
lenisVS.value.on("scroll", (scrollData) => {
6166
setScrollState(scrollData);
6267
emit("scroll", scrollData);

0 commit comments

Comments
 (0)