WildyLoopyThing



  • A simple little Perlin Noise animation thing 🙂
    0_1515422425702_wildyloopything.gif

    # Requires caseman perlin noise: clone and install > https://github.com/caseman/noise
    import noise
    import random
    import math
    
    points = []
    
    size = 500
    nthing = 60
    baseSizeRatio = .2
    ncircle = 5
    for e in range(ncircle):  
        n = (e+1)/ncircle
        for i in range(nthing):
            phase = i / nthing
            x = size*.5 - n*baseSizeRatio*size * math.sin(2*math.pi*phase)
            y = size*.9 - .5*(1-n)*size - (1-n)*baseSizeRatio*size - .1*n*baseSizeRatio*size * math.cos(2*math.pi*phase)
            c = (0, 1, .5, .8*(y/size) )
            l = 10+ 10*random.random()
            t = 1
            points.append((x, y, c, l, t))
    
    length = 10
    frames = 100
    
    for f in range(frames):
        
        newPage(size, size)
        frameDuration(1/15)
        fill(0) 
        rect(0, 0, size, size) 
        fill(None) 
        
        for p in points:
            strokeWidth(p[4])
            stroke(p[2][0], p[2][1], p[2][2], p[2][3])
            path = BezierPath()
            
            prev_x = p[0]
            prev_y = p[1]  + (p[1]/size)*50*math.sin(noise.pnoise2(.1*p[0]*.1*p[1], .1*abs(frames*.5-f)))
            path.moveTo((prev_x, prev_y))
            for l in range(length):
                dx = int(p[3]*math.sin(noise.pnoise2(.1*p[0], (abs(frames*.5-f)+l)*.1 )))
                dy = -int(p[3]*math.cos(noise.pnoise2(.1*p[1], (abs(frames*.5-f)+l)*.1 )))
                path.lineTo((prev_x, prev_y))
                prev_x += dx
                prev_y += dy
            drawPath(path)
            
    saveImage("~/Desktop/wildyloopything.gif")
    

  • admin

    nice and hairy!!



  • This is really cool! I'd love to try it, but I couldn't figure out how to hook the noise module to drawbot. I got it to install in terminal, but drawbot still doesn't recognize it. Can you help a Python newbie out, please!?


  • admin

    Currently there are two version of DrawBot available a version with python2.7 and one with python3.6.

    DrawBot can only access the external packages with the same python version. So if you have installed the package for py2.7, you should use DrawBotPy2.

    The latest DrawBot uses internally python 3.6. If you want drawBot to access external packages, you need to install those packages locally with the same python, otherwise DrawBot will not find them.

    I assume you haven't installed python 3.6 yet:

    good luck



  • @frederik Got it! Installing it on Python3 did the trick. Thanks for the tip. 💯


  • admin

    well done! achievement unlock!


Log in to reply
 

Looks like your connection to DrawBot Forum was lost, please wait while we try to reconnect.