Skip to content

Commit

Permalink
feat: adjust spring scroll preset
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 16, 2024
1 parent ea3c96f commit be3aa09
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/renderer/src/lib/scroller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// @see https://github.com/Innei/sprightly/blob/2444dcdb789ca585337a4d241095640a524231db/src/lib/scroller.ts
import { microDampingPreset } from "@renderer/components/ui/constants/spring"

import type { Spring } from "framer-motion"
import { animateValue } from "framer-motion"

const spring: Spring = {
type: "spring",
stiffness: 1000,
damping: 250,
}
// TODO scroller lock
export const springScrollTo = (
y: number,
Expand All @@ -16,7 +22,7 @@ export const springScrollTo = (
const animation = animateValue({
keyframes: [scrollTop + 1, y],
autoplay: true,
...microDampingPreset,
...spring,
onPlay() {
el.addEventListener("wheel", stopSpringScrollHandler)
el.addEventListener("touchmove", stopSpringScrollHandler)
Expand Down

0 comments on commit be3aa09

Please sign in to comment.