Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jywarren/logo-svg
A Logo (language) based SVG encoder.
https://github.com/jywarren/logo-svg
Last synced: about 2 months ago
JSON representation
A Logo (language) based SVG encoder.
- Host: GitHub
- URL: https://github.com/jywarren/logo-svg
- Owner: jywarren
- License: gpl-3.0
- Created: 2015-06-18T17:56:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-27T15:27:22.000Z (over 9 years ago)
- Last Synced: 2024-10-14T08:15:46.217Z (3 months ago)
- Language: JavaScript
- Size: 1.07 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#Logo-SVG
**Note!** Abandoning in favor of https://github.com/jywarren/papert - an SVG-enabled fork of the Papert logo parser!
A minimal Logo command set for SVG.js:
* FORWARD/FW
* BACKWARD
* LEFT/LT
* RIGHT/RT
* SETX, SETY, SETXY
* REPEAT `n` [ ... ]
* TO FOO :ARG1 :ARG2 BODY ENDPlanned:
* RESET
* HOME
* CLEARSCREEN/CLEAR/CS
* COLOR [r g b]
* MAKE "X 1 (setting :X to 1)
* IF `COND` [ ... ]Demo at https://jywarren.github.io/logo-svg
Inspired by the `canvas`-based version at https://github.com/rmmh/papert
But intended for lasercutting use, so SVG was needed!
Quite messy, not as generalizable as I'd like, so please chip in!
--Jeffrey Warren (unterbahn.com)
Addendum: As this progressed, it became more about me learning how to write a parser, by trial and error -- a thought experiment.
****
##Developers
You'll need `npm` and bower, the latter with `npm install -g bower`.
I'm slowly cleaning this code up as an exercise for myself, but as of now you'll need to install the Grunt cli:
`npm install -g grunt-cli`
And run `grunt` from the root directory to watch for code changes and compile them into `dist/logosvg.js` on the fly.
****
Sketchpad for parsing math expressions:
This works now, but expressions with variables choke: ":N/360" remains one word, so variable recognition doesn't trigger.
SO! um. We must glob our math expressions *after* variable substitution, OR we must be able to substitute variables buried within words
AND we'd have to consider breaking out our variables into their own words, if they're not space-delimited from a math expressionAND what about parentheses?
AND what about conditionals? Would the above work for conditionals, if we add an IF blockCommand?