xxxxxxxxxx
53
const ampl = 42 // amplitude of both waves
const base_spatial = 16 // pixels
const base_temporal = 16 // Hz (visible max is 30)
const comp_spatial = 16 // pixels
const comp_temporal = 16 // Hz (visible max is 30)
// spatial base: 8
// spatial range: 4->16
// start with 4x4 matrix for base frequencies
// sp: 2 4 8 16
// tm: 1 4 8 16 Hz
// use processing > make videos > try different survey tool with ^^ file upload size
// use gaussian kernel pre-computed as hashmap over xy
function setup() {
createCanvas(200,500);
body = loadImage("outlineT.png");
t = 0
fr = 30
f0 = base_spatial
f1 = comp_spatial
t0 = base_temporal / fr
t1 = comp_temporal / fr
noStroke()
frameRate(fr)
}
function draw() {
background(0)
const r0 = t0 * t
const r1 = t1 * t
for (let y=0; y<height/1.5; y++) {
const hPhase0 = ampl*(1+cos(r0+y/f0))/2 + ampl*(1+cos(-r0+y/f0))/2
const hPhase1 = ampl*(1+cos(r1+y/f1))/2 + ampl*(1+cos(-r1+y/f1))/2
const tv = hPhase0 + hPhase1
for (let x=0; x<40; x++) {
const c = tv // - pow(x, 1.15) - pow(y, 1)
set(100-x, 200-y, c)
set(100+x, 200-y, c)
set(100-x, 200+y, c)
set(100+x, 200+y, c)
}
}
updatePixels();
image(body,0,0,width,height)
t += 1;
}
function keyPressed() {
if (key === 's') {
saveGif('sCurve.gif', 10);
}
}