Created
July 5, 2020 17:41
-
-
Save cormullion/db3cccf077abcfa92da9fdd2edbf4e11 to your computer and use it in GitHub Desktop.
Julia streamer logo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Luxor, ColorSchemes | |
function sinecurveincreasing(thecurve, width=5.0; initialwidth=1, finalwidth=2) | |
leftcurve = Point[] | |
rightcurve = Point[] | |
for n in 1:length(thecurve)-1 | |
# find slope of curve at those points | |
pt1 = Point(thecurve[n].x, cos(thecurve[n].y)) | |
# find normals normal is 1/slope | |
slopept1 = -1/(pt1.y/pt1.x) | |
# find perpendiculars | |
perp1 = perpendicular(thecurve[n], thecurve[mod1(n+1, length(thecurve))], -width) | |
perp2 = perpendicular(thecurve[n], thecurve[mod1(n+1, length(thecurve))], width) | |
push!(leftcurve, perp1) | |
push!(rightcurve, perp2) | |
width = rescale(n, 1, length(thecurve), initialwidth, finalwidth) | |
end | |
return vcat(leftcurve, reverse(rightcurve)) | |
end | |
Drawing(500, 500, "juliastreamer.svg") | |
origin() | |
squircle(O, 240, 240, :clip, rt=0.1) | |
background("black") | |
rotate(pi/2) | |
thecurve = [Point(20 + 10x, 10sin(x)) for x in 0:pi/24:14pi] | |
for (n, i) in enumerate(0:pi/12:2pi) | |
@layer begin | |
rotate(i) | |
sethue([Luxor.darker_red, Luxor.darker_purple, Luxor.darker_green][mod1(n, 3)]) | |
o = sinecurveincreasing(thecurve, .1, initialwidth=0.5, finalwidth=25) | |
poly(o, :fill) | |
end | |
end | |
squircle(O, 30, 30, :clip) | |
t = Table(2, 2, 50, 50) | |
for p in t | |
sethue([Luxor.darker_red, Luxor.darker_purple, Luxor.darker_green, Luxor.darker_blue][mod1(p[2], 4)]) | |
box(p[1], t.colwidths[1], t.rowheights[1], :fill) | |
end | |
clipreset() | |
finish() | |
preview() | |
#run(`svgo juliastreamer.svg -o juliastreamer-min.svg`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment