please format code with </> button * homework policy * asking questions
I’ve been trying to use the p5.distortion extension of p5.effect to distort an oscillator. I don’t think it’s working, however. Does anyone have an example of the correct format?
var sinOsc, distort;
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
distort = new p5.Distortion();
sinOsc = new p5.Oscillator('sine');
sinOsc.amp(0);
sinOsc.disconnect();
sinOsc.connect(distort);
sinOsc.start();
distort.set(0.9)
}
function draw() {
ellipse(mouseX, mouseY, 20, 20);
sinOsc.freq(mouseX)
}
function touchMoved(){
sinOsc.amp(1)
}
function touchEnded(){
sinOsc.amp(0)
}