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 transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`;
|
||||||
const rotate = () => `rotate(${270 - props.building.angle})`;
|
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 {
|
try {
|
||||||
const image = () => getBuildingType(props.building.buildingType);
|
const image = () => getBuildingType(props.building.buildingType);
|
||||||
return <g transform={transform()}
|
return <g transform={transform()}>
|
||||||
opacity={alpha()}>
|
|
||||||
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
|
<circle r={16} stroke-width={1} stroke="white" fill={teamColor()}
|
||||||
opacity={alpha()}/>
|
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}>
|
<Show when={props.building.angle}>
|
||||||
<polygon points="-6,14 0, 16 6,14 0,24" fill="white"
|
<polygon points="-6,14 0, 16 6,14 0,24" fill="white"
|
||||||
transform={rotate()}/>
|
transform={rotate()}/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue