From d002a302ed476e51cca0f0969c7ccfaac1b2eddd Mon Sep 17 00:00:00 2001 From: Yehonatan Daniv Date: Tue, 17 Dec 2024 11:32:48 +0200 Subject: [PATCH] Velocity 0 quick fix (#7) * Quick fix for zeroing velocity on end of movement * 0.3.2 --- dist/index.cjs | 3 +++ package.json | 2 +- src/Pointer.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dist/index.cjs b/dist/index.cjs index 894b43e..ae3e4dd 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -427,6 +427,9 @@ class Pointer { if (p < 1) { this._nextTransitionTick = requestAnimationFrame(tick); + } else { + this.currentProgress.vx = 0; + this.currentProgress.vy = 0; } this.effect.tick(this.currentProgress); diff --git a/package.json b/package.json index 5077226..187d4c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kuliso", - "version": "0.3.1", + "version": "0.3.2", "sideeffects": true, "description": "Tiny library for performant pointer-driven or gyroscope-driven effects", "main": "dist/index.cjs", diff --git a/src/Pointer.js b/src/Pointer.js index a80bfd3..0a998a0 100644 --- a/src/Pointer.js +++ b/src/Pointer.js @@ -116,6 +116,9 @@ export class Pointer { if (p < 1) { this._nextTransitionTick = requestAnimationFrame(tick); + } else { + this.currentProgress.vx = 0; + this.currentProgress.vy = 0; } this.effect.tick(this.currentProgress);