Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/enzet/iconscript
Generating icons using text commands
https://github.com/enzet/iconscript
antlr go icons
Last synced: about 2 months ago
JSON representation
Generating icons using text commands
- Host: GitHub
- URL: https://github.com/enzet/iconscript
- Owner: enzet
- Created: 2022-08-28T13:21:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-23T19:18:49.000Z (about 2 years ago)
- Last Synced: 2024-06-21T18:12:08.962Z (7 months ago)
- Topics: antlr, go, icons
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# iconscript
Paperscript parser for icon shape drawing.
This is a part of [Map Machine](https://github.com/enzet/map-machine) project.
## JavaScript part
Install:
```shell
npm install paper paperjs-offset
npm install -g live-server
```Run:
```shell
live-server
```## Go part
Requires: Go 1.19, ANTLR 4.10.1.
Install:
```shell
cd grammar
antlr -Dlanguage=Go -o parser IconScript.g4
cd ..
go build
```You may also test installation with `go test`.
```shell
go run main.go -i
```## Syntax
### Global context
- __width__ — stroke width.
- __position__ — current position of the cursor.### Commands
`` is 2D coordinates in the form `,` or `+,` (`+` means,
that the position is relative to the __position__).| Command | Description |
|---|---|
| `a` | Set adding mode (default mode) |
| `r` | Set removing mode |
| `w ` | Set __width__ to a value |
| `p ` | Set __position__ to a value |
| `l []` | Draw lines between positions |
| `c ` | Draw circle specified by center point and radius |
| `s ` | Draw rectangle specified by top left and bottom right points |
| `ar ` | Draw arc specified by center point, radius, and two angles in radians |### Variables
Variable can be defined with ` = []` and accessed with
`@`.### Example
```iconscript
cube = lf +0,0 +2,0 +0,2 +-2,0 +0,-2
{
%glider
p 6,2 @cube p +4,4 @cube
p +-8,4 @cube p +4,0 @cube p +4,0 @cube
}
```