Skip to content

Instantly share code, notes, and snippets.

@tildebyte
tildebyte / Tentacles.pyde
Last active August 29, 2015 14:18
Tentacles sketch
'''A sketch inspired by (a radical misinterpretation of) the math from the
JS1K segment of Steven Wittens' "Making Things With Maths" video. Really,
everything is mine except the math in `segment.py`. See also
http://acko.net/blog/js1k-demo-the-making-of
Implemented in Processing.py/Processing 2.1 by Ben Alkov 11-16 Sept 2014.
'''
class Segment(object):
'''A Segment, which encapsulates its own position and color, and can draw
@tildebyte
tildebyte / Explicit global
Created February 5, 2015 16:33
Globals style
import array
def setup():
global vertexes
vertexes = array.array('f', (0,) * 12)
def draw():
# drawing stuff here
def updateGeometry():
@tildebyte
tildebyte / gist:2f7b815d22d36ab80d17
Last active August 29, 2015 14:10
gibber.audio ST3 livecoding
On Mon, Dec 1, 2014 at 9:55 AM, Ben <[email protected]> wrote:
> Question: how hard would it be to integrate gibber.audio.lib running under
> node with Sublime 3?
LOL, I was already looking into this. Right now, I'm dead in the water.
The best thing I know of is SublimeREPL, but with ST3 under Win7 x64, I'm
getting OSError: [WinError 6] The handle is invalid every time I try to send
anything to Node. I've Googled around a bit, but I haven't found anything like
a solution yet.
@tildebyte
tildebyte / whale.js
Created December 2, 2014 20:18
A gibber.audio synth.
AudioContext = require('web-audio-api').AudioContext
Gibber = require('gibber.audio.lib/build/gibber.audio.lib.js')
// I want something truly random which can give a uniform distribution of integers
Random = require('random-js')
random = Random(Random.engines.browserCrypto)
// random.integer(30, 41)
Gibber.init()
Clock.bpm = 96 // 2500ms/whole, 625ms/quarter, 19.53ms/128th
@tildebyte
tildebyte / ex00_methodChaining.pde
Created August 19, 2014 19:14
Simple HYPE example, Java & Python.
import hype.core.util.*;
import hype.extended.drawable.*;
void setup() {
size(640,640);
H.init(this);
HRect rect1 = new HRect(100);
rect1.fill(#FF6600) // set fill color
.stroke(#000000, 150) // set stroke color and alpha
@tildebyte
tildebyte / TwentyfiveSquares.pyde
Created July 29, 2014 19:44
Example Python mode sketch using HYPE.
# PDE:
add_library('hype')
# processing.py:
# from hype.core.util import H
# from hype.core.interfaces import HCallback
# from hype.extended.behavior import HOscillator
# from hype.extended.drawable import HCanvas
# from hype.extended.drawable import HRect
# from hype.extended.layout import HGridLayout
# from hype.extended.util import HDrawablePool
@tildebyte
tildebyte / constrain.pde
Last active August 29, 2015 14:03
Processing `constrain()` tests.
float x = 0;
float y = 0;
float speed = 0.9;
void setup(){
}
void draw(){
@tildebyte
tildebyte / circle.py
Created June 29, 2014 21:32
Creative Coding, Week 3 example 2
class Circle(object):
HalfWidth = 0
def __init__(self, x, y, speed=random(10), phase=random(TAU)):
self.x = x
self.y = y
self.speed = speed
self.phase = phase
self.holdX = self.x
soBase = (HOscillator().
speed(1).
range(-5, 5).
freq(4).
property(H.ROTATION))
rects = [HRect(rectDiameter)
.fill(141, 73, 63, choice([64, 196]))
.noStroke()
.loc(x, y)
.anchorAt(H.CENTER)
@tildebyte
tildebyte / example_001.pyde
Created June 23, 2014 20:17
HMagneticField example converted to Processing's Python mode.
add_library('HYPE')
field = None
def setup():
size(640, 640)
H.init(this).background(0xFF202020)
smooth()
colors = HColorPool([0xFFFFFFFF, 0xFFF7F7F7,