Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

Binary file removed buttonimages/effect.png
Binary file not shown.
Binary file removed buttonimages/piano.png
Binary file not shown.
Binary file added buttons/.DS_Store
Binary file not shown.
Binary file added buttons/bpm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/effect_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/piano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/piano_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/reset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/stop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buttons/volume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/.DS_Store
Binary file not shown.
Binary file modified icons/icon0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/icon20.png
Binary file added icons/icon21.png
Binary file added icons/icon22.png
Binary file added icons/icon23.png
Binary file added icons/icon24.png
Binary file added icons/icon25.png
Binary file added icons/icon26.png
Binary file added icons/icon27.png
Binary file added icons/icon28.png
Binary file added icons/icon29.png
Binary file modified icons/icon3.png
Binary file added icons/icon30.png
Binary file added icons/icon31.png
Binary file added icons/icon32.png
Binary file added icons/icon33.png
Binary file added icons/icon34.png
Binary file added icons/icon35.png
Binary file added icons/icon36.png
Binary file added icons/icon37.png
Binary file added icons/icon38.png
Binary file added icons/icon39.png
Binary file modified icons/icon4.png
Binary file added icons/icon40.png
Binary file added icons/icon41.png
Binary file modified icons/icon5.png
Binary file modified icons/icon6.png
Binary file modified icons/icon7.png
Binary file modified icons/icon8.png
Binary file modified icons/icon9.png
Binary file added pianoImg/.DS_Store
Binary file not shown.
Binary file added pianoImg/green1.png
Binary file added pianoImg/green2.png
Binary file added pianoImg/green3.png
Binary file added pianoImg/img0.png
Binary file added pianoImg/img1.png
Binary file added pianoImg/img10.png
Binary file added pianoImg/img11.png
Binary file added pianoImg/img12.png
Binary file added pianoImg/img13.png
Binary file added pianoImg/img14.png
Binary file added pianoImg/img15.png
Binary file added pianoImg/img16.png
Binary file added pianoImg/img17.png
Binary file added pianoImg/img18.png
Binary file added pianoImg/img19.png
Binary file added pianoImg/img2.png
Binary file added pianoImg/img20.png
Binary file added pianoImg/img3.png
Binary file added pianoImg/img4.png
Binary file added pianoImg/img5.png
Binary file added pianoImg/img6.png
Binary file added pianoImg/img7.png
Binary file added pianoImg/img8.png
Binary file added pianoImg/img9.png
144 changes: 96 additions & 48 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function preload() {
soundFormats("mp3", "ogg");
for (var i = 0; i < 57; i++) {
if (i < 36) sounds[i] = loadSound(`sound/piano${i}.mp3`);
else sounds[i] = loadSound(`sound/effect${i-if_effect}.mp3`);
else sounds[i] = loadSound(`sound/effect${i - if_effect}.mp3`);
}
// 추가한 부분
// 이미지 불러와서 iconImage배열에 순서대로 저장
Expand All @@ -36,50 +36,82 @@ function setup() {
stroke(220);
strokeWeight(windowWidth / 300);
for (var i = 0; i < 21; i++) {
rect(i * width / 21, height - height / 3, width / 21, height / 3, 0, 0, 10, 10);
rect(
(i * width) / 21,
height - height / 3,
width / 21,
height / 3,
0,
0,
10,
10
);
}
fill(0);
for (var i = 0; i < 6; i++) {
if (i % 4 != 2) {
rect(width / 42 + i * width / 21, height - height / 3, width / 21, height / 6, 0, 0, 10, 10);
rect(width / 42 + i * width / 21 + width / 3, height - height / 3, width / 21, height / 6, 0, 0, 10, 10);
rect(width / 42 + i * width / 21 + (width / 3)*2, height - height / 3, width / 21, height / 6, 0, 0, 10, 10);
rect(
width / 42 + (i * width) / 21,
height - height / 3,
width / 21,
height / 6,
0,
0,
10,
10
);
rect(
width / 42 + (i * width) / 21 + width / 3,
height - height / 3,
width / 21,
height / 6,
0,
0,
10,
10
);
rect(
width / 42 + (i * width) / 21 + (width / 3) * 2,
height - height / 3,
width / 21,
height / 6,
0,
0,
10,
10
);
}
}
noStroke()
fill(210)
rect(width *0.05+3, height/5+5, width * 0.82, height/6, 40)
fill(230)
rect(width *0.05, height/5, width * 0.82, height/6, 40)
noStroke();
fill(210);
rect(width * 0.05 + 3, height / 5 + 5, width * 0.82, height / 6, 40);
fill(230);
rect(width * 0.05, height / 5, width * 0.82, height / 6, 40);

//button
button = createImg('buttonimages/piano.png');
button.size(width*0.1, height*0.06);
button.position(width*0.03, height*0.57);
button.mousePressed(
function(){
mainMode=true;
console.log("changepiano");
}
);
button2 = createImg('buttonimages/effect.png');
button2.size(width*0.18, height*0.06);
button2.position(width*0.15, height*0.57);
button2.mousePressed(
function(){
mainMode=false;
console.log("changeeffect");
});
button = createImg("buttons/piano.png");
button.size(width * 0.1, height * 0.06);
button.position(width * 0.03, height * 0.57);
button.mousePressed(function () {
mainMode = true;
console.log("changepiano");
});
button2 = createImg("buttons/effect.png");
button2.size(width * 0.18, height * 0.06);
button2.position(width * 0.15, height * 0.57);
button2.mousePressed(function () {
mainMode = false;
console.log("changeeffect");
});
}

function draw() {

}
function draw() {}

function changeMode_piano() {
if (mouseY > windowHeight - height / 6) {
for (var i = 0; i < 21; i++) {
if (mouseX > i * width / 21 && mouseX < (i + 1) * width / 21) mode = i;
if (mouseX > (i * width) / 21 && mouseX < ((i + 1) * width) / 21)
mode = i;
}
}
if (mouseY < windowHeight - height / 6) {
Expand Down Expand Up @@ -113,36 +145,52 @@ function changeMode_piano() {
}
}

function changeMode_soundEffect(){
function changeMode_soundEffect() {
if (mouseY > windowHeight - height / 6) {
for (var i = 0; i < 21; i++) {
if (mouseX > i * width / 21 && mouseX < (i + 1) * width / 21) mode = i+if_effect;
if (mouseX > (i * width) / 21 && mouseX < ((i + 1) * width) / 21)
mode = i + if_effect;
}
}
if (mouseY < windowHeight - height / 6) {
if (mouseX < width / 42) mode = if_effect;
if (mouseX > (width / 42) * 5 && mouseX < (width / 42) * 6) mode = 2+if_effect;
if (mouseX > (width / 42) * 6 && mouseX < (width / 42) * 7) mode = 3+if_effect;
if (mouseX > (width / 42) * 13 && mouseX < (width / 42) * 14) mode = 6+if_effect;
if (mouseX > (width / 42) * 14 && mouseX < (width / 42) * 15) mode = 7+if_effect;
if (mouseX > (width / 42) * 19 && mouseX < (width / 42) * 20) mode = 9+if_effect;
if (mouseX > (width / 42) * 20 && mouseX < (width / 42) * 21) mode = 10+if_effect;
if (mouseX > (width / 42) * 27 && mouseX < (width / 42) * 28) mode = 13+if_effect;
if (mouseX > (width / 42) * 28 && mouseX < (width / 42) * 29) mode = 14+if_effect;
if (mouseX > (width / 42) * 33 && mouseX < (width / 42) * 34) mode = 16+if_effect;
if (mouseX > (width / 42) * 34 && mouseX < (width / 42) * 35) mode = 17+if_effect;
if (mouseX > (width / 42) * 41 && mouseX < (width / 42) * 42) mode = 20+if_effect;
if (mouseX > (width / 42) * 5 && mouseX < (width / 42) * 6)
mode = 2 + if_effect;
if (mouseX > (width / 42) * 6 && mouseX < (width / 42) * 7)
mode = 3 + if_effect;
if (mouseX > (width / 42) * 13 && mouseX < (width / 42) * 14)
mode = 6 + if_effect;
if (mouseX > (width / 42) * 14 && mouseX < (width / 42) * 15)
mode = 7 + if_effect;
if (mouseX > (width / 42) * 19 && mouseX < (width / 42) * 20)
mode = 9 + if_effect;
if (mouseX > (width / 42) * 20 && mouseX < (width / 42) * 21)
mode = 10 + if_effect;
if (mouseX > (width / 42) * 27 && mouseX < (width / 42) * 28)
mode = 13 + if_effect;
if (mouseX > (width / 42) * 28 && mouseX < (width / 42) * 29)
mode = 14 + if_effect;
if (mouseX > (width / 42) * 33 && mouseX < (width / 42) * 34)
mode = 16 + if_effect;
if (mouseX > (width / 42) * 34 && mouseX < (width / 42) * 35)
mode = 17 + if_effect;
if (mouseX > (width / 42) * 41 && mouseX < (width / 42) * 42)
mode = 20 + if_effect;
}
}

function soundPlay() {
if (mouseX < windowWidth && mouseY > windowHeight - height / 3 && mouseY < windowHeight) {
if (
mouseX < windowWidth &&
mouseY > windowHeight - height / 3 &&
mouseY < windowHeight
) {
if (mainMode == true) changeMode_piano();
else changeMode_soundEffect();
sounds[mode].play();
sounds[mode].amp(1);
if (musicData.length < 12){
musicData.push(mode)
if (musicData.length < 12) {
musicData.push(mode);
}
}
}
Expand All @@ -153,4 +201,4 @@ function mousePressed() {

function mouseReleased() {
sounds[mode].amp(0, 1);
}
}