mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 11:39:51 +01:00
feat: better coloring
This commit is contained in:
1 parent
2c0f9184db
commit
c6249c5a83
3 files changed
+17
-12
No files matched your search
@@ -40,7 +40,7 @@ export function HeroSection({ id }: HeroSectionProps) {
|
|||||||
const entries = Object.values(awaitedTankDefinitions);
|
const entries = Object.values(awaitedTankDefinitions);
|
||||||
const filtered = entries.filter((thisTank) => thisTank.tier === tank.tier);
|
const filtered = entries.filter((thisTank) => thisTank.tier === tank.tier);
|
||||||
const value =
|
const value =
|
||||||
filtered.reduce((accumulator, thisTank) => {
|
(filtered.reduce((accumulator, thisTank) => {
|
||||||
return (
|
return (
|
||||||
accumulator +
|
accumulator +
|
||||||
resolveNearPenetration(
|
resolveNearPenetration(
|
||||||
@@ -48,7 +48,8 @@ export function HeroSection({ id }: HeroSectionProps) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}, 0) /
|
}, 0) /
|
||||||
((4 / 3) * filtered.length);
|
filtered.length) *
|
||||||
|
(3 / 4);
|
||||||
|
|
||||||
return { value } satisfies ThicknessRange;
|
return { value } satisfies ThicknessRange;
|
||||||
}, [tank.tier]);
|
}, [tank.tier]);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export function Thicknesses({ thicknessRange }: ThicknessesProps) {
|
|||||||
>
|
>
|
||||||
<Flex direction="column" align="end" justify="between">
|
<Flex direction="column" align="end" justify="between">
|
||||||
<Text color="gray" size="1">
|
<Text color="gray" size="1">
|
||||||
{thicknessRange.value.toFixed(0)}
|
{(thicknessRange.value * 1.5).toFixed(0)}
|
||||||
</Text>
|
</Text>
|
||||||
<Flex gap="1">
|
<Flex gap="1">
|
||||||
{showPrimaryArmor ? <EyeOpenIcon /> : <EyeClosedIcon />}
|
{showPrimaryArmor ? <EyeOpenIcon /> : <EyeClosedIcon />}
|
||||||
@@ -66,7 +66,7 @@ export function Thicknesses({ thicknessRange }: ThicknessesProps) {
|
|||||||
style={{
|
style={{
|
||||||
borderRadius: 'var(--radius-full)',
|
borderRadius: 'var(--radius-full)',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
background: `linear-gradient(rgb(255, 0, 0), rgb(0, 255, 0))`,
|
background: `linear-gradient(rgb(128, 0, 0), rgb(255, 0, 0) 33%, rgb(0, 255, 0))`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -32,10 +32,6 @@ import { ArmorType } from '../SpacedArmorScene';
|
|||||||
import { SpacedArmorSubExternal } from './components/SpacedArmorSubExternal';
|
import { SpacedArmorSubExternal } from './components/SpacedArmorSubExternal';
|
||||||
import { SpacedArmorSubSpaced } from './components/SpacedArmorSubSpaced';
|
import { SpacedArmorSubSpaced } from './components/SpacedArmorSubSpaced';
|
||||||
|
|
||||||
function to255(value: number) {
|
|
||||||
return Math.round(255 * value);
|
|
||||||
}
|
|
||||||
|
|
||||||
type SpacedArmorSceneComponentProps = {
|
type SpacedArmorSceneComponentProps = {
|
||||||
node: Object3D;
|
node: Object3D;
|
||||||
thickness: number;
|
thickness: number;
|
||||||
@@ -100,7 +96,7 @@ export function SpacedArmorSceneComponent({
|
|||||||
const camera = useThree((state) => state.camera);
|
const camera = useThree((state) => state.camera);
|
||||||
|
|
||||||
if (props.static) {
|
if (props.static) {
|
||||||
const x = clamp(thickness / props.thicknessRange.value, 0, 1);
|
const x = thickness / props.thicknessRange.value;
|
||||||
|
|
||||||
let color: Color;
|
let color: Color;
|
||||||
let opacity: number;
|
let opacity: number;
|
||||||
@@ -108,13 +104,21 @@ export function SpacedArmorSceneComponent({
|
|||||||
|
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case ArmorType.Primary:
|
case ArmorType.Primary:
|
||||||
color = new Color(-((1 - x) ** 2) + 1, -(x ** 2) + 1, 0);
|
if (x > 1) {
|
||||||
|
color = new Color(Math.max(2 - x, 0.5), 0, 0);
|
||||||
|
} else {
|
||||||
|
color = new Color(-((1 - x) ** 2) + 1, -(x ** 2) + 1, 0);
|
||||||
|
}
|
||||||
opacity = 1;
|
opacity = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmorType.Spaced:
|
case ArmorType.Spaced:
|
||||||
color = new Color(1 - (7 / 8) * x, 0, 1 - (1 / 8) * x);
|
color = new Color(
|
||||||
opacity = x + 1 / 2;
|
clamp(1 - (7 / 8) * x, 0, 1),
|
||||||
|
0,
|
||||||
|
clamp(1 - (1 / 8) * x, 0, 1),
|
||||||
|
);
|
||||||
|
opacity = clamp(x + 1 / 2, 0, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmorType.External:
|
case ArmorType.External:
|
||||||
|
|||||||
Reference in new issue
Block a user