svg fraction correction exercice
This commit is contained in:
@@ -18,7 +18,7 @@ STYLE = """
|
||||
.h2{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:28px;font-weight:800;fill:#074f4b}
|
||||
.body{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:24px;fill:#1d3038}
|
||||
.small{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:20px;fill:#2d4148}
|
||||
.frac{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:52px;font-weight:800;fill:#074f4b}
|
||||
.frac{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:36px;font-weight:800;fill:#074f4b}
|
||||
.op{font-family:"Trebuchet MS",Verdana,sans-serif;font-size:34px;font-weight:800;fill:#074f4b}
|
||||
.blank{stroke:#7fa79d;stroke-width:3;stroke-dasharray:10 10}
|
||||
.axis{stroke:#26383d;stroke-width:4;stroke-linecap:round}
|
||||
@@ -44,10 +44,10 @@ def fraction(x: int, y: int, n: str | int, d: str | int, size: int = 52) -> str:
|
||||
cx = width / 2
|
||||
return (
|
||||
f'<g transform="translate({x} {y})" class="math-expression fraction-g" '
|
||||
f'data-math="fraction" data-box="-8 -52 {width + 16} 110">'
|
||||
f'<text x="{cx:g}" y="-25" text-anchor="middle" class="frac">{escape(n_text)}</text>'
|
||||
f'data-math="fraction" data-box="-10 -48 {width + 20} 110">'
|
||||
f'<text x="{cx:g}" y="-24" text-anchor="middle" class="frac">{escape(n_text)}</text>'
|
||||
f'<line x1="0" y1="8" x2="{width}" y2="8" stroke="#074f4b" stroke-width="4" stroke-linecap="round" />'
|
||||
f'<text x="{cx:g}" y="62" text-anchor="middle" class="frac">{escape(d_text)}</text>'
|
||||
f'<text x="{cx:g}" y="58" text-anchor="middle" class="frac">{escape(d_text)}</text>'
|
||||
"</g>"
|
||||
)
|
||||
|
||||
@@ -103,7 +103,7 @@ def number_line(x: int, y: int, parts: int, point: int | None = None, width: int
|
||||
def svg_01() -> str:
|
||||
c1 = "".join(
|
||||
fraction(58, y, n, d) + line(190, y + 8, 360, y + 8)
|
||||
for y, (n, d) in zip([145, 255, 365, 475], [(1, 2), (3, 4), (5, 8), (7, 10)])
|
||||
for y, (n, d) in zip([125, 247, 369, 491], [(1, 2), (3, 4), (5, 8), (7, 10)])
|
||||
)
|
||||
c2 = "".join(
|
||||
fraction(58, y, n, d) + text(175, y - 22, "Numerateur :", "small") + line(320, y - 22, 385, y - 22)
|
||||
|
||||
Reference in New Issue
Block a user