fix p5 call push/pop errors
This commit is contained in:
parent
fd55dd9a50
commit
12f1a85e27
|
@ -191,10 +191,10 @@ const turtle_angle = 0.385
|
|||
const turtle_color = [255, 255, 255, 150]
|
||||
|
||||
const p5_call_root = [
|
||||
["background", ...resolve_color(background_color)],
|
||||
["push"],
|
||||
["rotate", Math.PI],
|
||||
["scale", -1, 1],
|
||||
["background", ...resolve_color(background_color)],
|
||||
["stroke", ...resolve_color(turtle_init.pencolor)],
|
||||
]
|
||||
|
||||
|
@ -357,10 +357,10 @@ export function p5 (commands) {
|
|||
for (const call of calls) {
|
||||
p5_calls.push(call)
|
||||
}
|
||||
p5_calls.push(["pop"])
|
||||
}
|
||||
p5_calls[0] = ["background", ...resolve_color(background_color)]
|
||||
p5_render_turtle(states[states.length - 1], p5_calls)
|
||||
p5_calls.push(["pop"])
|
||||
return p5_calls
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,8 @@ import {run, p5} from "./ludus.mjs"
|
|||
const code = `
|
||||
print! ("Hello, world!")
|
||||
pencolor! (colors :white)
|
||||
repeat 10 {
|
||||
repeat 4 {
|
||||
fd! (500)
|
||||
rt! (0.25)
|
||||
}
|
||||
rt! (0.1)
|
||||
}`
|
||||
fd! (50)
|
||||
`
|
||||
|
||||
const result = run(code)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user