Giter VIP home page Giter VIP logo

Comments (4)

oxinabox avatar oxinabox commented on May 26, 2024 1

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

from chainrules.jl.

cormullion avatar cormullion commented on May 26, 2024 1

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()

from chainrules.jl.

oxinabox avatar oxinabox commented on May 26, 2024

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

from chainrules.jl.

oxinabox avatar oxinabox commented on May 26, 2024

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

from chainrules.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.