Files
blitzkit/packages/website/src/components/GuessRenderer.tsx
T

28 lines
1.0 KiB
TypeScript
Raw Normal View History

2025-09-01 22:56:39 -05:00
import { Guess, GuessState } from "../stores/guess";
2025-09-01 19:22:38 -05:00
import { SmartCanvas } from "./SmartCanvas";
import { Controls } from "./Tankopedia/HeroSection/components/TankSandbox/components/Control";
import { Lighting } from "./Tankopedia/HeroSection/components/TankSandbox/components/Lighting";
import { TankModel } from "./Tankopedia/HeroSection/components/TankSandbox/components/TankModel";
2025-05-04 13:08:28 -05:00
const BRIGHTNESS = 2 ** -5.5;
2025-05-05 21:05:46 -05:00
const CONTRAST = 2 ** 2;
2025-05-04 21:02:50 -05:00
2025-05-04 13:08:28 -05:00
export function GuessRenderer() {
2025-09-01 19:22:38 -05:00
const guessState = Guess.use((state) => state.guessState);
2025-09-01 22:55:31 -05:00
const isRevealed = guessState !== GuessState.NotGuessed;
2025-05-04 13:08:28 -05:00
return (
2025-08-11 11:25:25 -05:00
<SmartCanvas
2025-05-04 13:08:28 -05:00
style={{
2025-05-05 21:05:46 -05:00
filter: `grayscale(${isRevealed ? 0 : 1}) contrast(${isRevealed ? 1 : CONTRAST}) brightness(${isRevealed ? 1 : BRIGHTNESS})`,
2025-09-01 19:22:38 -05:00
transitionDuration: isRevealed ? "2s" : undefined,
transitionProperty: "filter",
2025-05-04 13:08:28 -05:00
}}
camera={{ position: [-5, 5, -5] }}
>
<Controls zoomable={false} />
2025-08-29 13:26:34 -05:00
<Lighting />
2025-05-04 13:08:28 -05:00
<TankModel />
2025-08-11 11:25:25 -05:00
</SmartCanvas>
2025-05-04 13:08:28 -05:00
);
}