cd /news/robotics/drawbot-generate-a-jellyfish-like-pu… · home topics robotics article
[ARTICLE · art-11632] src=gist.github.com ↗ pub= topic=robotics verified=true sentiment=· neutral

DrawBot: Generate a jellyfish-like pulsating blobby animation.

The article describes a Python script that generates an animated GIF of a jellyfish-like, pulsating blobby shape. The code creates multiple layered blobs that vary in size and phase, using random offsets and Bézier curves to produce an organic, undulating animation. The animation is saved as "Jellyfish.gif" with 95 frames at a duration of 1/20 second per frame.

read1 min views17 publishedJan 6, 2016

Jellyfish.py

  This file contains hidden or 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

Show hidden characters
from random import seed

def varyPoint(pt, radius, phase):

    x, y = pt

    dx = radius * cos(phase)

    dy = radius * sin(phase)

    return x + dx, y + dy

def drawBlob(blobPhase, blobRadius):

    points = []  # list of off curve points forming the blob.

    for i in range(numBlobPoints):

        a = 2 * pi * i / numBlobPoints

        x = blobRadius * cos(a)

        y = blobRadius * sin(a)

        rPhase, rSign = randomPhases[i]

        points.append(varyPoint((x, y), 0.2 * blobRadius, rPhase + rSign * 2 * pi * blobPhase))


    points.append(None)

    bezPath = BezierPath()

    bezPath.qCurveTo(*points)

    bezPath.closePath()

    drawPath(bezPath)

seed(0) # Ok ok, make this animation predictable.

numBlobPoints = 5

randomPhases = [(2 * pi * random(), choice([-1, 1])) for i in range(numBlobPoints)] canvasSize = 500

nBlobs = 24

nFrames = 95

for frame in range(nFrames):

    framePhase = frame / nFrames

    newPage(canvasSize, canvasSize)

    frameDuration(1/20)

    fill(0)

    rect(0, 0, canvasSize, canvasSize)

    translate(canvasSize/2, canvasSize/2)

    strokeWidth(2)

    stroke(1)

    fill(None)

    for i in range(nBlobs):

        blobPhase = i / nBlobs

        radius = 5 + i * 10

        drawBlob(framePhase + blobPhase * 0.75, radius)

saveImage("Jellyfish.gif")
── more in #robotics 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/drawbot-generate-a-j…] indexed:0 read:1min 2016-01-06 ·