Compare commits
3 Commits
479e304357
...
73b2343963
Author | SHA1 | Date | |
---|---|---|---|
|
73b2343963 | ||
|
1733de7dff | ||
|
be9a86a973 |
Binary file not shown.
|
@ -194,11 +194,11 @@ function rotate (vector, heading) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function turn_to_rad (heading) {
|
function turn_to_rad (heading) {
|
||||||
return heading * 2 * Math.PI
|
return (heading % 1) * 2 * Math.PI
|
||||||
}
|
}
|
||||||
|
|
||||||
function turn_to_deg (heading) {
|
function turn_to_deg (heading) {
|
||||||
return (heading * 360)
|
return ((heading % 1) * 360)
|
||||||
}
|
}
|
||||||
|
|
||||||
function svg_render_line (prev, curr) {
|
function svg_render_line (prev, curr) {
|
||||||
|
|
BIN
build/out.wasm
BIN
build/out.wasm
Binary file not shown.
16
build/p5_test.mjs
Normal file
16
build/p5_test.mjs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import {run, p5} from "./ludus.mjs"
|
||||||
|
|
||||||
|
const code = `
|
||||||
|
pencolor! (colors :white)
|
||||||
|
repeat 10 {
|
||||||
|
repeat 4 {
|
||||||
|
fd! (500)
|
||||||
|
rt! (0.25)
|
||||||
|
}
|
||||||
|
rt! (0.1)
|
||||||
|
}`
|
||||||
|
|
||||||
|
const result = run(code)
|
||||||
|
|
||||||
|
console.log(result.io.stdout.data)
|
||||||
|
console.log(p5(result.io.turtle.data))
|
|
@ -1,15 +1,15 @@
|
||||||
import {run, svg} from "./ludus.mjs"
|
import {run, svg} from "./ludus.mjs"
|
||||||
|
|
||||||
const code = `
|
const code = `
|
||||||
print! (random ())
|
pencolor! (colors :white)
|
||||||
print! (random ())
|
repeat 10 {
|
||||||
print! (random ())
|
repeat 4 {
|
||||||
print! (random ())
|
fd! (500)
|
||||||
print! (random ())
|
rt! (0.25)
|
||||||
print! (random ())
|
}
|
||||||
|
rt! (0.1)
|
||||||
`
|
}`
|
||||||
|
|
||||||
const result = run(code)
|
const result = run(code)
|
||||||
|
|
||||||
console.log(result.io.stdout.data)
|
console.log(svg(result.io.turtle.data))
|
||||||
|
|
4019
build/svg_test.svg
4019
build/svg_test.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 338 KiB After Width: | Height: | Size: 7.7 KiB |
Loading…
Reference in New Issue
Block a user