mirror of
https://github.com/enzet/map-machine.git
synced 2025-08-06 10:09:52 +02:00
Issue #76: add gradient for craters.
This commit is contained in:
parent
c88616fa68
commit
a92d59a21e
1 changed files with 15 additions and 3 deletions
|
@ -264,12 +264,24 @@ class Crater(Tagged):
|
||||||
scale: float = flinger.get_scale(self.coordinates)
|
scale: float = flinger.get_scale(self.coordinates)
|
||||||
assert "diameter" in self.tags
|
assert "diameter" in self.tags
|
||||||
radius: float = float(self.tags["diameter"]) / 2.0
|
radius: float = float(self.tags["diameter"]) / 2.0
|
||||||
|
radial_gradient = svg.radialGradient(
|
||||||
|
center=self.point + np.array((0, radius * scale / 7)),
|
||||||
|
r=radius * scale,
|
||||||
|
gradientUnits="userSpaceOnUse",
|
||||||
|
)
|
||||||
|
color: Color = Color("#000000")
|
||||||
|
gradient = svg.defs.add(radial_gradient)
|
||||||
|
(
|
||||||
|
gradient
|
||||||
|
.add_stop_color(0, color.hex, opacity=0)
|
||||||
|
.add_stop_color(0.7, color.hex, opacity=0)
|
||||||
|
.add_stop_color(1, color.hex, opacity=1)
|
||||||
|
) # fmt: skip
|
||||||
circle = svg.circle(
|
circle = svg.circle(
|
||||||
self.point,
|
self.point,
|
||||||
radius * scale,
|
radius * scale,
|
||||||
fill="none",
|
fill=gradient.get_paint_server(),
|
||||||
stroke="#000000",
|
opacity=0.2,
|
||||||
opacity=0.3,
|
|
||||||
)
|
)
|
||||||
svg.add(circle)
|
svg.add(circle)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue