@zakisheriff/liquid-glass 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -183,8 +183,8 @@ var SPRINGS = {
183
183
  /** A dragged lens's stretch: loose, so it wobbles when the drag stops. */
184
184
  jelly: springFrom(0.3, 0.3)
185
185
  };
186
- function createJelly(onUpdate, max, speed) {
187
- const spring = createSpring(0, SPRINGS.jelly, (value) => onUpdate(value));
186
+ function createJelly(onUpdate, max, speed, config = SPRINGS.jelly) {
187
+ const spring = createSpring(0, config, (value) => onUpdate(value));
188
188
  return {
189
189
  feed(velocity) {
190
190
  spring.set(max * Math.tanh(Math.abs(velocity) / speed));
@@ -1758,6 +1758,9 @@ var import_react8 = require("react");
1758
1758
  var FOLLOW2 = springFrom(0.2, 0.82);
1759
1759
  var PULL_REACH = 0.08;
1760
1760
  var PULL_GIVE = 0.15;
1761
+ var DRAG = springFrom(0.14, 0.84);
1762
+ var WOBBLE = springFrom(0.34, 0.2);
1763
+ var LAND = springFrom(0.38, 0.6);
1761
1764
  function useLensTrack(refs, options) {
1762
1765
  const latest = (0, import_react8.useRef)(options);
1763
1766
  latest.current = options;
@@ -1897,8 +1900,8 @@ function useLensTrack(refs, options) {
1897
1900
  const jelly = createJelly((value) => {
1898
1901
  state.squash = value;
1899
1902
  paint();
1900
- }, 0.13, 1600);
1901
- const x = createSpring(current * slot, SPRINGS.snap, (value, velocity) => {
1903
+ }, 0.2, 1200, WOBBLE);
1904
+ const x = createSpring(current * slot, LAND, (value, velocity) => {
1902
1905
  state.x = value;
1903
1906
  jelly.feed(velocity);
1904
1907
  paint();
@@ -1928,7 +1931,7 @@ function useLensTrack(refs, options) {
1928
1931
  const place = (index, instant = false) => {
1929
1932
  current = index;
1930
1933
  if (!gesture) {
1931
- x.tune(SPRINGS.snap);
1934
+ x.tune(LAND);
1932
1935
  x.set(index * slot, instant);
1933
1936
  }
1934
1937
  };
@@ -1968,7 +1971,7 @@ function useLensTrack(refs, options) {
1968
1971
  lift.set(1);
1969
1972
  swell.tune(SPRINGS.press);
1970
1973
  swell.set(1);
1971
- x.tune(SPRINGS.snap);
1974
+ x.tune(LAND);
1972
1975
  x.set(index * slot);
1973
1976
  paint();
1974
1977
  };
@@ -1985,7 +1988,7 @@ function useLensTrack(refs, options) {
1985
1988
  pull(event.clientY - gesture.startY);
1986
1989
  if (!gesture.moved) return;
1987
1990
  const at = position(event.clientX);
1988
- x.tune(SPRINGS.drag);
1991
+ x.tune(DRAG);
1989
1992
  x.set(at);
1990
1993
  const hovered = clamp(Math.round(at / slot), 0, latest.current.count - 1);
1991
1994
  if (hovered !== gesture.hovered) {
@@ -2014,7 +2017,7 @@ function useLensTrack(refs, options) {
2014
2017
  swell.tune(SPRINGS.release);
2015
2018
  swell.set(0);
2016
2019
  letGo();
2017
- x.tune(SPRINGS.snap);
2020
+ x.tune(LAND);
2018
2021
  if (commit && (moved || inside)) {
2019
2022
  suppressClick = true;
2020
2023
  current = index;
@@ -2043,7 +2046,7 @@ function useLensTrack(refs, options) {
2043
2046
  swell.tune(SPRINGS.release);
2044
2047
  swell.set(0);
2045
2048
  letGo();
2046
- x.tune(SPRINGS.snap);
2049
+ x.tune(LAND);
2047
2050
  x.set(current * slot);
2048
2051
  };
2049
2052
  const onClick = (event) => {