Skip to content

Commit

Permalink
fixed some sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
flokleiser committed Feb 9, 2024
1 parent dcb0ffa commit c9c9bf6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 43 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ___
- [ ] one ambient sound that loops: night

- [ ] Global button to enable/disable all sound
- [ ] "reset sound" button?

#### Visual:
- [ ] Finish all the details
Expand Down
1 change: 1 addition & 0 deletions canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ function halfNight() {
currentOpacity = 0;
resetToggles();
drawImages();
toggleSmoking();
toggleMoon();
loadBellSound();
loadChatterSound();
Expand Down
8 changes: 8 additions & 0 deletions effects/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ function resetToggles() {
console.log('moon off')
toggleMoon();
}
if (enableBellSound) {
console.log('bell sound off')
loadBellSound();
}
if (enableNightAmbience) {
console.log('night chatter off')
loadNightAmbienceSound();
}
}

function hideButtons() {
Expand Down
4 changes: 2 additions & 2 deletions effects/sound.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ function loadNightAmbienceSound() {
enableNightAmbience= !enableNightAmbience
if (enableNightAmbience&& enableSound) {
nightAmbienceSound.volume = 0;
$(nightAmbienceSound).animate({volume: 0.9},1000);
$(nightAmbienceSound).animate({volume: 1},1000);
nightAmbienceSound.play();
console.log('night sound',enableNightAmbience);
}
else if (!enableNightAmbience) {
nightAmbienceSound.volume = 0.9;
nightAmbienceSound.volume = 1;
$(nightAmbienceSound).animate({volume: 0},1000, function(){
nightAmbienceSound.pause();
});
Expand Down
40 changes: 0 additions & 40 deletions effects/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,9 @@ canvasTitle.height = 1000
canvasTitleFront.width = 1000
canvasTitleFront.height = 1000

// document.documentElement.style.setProperty('--resized-width', `${canvasTitle.width}px`);

// var titleImage = new Image()
// // titleImage.src = "images/title test6.png"
// // titleImage.src = "images/title test2.png"
// // titleImage.src = "images/clouds6 test.png"

// var titleOpacity= 1;

// function toggleTitle() {
// if (titleOpacity > 0) {
// ctxTitle.clearRect(0,0,canvasTitle.width,canvasTitle.height)
// ctxTitle.globalAlpha = titleOpacity
// titleOpacity-= 0.01;
// ctxTitle.drawImage(titleImage,0,0,canvasTitle.width,canvasTitle.height);
// requestAnimationFrame(toggleTitle)
// }

// setTimeout(function() {
// ctxTitle.clearRect(0,0,canvasTitle.width,canvasTitle.height);
// titleOpacity= 0;
// },3000)
// };


// function drawTitle() {
// ctxTitle.drawImage(titleImage,0,0,canvasTitle.width,canvasTitle.height);
// }

var titleImage = new Image()
titleImage.src = "images/clouds6.png"
var titleImageFront = new Image()
// titleImageFront.src = "images/titleclouds.png"
// titleImageFront.src = "images/titleclouds2.png"
// titleImageFront.src = "images/titleclouds2.png"
titleImageFront.src = "images/titleclouds4.png"

console.log('toggled',titleToggled)
Expand All @@ -66,35 +34,27 @@ function toggleTitleBool() {

function toggleTitle() {
if (titleActive) {
// ctxTitle.drawImage(titleImage,0,0,canvasTitle.width,canvasTitle.height)
titleFadeIn = true;
drawTitle();
console.log('title', titleActive)
}
else {
// ctxTitle.clearRect(0,0,canvasTitle.width,canvasTitle.height)
titleFadeIn= false;
setTimeout(function() {
ctxTitle.clearRect(0,0,canvasTitle.width,canvasTitle.height);
ctxTitleFront.clearRect(0,0,canvasTitle.width,canvasTitle.height);
titleOpacity= 0;

// scrollSpeedTitle = 1;
// scrollValTitle = 0;
// scrollSpeedTitleFront = 1.5;
// scrollValTitleFront = 0;
scrollSpeedTitle = 0;
scrollSpeedTitleFront = 0;
},3000)
console.log('title', titleActive)
}
}

// var scrollSpeedTitle = 0.1;
var scrollSpeedTitle = 0.5;
var scrollValTitle = 0;

// var scrollSpeedTitleFront = 0.15;
var scrollSpeedTitleFront = 0.9;
var scrollValTitleFront = 0;

Expand Down
Binary file added images/title mask2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
mask-mode: alpha;
mask-size: cover;
mask-repeat: no-repeat;
mask-image: url(images/title\ mask.png);
mask-image: url(images/title\ mask2.png);
overflow: hidden;
}

Expand Down

0 comments on commit c9c9bf6

Please sign in to comment.