mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 18:24:12 +02:00
fix building opacity
This commit is contained in:
parent
225f008b63
commit
066cf9287f
1 changed files with 56 additions and 55 deletions
|
|
@ -50,14 +50,15 @@ export function Building(props: BuildingProp) {
|
|||
const transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`;
|
||||
const rotate = () => `rotate(${270 - props.building.angle})`;
|
||||
|
||||
const alpha = () => props.building.health / maxHealth;
|
||||
const alpha = () => props.building.health / maxHealth();
|
||||
const imageOpacity = () => props.building.health === 0 ? 0 : (1 + alpha()) / 2;
|
||||
try {
|
||||
const image = () => getBuildingType(props.building.buildingType);
|
||||
return <g transform={transform()}
|
||||
opacity={alpha()}>
|
||||
return <g transform={transform()}>
|
||||
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
|
||||
opacity={alpha()}/>
|
||||
<image href={image()} className={"player-icon"} height={32} width={32} transform={`translate(-16 -16)`}/>
|
||||
<image href={image()} class="player-icon" height={32} width={32} transform={`translate(-16 -16)`}
|
||||
opacity={imageOpacity()}/>
|
||||
<Show when={props.building.angle}>
|
||||
<polygon points="-6,14 0, 16 6,14 0,24" fill="white"
|
||||
transform={rotate()}/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue