Skip to content

Instantly share code, notes, and snippets.

Avatar

Just van Rossum justvanrossum

View GitHub Profile
@justvanrossum
justvanrossum / circlewavegrid.py
Last active Jun 21, 2016
Create a wavy animaton with DrawBot
View circlewavegrid.py
# Physics stolen from:
# http://giphy.com/gifs/wave-circle-point-13ePqdDflwat9e
def blobPos(pt, r, a):
x, y = pt
x += cos(a) * r
y += sin(a) * r
return (x, y)
def drawGrid(cells):
@justvanrossum
justvanrossum / TheBlob.py
Last active Jun 28, 2019
Generate a blobby animated gif with DrawBot.
View TheBlob.py
# FREQUENCY = 1
# http://dailydrawbot.tumblr.com/post/135252661206/the-blob
# FREQUENCY = 2
# http://dailydrawbot.tumblr.com/post/135266061309/the-blob-2
def centerOval(pt, radiusX, radiusY):
x, y = pt
oval(x - radiusX, y - radiusY, 2 * radiusX, 2 * radiusY)
@justvanrossum
justvanrossum / StackOfSquares.py
Last active Aug 1, 2020
Create a simple animation with Python in DrawBot
View StackOfSquares.py
# This script is part of a tutorial screencast: https://vimeo.com/149247423
CANVAS = 500
SQUARESIZE = 158
NSQUARES = 50
SQUAREDIST = 6
width = NSQUARES * SQUAREDIST
NFRAMES = 50
@justvanrossum
justvanrossum / MarcelDuchampRotoRelief.py
Last active Feb 14, 2018
DrawBot: Emulate some of Marcel Duchamp's Rotoreliefs.
View MarcelDuchampRotoRelief.py
# An interpretation of Marcel Duchamp's Rotoreliefs, as seen in his 1926 movie Anemic Cinema:
# https://www.youtube.com/watch?v=dXINTf8kXCc
def circle(pt, radius):
diameter = 2 * radius
x, y = pt
oval(x - radius, y - radius, diameter, diameter)
canvasSize = 500
nFrames = 64 # 64
@justvanrossum
justvanrossum / EllsworthKellySeine.py
Last active Jan 5, 2016
DrawBot: A moving tribute to Ellsworth Kelly's "Seine" (1951).
View EllsworthKellySeine.py
# A moving tribute to Ellsworth Kelly's "Seine" (1951).
from random import seed # seed() allows us to get repeatable pseudo-noise
def expandGrid(pixels):
assert len(pixels) % 2
mid = len(pixels) // 2
midColumn = pixels[mid]
pixels.insert(mid + 1, list(midColumn))
pixels.insert(mid + 0, list(midColumn))
@justvanrossum
justvanrossum / Jellyfish.py
Last active Mar 10, 2020
DrawBot: Generate a jellyfish-like pulsating blobby animation.
View Jellyfish.py
# Generate a jellyfish-like pulsating blobby animation.
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
@justvanrossum
justvanrossum / VasarelyCircles.py
Last active Jan 30, 2016
DrawBot: Generate a moving interpretation of works by Victor Vasarely.
View VasarelyCircles.py
# http://dailydrawbot.tumblr.com/post/136811506080/circles-after-victor-vasarely-source-code
#
# Based on works by Victor Vasarely
# https://s-media-cache-ak0.pinimg.com/originals/a6/df/1f/a6df1fc5d2dd07d79a44c3aea5172b59.jpg
# https://s-media-cache-ak0.pinimg.com/736x/1e/38/82/1e38820f1304c8750de216a31a5f5abe.jpg
# http://interiorator.com/wp-content/uploads/2013/07/Vasarely-01.jpg
def circle(pt, radius):
diameter = 2 * radius
x, y = pt
@justvanrossum
justvanrossum / SphericalSpiral.py
Created Feb 4, 2016
DrawBot: An Archimedean Spherical Spiral animation.
View SphericalSpiral.py
# This borrows heavily from:
# http://jsfiddle.net/Rebug/5uLr7s6o/
#
# Resulting gif:
# http://dailydrawbot.tumblr.com/post/134989689114/an-archimedean-spherical-spiral
import math
import colorsys
def circle(pt, radius):
@justvanrossum
justvanrossum / PsychoDonut.py
Last active Feb 10, 2016
DrawBot: Create an animated flower-like pattern by drawing circles on a donut.
View PsychoDonut.py
# nCirclesH = 18; nCirclesV = 6:
# http://dailydrawbot.tumblr.com/post/138985675364/psychodonut-2
# nCirclesH = 38; nCirclesV = 28:
# http://dailydrawbot.tumblr.com/post/139047595845/psychodonut-3
def project(x, y, innerR, outerR, phase):
# convert from "donut space" to normal space
angle = 2 * pi * x
f = (cos(phase + pi * y) + 1) / 2
R = innerR + f * (outerR - innerR)
@justvanrossum
justvanrossum / OscilloscopeLissajous.py
Last active Mar 24, 2016
DrawBot: Generate an animation simulating an oscilloscope showing a Lissajous curve.
View OscilloscopeLissajous.py
# http://dailydrawbot.tumblr.com/post/141565208389/oscilloscope-lissajous
canvasSize = 500
nFrames = 20
nSteps = 20
radius = 195
nEchoes = 20
nScopeLines = 10
xFrequency = 3
yFrequency = 4
You can’t perform that action at this time.