Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logo? #109

Closed
oxinabox opened this issue Sep 21, 2019 · 4 comments · Fixed by #113
Closed

Logo? #109

oxinabox opened this issue Sep 21, 2019 · 4 comments · Fixed by #113

Comments

@oxinabox
Copy link
Member

It would brighten up the docs to have a nice logo.

This is what i have so far.

using Luxor
using Random

const bridge_len = 50

function chain(jiggle=0)
    shaky_rotate(θ) = rotate(θ + jiggle*(rand()-0.5))
    
    ### 1
    shaky_rotate(0)
    sethue(Luxor.julia_red)
    translate(0,-150);
    link()
    m1 = getmatrix()
    
    
    ### 2
    sethue(Luxor.julia_green)
    translate(-50, 130);
    shaky_rotate(π/3); 
    link()
    m2 = getmatrix()
    
    setmatrix(m1)
    sethue(Luxor.julia_red)
    sector(Point(0, bridge_len), 50, 90, 0, -1.3π, :fill)
    setmatrix(m2)
    
    ### 3
    shaky_rotate(-π/3);
    translate(-120,80);
    sethue(Luxor.julia_purple)
    link()
    
    setmatrix(m2)
    setcolor(Luxor.julia_green)
    sector(Point(0, bridge_len), 50, 90, -0., -1.5π, :fill)
end


function link()
    sector(50, 90, π, 0, :fill)
    sector(Point(0, bridge_len), 50, 90, 0, -π, :fill)
    
    sector(54, 90, π, 0, :fill)
    sector(Point(0, bridge_len), 50, 90, 0, -π, :fill)
    
    rect(50,-3,40, bridge_len+6, :fill)
    rect(-50-40,-3,40, bridge_len+6, :fill)
end

Random.seed!(1)
@png begin
    background("black")
    chain(0.5)
end

logo showing 3 links in a chain

@oxinabox
Copy link
Member Author

oxinabox commented Sep 22, 2019

A version with a border on the links

image

image

const bridge_len = 50

function chain(jiggle=0)
    shaky_rotate(θ) = rotate(θ + jiggle*(rand()-0.5))
    
    ### 1
    shaky_rotate(0)
    sethue(Luxor.julia_red)
    translate(0,-150);
    link()
    m1 = getmatrix()
    
    
    ### 2
    sethue(Luxor.julia_green)
    translate(-50, 130);
    shaky_rotate(π/3); 
    link()
    m2 = getmatrix()
    
    setmatrix(m1)
    sethue(Luxor.julia_red)
    overlap(-1.3π)
    setmatrix(m2)
    
    ### 3
    shaky_rotate(-π/3);
    translate(-120,80);
    sethue(Luxor.julia_purple)
    link()
    
    setmatrix(m2)
    setcolor(Luxor.julia_green)
    overlap(-1.5π)
end


function link()
    sector(50, 90, π, 0, :fill)
    sector(Point(0, bridge_len), 50, 90, 0, -π, :fill)
    
    
    rect(50,-3,40, bridge_len+6, :fill)
    rect(-50-40,-3,40, bridge_len+6, :fill)
    
    sethue("black")
    move(Point(-50, bridge_len))
    arc(Point(0,0), 50, π, 0, :stoke)
    arc(Point(0, bridge_len), 50, 0, -π, :stroke)
    
    move(Point(-90, bridge_len))
    arc(Point(0,0), 90, π, 0, :stoke)
    arc(Point(0, bridge_len), 90, 0, -π, :stroke)
    strokepath()
end

function overlap(ang_end)
    sector(Point(0, bridge_len), 50, 90, -0., ang_end, :fill)
    sethue("black")
    arc(Point(0, bridge_len), 50, 0, ang_end, :stoke)
    move(Point(90, bridge_len))
    arc(Point(0, bridge_len), 90, 0, ang_end, :stoke)

    strokepath()
    #arc(Point(0, bridge_len), 50, ang_end, 0, :stoke)
end

@oxinabox
Copy link
Member Author

This is me playing around with a loop verision.
I like the line better as chainrules don't work in unending loops

img

const bridge_len = 50

function loop(jiggle=0)
    shaky_rotate(θ) = rotate(θ + jiggle*(rand()-0.5))
    
    ### 1
    shaky_rotate(0)
    sethue(Luxor.julia_red)
    translate(0,-150);
    link()
    m1 = getmatrix()
    
    
    ### 2
    sethue(Luxor.julia_green)
    translate(-50, 130);
    shaky_rotate(2π/3); 
    link()
    m2 = getmatrix()
    
    setmatrix(m1)
    sethue(Luxor.julia_red)
    overlap(-1.3π)
    setmatrix(m2)
    
    ### 3
    translate(-50, 130);
    shaky_rotate(2π/3);    
    sethue(Luxor.julia_purple)
    link()
    
    setmatrix(m2)
    setcolor(Luxor.julia_green)
    overlap(0.7π)
    
    
    setmatrix(m1)
    sethue(Luxor.julia_red)
    nega_overlap(π)
end

function nega_overlap(ang_end)
    sector(Point(0, 0), 50, 90, ang_end, -0., :fill)
    sethue("black")
    arc(Point(0, 0), 50, ang_end, 0, :stoke)
    move(Point(90, 0))
    carc(Point(0, 0), 90, 0, ang_end, :stoke)

    strokepath()
    #arc(Point(0, bridge_len), 50, ang_end, 0, :stoke)
end

@svg begin
    rotate(π/2)
    loop()
end

@cormullion
Copy link

These are great! It’s very satisfying to see what a really maths-capable user can do with this stuff. 😂

To get a transparent background for an icon you’ll have to replace the @svg...end construct with:

Drawing()
origin()
...
finish()
preview()

@oxinabox
Copy link
Member Author

These are great! It’s very satisfying to see what a really maths-capable user can do with this stuff. 😂

No math here.
But thanks

@oxinabox oxinabox mentioned this issue Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants