function setup() {
createCanvas(500, 200);
textSize(18);
text("Move the slider to observe the effects"
+ " of the atan2() function", 20, 30);
sliderXPos = createSlider(-200, 200, 0, 1);
sliderXPos.position(20, 50);
sliderYPos = createSlider(-200, 200, 0, 1);
sliderYPos.position(20, 80);
}
function draw() {
clear();
text("Move the slider to observe the effects"
+ " of the atan2() function", 20, 30);
sliderXVal = sliderXPos.value();
sliderYVal = sliderYPos.value();
atan2Val = atan2(sliderXVal, sliderYVal);
text("The X position value is: " + sliderXVal, 20, 140);
text("The Y position value is: " + sliderYVal, 20, 160);
text("The atan2 value is: " + atan2Val, 20, 180);
}