mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-04 02:34:13 +02:00
render cart
This commit is contained in:
parent
c96f2e6b7b
commit
a4d835f0c6
9 changed files with 97 additions and 12 deletions
|
|
@ -19,6 +19,7 @@ export function Projectile(props: ProjectileProp) {
|
|||
const scaledX = () => x() / worldWidth * props.targetSize.width;
|
||||
const scaledY = () => (worldHeight - y()) / worldHeight * props.targetSize.height;
|
||||
const teamColor = () => (props.projectile.team === Team.Red) ? '#a75d50' : '#5b818f';
|
||||
const filter = () => props.projectile.critical ? ((props.projectile.team === Team.Red) ? 'url(#sofGlowRed)' : 'url(#sofGlowBlue)') : '';
|
||||
|
||||
const transform = () => `translate(${scaledX()} ${scaledY()}) scale(${1 / props.scale})`;
|
||||
const rotate = () => `rotate(${270 - props.projectile.angle})`;
|
||||
|
|
@ -26,10 +27,12 @@ export function Projectile(props: ProjectileProp) {
|
|||
return <g transform={transform()}>
|
||||
<Show when={projectileIsAngled(props.projectile.projectileType)}>
|
||||
<polygon points="-3,-4 0,0 3,-4 0,8" stroke="white" fill={teamColor()}
|
||||
transform={rotate()}/>
|
||||
transform={rotate()}
|
||||
filter={filter()}/>
|
||||
</Show>
|
||||
<Show when={!projectileIsAngled(props.projectile.projectileType)}>
|
||||
<circle r={3} stroke-width={1} stroke="white" fill={teamColor()}/>
|
||||
<circle r={3} stroke-width={1} stroke="white" fill={teamColor()}
|
||||
filter={filter()}/>
|
||||
</Show>
|
||||
</g>
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue