Skip to content

Instantly share code, notes, and snippets.

@edgalindo
Created November 27, 2016 00:21
Show Gist options
  • Select an option

  • Save edgalindo/f14f3cb358af85eb2e77f6a080c8fc9f to your computer and use it in GitHub Desktop.

Select an option

Save edgalindo/f14f3cb358af85eb2e77f6a080c8fc9f to your computer and use it in GitHub Desktop.
var move;
var t;
var pointX;
var pointY;
function setup() {
createCanvas(500, 500);
background(245);
frameRate(60);
smooth();
move = new p5.Oscillator();
move.setType('Sine');
move.amp(0.5);
move.freq(1);
move.start();
pointY = 100;
pointX = 0;
t = 1000;
}
function draw() {
stroke(random (20,360),100,100);
var randomY = random(height);
var noiseY = map(noise(t), 0, 1, 0, height);
//the higher the t(noise), the higher are the lines =0.01
//the lower the t(noise), the smoother are the lines = 0.001
t = t + 0.01;
pointX += 1
//random and noise
pointY = noiseY;
if(pointX > width) {
pointX = 0;
}
point(pointX, pointY);
var freq = map(pointY+300, 0, height, 1000, 10);
move.freq(freq);
}
function mousePressed(){
save('image.jpg');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment