From af13e3f184a34368dd4abf31e906fda7827ee910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 7 Aug 2025 12:11:16 -0500 Subject: [PATCH] feat: squishy low --- .../components/Cursor/index.tsx | 8 ++++---- .../AssaultRangesVisualizer/index.tsx | 18 +++++++++++------- packages/website/src/core/blitzkit/fakeLog.ts | 12 ++++++++++-- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx index 7c67c5017..2e6f62f82 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/components/Cursor/index.tsx @@ -3,8 +3,8 @@ import { Box, Flex, Text } from '@radix-ui/themes'; import { useEffect, useRef, useState } from 'react'; import { clamp } from 'three/src/math/MathUtils.js'; import { - fakeLog, - fakeLogInverse, + fakeLogSquishyHigh, + fakeLogSquishyHighInverse, } from '../../../../../../../../../core/blitzkit/fakeLog'; import { Var } from '../../../../../../../../../core/radix/var'; import { Duel } from '../../../../../../../../../stores/duel'; @@ -19,7 +19,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { const assaultDistance = Duel.use( (state) => state.protagonist.assaultDistance, ); - const [x, setX] = useState(fakeLog(assaultDistance / maxDistance, 2)); + const [x, setX] = useState(fakeLogSquishyHigh(assaultDistance / maxDistance)); const cursor = useRef(null); const mutateDuel = Duel.useMutation(); @@ -56,7 +56,7 @@ export function AssaultCursor({ maxDistance, maxFakeDistance }: Props) { function handlePointerUp() { mutateDuel((draft) => { draft.protagonist.assaultDistance = - fakeLogInverse(localX * maxFakeDistance, 2) * maxDistance; + fakeLogSquishyHighInverse(localX * maxFakeDistance) * maxDistance; }); window.removeEventListener('pointermove', handlePointerMove); diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx index f6fa2c03e..cdd089725 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Characteristics/components/AssaultRangesVisualizer/index.tsx @@ -2,7 +2,10 @@ import type { AssaultRanges } from '@blitzkit/core'; import { literals } from '@blitzkit/i18n'; import { Box, Card, Flex, Text } from '@radix-ui/themes'; import { clamp } from 'three/src/math/MathUtils.js'; -import { fakeLog } from '../../../../../../../core/blitzkit/fakeLog'; +import { + fakeLogSquishyHigh, + fakeLogSquishyLow, +} from '../../../../../../../core/blitzkit/fakeLog'; import type { TankCharacteristics } from '../../../../../../../core/blitzkit/tankCharacteristics'; import { Var } from '../../../../../../../core/radix/var'; import { useLocale } from '../../../../../../../hooks/useLocale'; @@ -18,7 +21,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { const ranges = _ranges.ranges.map((range) => ({ factor: range.factor, distance: range.distance, - fakeDistance: fakeLog(range.distance / maxDistance, 2), + fakeDistance: fakeLogSquishyHigh(range.distance / maxDistance), })); const maxFakeDistance = ranges.at(-1)!.fakeDistance; const maxFactor = ranges[0].factor; @@ -55,8 +58,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { style={{ position: 'absolute', left: 0, - top: `${(1 - range.factor) * 100}%`, - transform: 'translateY(-50%)', + bottom: `${fakeLogSquishyLow(range.factor / maxFactor) * 100}%`, + transform: 'translateY(50%)', }} color="gray" size="1" @@ -71,7 +74,8 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { {ranges.map((range, index) => { - const mix = clamp(1.5 * (range.factor - 1) + 1, 0, 1) * 100; + const mix = + clamp(2 * (range.factor / maxFactor - 1) + 1, 0, 1) * 100; const color0 = `color-mix(in hsl, ${Var('tomato-9')}, ${Var('jade-9')} ${mix}%)`; const color1 = `color-mix(in hsl, ${Var('tomato-7')}, ${Var('jade-7')} ${mix}%)`; const last = ranges[index - 1]; @@ -82,7 +86,7 @@ export function AssaultRangesVisualizer({ ranges: _ranges, stats }: Props) { return (