summaryrefslogtreecommitdiff
path: root/docs/logo.sc
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2017-11-23 17:03:33 -0800
committerLi Haoyi <haoyi.sg@gmail.com>2017-11-23 17:07:47 -0800
commit78ccc6b5d9973aa2cd268b7e98ba0393798a5eb4 (patch)
tree1c23789f1fcd3acaaae8a04d99b1d420f71f0760 /docs/logo.sc
parent3416790b6f66925c0ad8b23f8da8fd00714afe50 (diff)
downloadmill-78ccc6b5d9973aa2cd268b7e98ba0393798a5eb4.tar.gz
mill-78ccc6b5d9973aa2cd268b7e98ba0393798a5eb4.tar.bz2
mill-78ccc6b5d9973aa2cd268b7e98ba0393798a5eb4.zip
add logo & generating script
Diffstat (limited to 'docs/logo.sc')
-rw-r--r--docs/logo.sc40
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/logo.sc b/docs/logo.sc
new file mode 100644
index 00000000..5d8cee3b
--- /dev/null
+++ b/docs/logo.sc
@@ -0,0 +1,40 @@
+import $ivy.`com.lihaoyi::scalatags:0.6.7`
+import scalatags.Text.implicits._
+import scalatags.Text.svgTags._
+import scalatags.Text.svgAttrs._
+import ammonite.ops._
+
+val svgWidth = 24
+val svgHeight = 24
+val numSections = 3
+val bandWidth = 16
+val bandGap = 8
+val screwPitch = 2.0
+
+def section(verticalOffset: Double) = {
+ val p = sectionLine(0).map{case (x, y) => (x, y + verticalOffset)}
+ val p1 = p.map{case (x, y) => (x, y - bandWidth/2)}
+ val p2 = p.map{case (x, y) => (x, y + bandWidth/2)}
+ (p1 ++ p2.reverse).map{case (x, y) => s"$x,$y"}.mkString(" ")
+}
+
+def sectionLine(startRadians: Double) = for{
+ y <- Seq(-svgHeight / 2, svgHeight / 2)
+} yield {
+ val x = -y * svgWidth / svgHeight
+ (x.toInt + svgWidth/2, y.toInt * screwPitch + svgHeight/2)
+}
+
+val sections = for(i <- -numSections/2 to numSections/2) yield polyline(
+ points := section(i * (bandWidth + bandGap)),
+ fill := "#666",
+)
+val svgFrag = svg(
+ xmlns := "http://www.w3.org/2000/svg",
+ height := svgHeight,
+ width := svgWidth
+)(
+ sections:_*
+)
+
+write.over(pwd/"logo.svg", "<!DOCTYPE html>" + svgFrag) \ No newline at end of file