Newby request



  • I am new to Drawbot - wishing to convert thousands of lines of code of complex animations from the venerable Nodebox 1.

    Two questions

    1. I need the option to build compound objects (with unions, differences, intersections). Is it possible to make (e.g) a torus by differencing 2 circles. Or do I have to create two bezier paths and then do the difference.

    2. with primitives such as oval or rect, can I incorporate the fill, stroke, strokewidth, etc into the call.
      In Nodebox 1, I can say (e.g)
      a = rect(0,0,20,20,stroke=Red,strokewidth=3,fill=Grey, draw=False)
      This creates an object call a, but does not draw it....

    The sort of movies I wish to emulate in Drawbot can been seen here...



  • hello @KevinKarney, welcome to DrawBot!

    1. I need the option to build compound objects (with unions, differences, intersections). Is it possible to make (e.g) a torus by differencing 2 circles. Or do I have to create two bezier paths and then do the difference.

    both methods are possible:

    you can do it with a single BezierPath by drawing two circles in opposing directions:

    x, y = 500, 500
    r1 = 400
    r2 = 300
    
    B = BezierPath()
    B.oval(x-r1, y-r1, r1*2, r1*2)
    B.reverse()
    B.oval(x-r2, y-r2, r2*2, r2*2)
    
    fill(0, 1, 0)
    stroke(1, 0, 0)
    strokeWidth(10)
    drawPath(B)
    

    or you can draw two separate circles, and get the difference between them:

    B1 = BezierPath()
    B1.oval(x-r1, y-r1, r1*2, r1*2)
    
    B2 = BezierPath()
    B2.oval(x-r2, y-r2, r2*2, r2*2)
    
    B3 = B1.difference(B2)
    
    drawPath(B3)
    

    2. with primitives such as oval or rect, can I incorporate the fill, stroke, strokewidth, etc into the call.
    In Nodebox 1, I can say (e.g)
    a = rect(0,0,20,20,stroke=Red,strokewidth=3,fill=Grey, draw=False)
    This creates an object call a, but does not draw it....

    grouping colors and geometry can be done with functions:

    def a():
        stroke(1, 0, 0)
        strokeWidth(3)
        fill(0.5)
        rect(0, 0, 20, 20)
    
    a()
    

    hope this helps… have fun with the movies, and let us know if you have any other questions.