프로젝트
소개
SVG by Numbers
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalsbn
A compiler for small drawing language sbn(SVG by Numbers). Inspired by John Maeda's book: Design by Numbers.
Supported Keywords
This compiler is work-in-progress. Here is a list of commands currently supported (v0.4.3) & planning to implement. (sbn language specification is compatible with Design by Numbers chapter 1 - 12)
-
Paper -
Pen -
Line -
// comment -
Set(variable) -
{ }(block) - Nested block
-
Repeat -
(+ - / *)(calculations) -
[x, y](dot) - Copy Dots (calculation on dot)
-
Same ? / NotSame?(question) -
Smaller ? / NotSmaller?(question) -
Command(function) -
Load(import)
usage
browser
include sbn.js in your html, sbn object will be available in global scope.
<script src="./lib/sbn.js"></script>
Call compile method. The compiler creates SVG out of sbn code you passed.
var code = 'Paper 95\nPen 1\nLine 50 15 85 80\nPen 30\nLine 85 80 15 80\nPen 70\nLine 15 80 50 15'
var svg = sbn.compile(code)
document.body.innerHTML = svg
node
You can run sbn compiler on node to create SVG file.
var fs = require('fs')
var sbn = require('sbn')
var code = `
Paper 95
Pen 1
Line 50 15 85 80
Pen 30
Line 85 80 15 80
Pen 70
Line 15 80 50 15
`
fs.writeFile("sbn_drawing.svg", sbn.compile(code), function(err) {
console.log('SVG was saved!')
})
License
Copyright 2016 Mariko Kosaka
Code licensed under the Apache-2.0 License Documentation licensed under CC BY-SA 4.0
관련 프로젝트 살펴보기
불러오는 중…