xxxxxxxxxx
54
const noiseScale = 0.04;
var pos = [];
const count = 500;
var noisePos = 1;
var zoff = 0;
var detailSlider, frqSlider;
let soundFile;
var amp;
function preload(){
soundFormats('mp3', 'ogg');
soundFile = loadSound('weekend');
}
function setup() {
createCanvas(1000, 400);
frameRate(30);
textSize(height/35);
textAlign(CENTER, CENTER);
detailSlider = createSlider(1, 10, 2);
frqSlider = createSlider(0.1, 0.9, 0.9, 0.1);
soundFile.play();
amp = new p5.Amplitude();
}
function draw() {
background(220);
noiseDetail(detailSlider.value(), frqSlider.value());
strokeWeight(0);
for(var i = 0; i < count; i++){
pos[i] = noise((noisePos + i )* noiseScale, noiseScale, zoff);
}
zoff = amp.getLevel();
fill("#B0B4B9");
push();
translate(width/2, height/2);
scale(1.5 ,1);
translate(-width/2, -height/2);
beginShape();
for(var j = 0; j < pos.length; j++){
curveVertex((width/count)*j, height-(pos[j]*300));
}
vertex(width, height-pos[pos.length -1]);
vertex(width, height);
vertex(0, height);
vertex(0, pos[0]);
endShape();
pop();
fill('#000000');
text("© McpeCommander" + year(), width/2, height - height/28);
}