MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / dist

Function dist

src/content/TextAnimations/TextPressure/TextPressure.jsx:5–9  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

3import { useEffect, useRef, useState, useMemo, useCallback } from 'react';
4
5const dist = (a, b) => {
6 const dx = b.x - a.x;
7 const dy = b.y - a.y;
8 return Math.sqrt(dx * dx + dy * dy);
9};
10
11const getAttr = (distance, maxDist, minVal, maxVal) => {
12 const val = maxVal - Math.abs((maxVal * distance) / maxDist);

Callers 1

animateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected