Skip to content

Instantly share code, notes, and snippets.

@madbunnykim
Created October 31, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madbunnykim/b8a9f2d42e8ddabbc2ca2dec57a6704b to your computer and use it in GitHub Desktop.
Save madbunnykim/b8a9f2d42e8ddabbc2ca2dec57a6704b to your computer and use it in GitHub Desktop.
Ghosts
let footprint;
let footprint2;
// let ripple;
let mic;
let ghost;
function preload() {
// ghost = createVideo('shadow_finalver.mov');
footprint = loadImage("footprint.png");
footprint2 = loadImage("footprint2.png");
// ripple = loadImage("ripple.png");
}
function setup() {
createCanvas(windowWidth, windowHeight);
mic = new p5.AudioIn()
mic.start();
}
function draw() {
background(255);
let vol = mic.getLevel();
let x = random(width / 2 - vol*100, width / 2 + vol*100);
let y = constrain(height - vol * height * 5, 0, height);
// // ripple.loadPixels();
// // for (var i = 0; i < ripple.pixels.length; i++) {
// // ripple.pixels[i] *= 1.0;
// // }
// // ripple.updatePixels();
// imageMode(CENTER);
// image(ripple, width / 2, height / 2, 800, 800);
image(footprint, x-50, y-50, footprint.width, footprint.height);
tint(201, 232, 149, 128);
image(footprint2, x+100, y+200, footprint.width, footprint.height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment