diff --git a/build/ludus.mjs b/build/ludus.mjs
index 345ac21..8632864 100644
--- a/build/ludus.mjs
+++ b/build/ludus.mjs
@@ -218,6 +218,10 @@ function turn_to_deg (heading) {
return (heading % 1) * 360
}
+function hex (n) {
+ return n.toString(16).padStart(2, "0")
+}
+
function svg_render_line (prev, curr) {
if (!prev.pendown) return ""
if (eq_vect(prev.position, curr.position)) return ""
@@ -225,7 +229,7 @@ function svg_render_line (prev, curr) {
const {position: [x2, y2]} = curr
const [r, g, b, a] = resolve_color(pencolor)
return `
-
+
`
}
@@ -269,10 +273,10 @@ function svg_render_turtle (state) {
const [x3, y3] = rotate(origin, -turtle_angle)
const [pr, pg, pb, pa] = resolve_color(pencolor)
const pen_alpha = pa/255
- const ink = pendown ? `` : ""
+ const ink = pendown ? `` : ""
return `
-
+
${ink}
`
@@ -300,15 +304,14 @@ export function svg (commands) {
const view_width = (maxX - minX) * 1.2
const view_height = (maxY - minY) * 1.2
const margin = Math.max(view_width, view_height) * 0.1
- const x1 = minX - margin
- // don't actually need these:
- // const y1 = minY - margin
- // const x2 = maxX + margin
- const y2 = maxY + margin
+ const x_origin = minX - margin
+ const y_origin = -maxY - margin
const path = svg_render_path(states)
const turtle = svg_render_turtle(states[states.length - 1])
return `
-