ui: targeting tweaks

This commit is contained in:
cha0s 2024-06-24 09:29:11 -05:00
parent 56ab4d73e5
commit 7212e55ba5

View File

@ -12,7 +12,7 @@ const radius = 17;
function makeFade(renderer) {
const fade = new Graphics();
fade.beginFill(0xffffff);
fade.alpha = 0.4;
fade.alpha = 0.5;
fade.drawCircle(
tileSize.x * (radius / 2),
tileSize.y * (radius / 2),
@ -61,12 +61,13 @@ const TargetingGhostInternal = PixiComponent('TargetingGhost', {
container.addChild(fade, grid, innerGrid);
return container;
},
applyProps: (container, oldProps, {x, y, tint}) => {
applyProps: (container, oldProps, {x, y, pulse}) => {
container.x = x - (x % tileSize.x) + (tileSize.x / 2) - (tileSize.x * (radius / 2));
container.y = y - (y % tileSize.y) + (tileSize.y / 2) - (tileSize.y * (radius / 2));
container.children[0].alpha = 0.5 + (pulse / 2);
container.children[0].x = x % tileSize.x - (tileSize.x / 2) ;
container.children[0].y = y % tileSize.y - (tileSize.y / 2) ;
const color = Math.round(255 - (tint * 255));
const color = Math.round(255 - (pulse * 255));
container.children[2].tint = `rgb(${color}, ${color}, ${color})`;
},
})
@ -87,7 +88,7 @@ export default function TargetingGhost({x, y}) {
app={app}
x={x}
y={y}
tint={(Math.cos(radians) + 1) * 0.5}
pulse={(Math.cos(radians) + 1) * 0.5}
/>
);
}