Skip to content

Instantly share code, notes, and snippets.

@cormullion
Last active April 29, 2019 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cormullion/350fbd3d34c53be1b3d0aab27e599d97 to your computer and use it in GitHub Desktop.
Save cormullion/350fbd3d34c53be1b3d0aab27e599d97 to your computer and use it in GitHub Desktop.
label tag
using Luxor
function drawtag(w, h, pos;
ratio = 0.2,
rotation = 0)
@layer begin
translate(pos)
rotate(rotation)
shape = box(O + (w/4, 0), w, h, vertices=true)
# need point middle/left of box
insert!(shape, 2, midpoint(shape[1], shape[2]))
ratio = h/2 / w
# move left corners along
shape[3] = between(shape[3], shape[4], ratio)
shape[1] = between(shape[1], shape[5], ratio)
newpath()
polysmooth(shape, 5, :path)
newsubpath()
circlepath(O, h/6, :path)
fillpath()
end
end
Drawing(500, 500, "/tmp/tagbot.svg")
background(0, 0, 0, 0)
origin()
darkercols = [Luxor.darker_red, Luxor.darker_green, Luxor.darker_purple, ]
lightercols = [Luxor.lighter_red, Luxor.lighter_green, Luxor.lighter_purple,]
translate(0, 40)
juliacircleradius = 140
setline(10)
for (k, pos) in enumerate(ngon(O, juliacircleradius, 3, π/6, vertices=true))
setcolor(lightercols[k])
circle(pos, 100, :fill)
setcolor(darkercols[k])
circle(pos, 100, :stroke)
setcolor("white")
drawtag(100, 100/MathConstants.golden, pos - (20, 20), rotation=π/4)
end
finish()
preview()
@cormullion
Copy link
Author

Screenshot 2019-04-29 at 09 38 27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment