//Crystal Xue
//15104-section B
//luyaox@andrew.cmu.edu
//project-10
//size of the vinyl
var size1 = 300;
//size of the label
var size2 = 100;
function preload(){
jazz1 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/475409__sandib__bass2.wav");
jazz2 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/49658__sub-d__more-jazz-guitar.wav");
jazz3 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/233699__gulyas25__acid-jazz-loop-music-bed.wav");
jazz4 = loadSound("https://courses.ideate.cmu.edu/15-104/f2019/wp-content/uploads/2019/11/187099__simondsouza__alto-sax-90bpm-cm-4-solo.wav");
jazz4.setVolumn(0.1);
}
function setup() {
createCanvas(500, 500);
}
function draw() {
background(250);
drawRecord();
}
function drawRecord(){
fill(0);
ellipse(width/2, width/2, size1, size1);
for (var i = 0; i < 8; i++) {
noFill();
stroke(105);
strokeCap(SQUARE);
strokeWeight(0.4);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, PI, 0.8 * PI);
}
for (var i = 0; i < 8; i++) {
noFill();
stroke(255);
strokeCap(SQUARE);
strokeWeight(1);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, 0.8 * PI, PI);
}
for (var i = 0; i < 8; i++) {
noFill();
stroke(105);
strokeCap(SQUARE);
strokeWeight(0.4);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, PI, 1.8 * PI);
}
for (var i = 0; i < 8; i++) {
noFill();
stroke(255);
strokeCap(SQUARE);
strokeWeight(1);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, 1.8 * PI, 2 * PI);
}
fill(250,50);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, 0.8 * PI, PI);
fill(250,50);
arc(width/2, width/2, i * 20 + 140, i * 20 + 140, 1.8 * PI, 2 * PI)
//drawing red label
fill(255, 0, 0);
noStroke();
ellipse(width/2, width/2, size2, size2);
//drawing controls
var yc = constrain(mouseY,350, 470);
fill(100);
rect(410, 350, 10, 120);
fill(0);
rect(400, yc, 30, 15);
fill(100);
rect(450, 350, 10, 120);
fill(0);
rect(440, yc, 30, 15);
fill(100);
ellipse(430, 100, 60, 60);
fill(0);
ellipse(430, 100, 40, 40);
fill(100);
ellipse(450, 160, 45, 45);
fill(0);
ellipse(450, 160, 30, 30);
}
function mousePressed() {
//setting mousepresed location
if (dist(mouseX,mouseY, width / 2, height/ 2) <= size1 ) {
jazz1.play();
} else {
jazz1.pause();
}
if (dist(mouseX, mouseY, 430, 100) <= 60) {
jazz2.play();
} else {
jazz2.pause();
}
if (dist(mouseX, mouseY, 450, 160) <= 45) {
jazz3.play();
} else {
jazz3.pause();
}
}
function mouseMoved(){
if (mouseX <= 450 & mouseX >= 410 && mouseY <= 470 && mouseY >= 350) {
jazz4.play();
} else {
jazz4.pause();
}
}
It is inspired by jazz mixtapes. there are 3 different jazz tracks that can be started and paused by pressing the buttons and the record player. The fouth is controlled by the moving control which is more interesting to play with.