Skip to content

Commit dc9e5ec

Browse files
committed
testing wind sound
1 parent dab17c8 commit dc9e5ec

File tree

6 files changed

+43
-33
lines changed

6 files changed

+43
-33
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ ___
4242

4343
- [x] Night:
4444
- [x] Cricket(?)
45-
- [ ] **Maybe some ambient music to underlay?**
4645
- [x] one ambient sound that loops: night
4746

4847
#### Visual:

canvas.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ imageDay.src = "images/test_day.png"
3434

3535
var imageClouds= new Image();
3636
imageClouds.onload = function() {
37-
drawImages(); toggleTitle();
37+
drawImages(); toggleTitle(); playWind();
3838
}
3939
imageClouds.src = "images/test_clouds2.png"
4040

@@ -167,6 +167,7 @@ function cloudImage() {
167167
currentOpacity = 0;
168168
resetToggles();
169169
drawImages();
170+
loadWindSound();
170171
}
171172
function dayImage() {
172173
currentImage = "day";
@@ -288,21 +289,31 @@ window.addEventListener('resize', resizeAllCanvases, false);
288289
resizeAllCanvases();
289290
}
290291

291-
// function playWind() {
292-
// }
292+
function playWind() {
293+
293294

294295
// if (startingImage) {
295-
// window.onfocus = function () {
296-
// if (!enableWindySound) {
297-
// // enableWindySound = false;
298-
// console.log('wind sound')
299-
// loadWindSound();
300-
// };
301-
302-
// window.onblur = function () {
303-
// enableWindySound = true;
304-
// loadWindSound();
305-
// console.log('not focus')
306-
// }
307-
// }
308-
// }
296+
window.onfocus = function () {
297+
if (startingImage) {
298+
if (!enableWindySound) {
299+
// enableWindySound = false;
300+
console.log('wind sound')
301+
loadWindSound();
302+
};
303+
}
304+
else {
305+
return;
306+
}
307+
308+
window.onblur = function () {
309+
if (startingImage) {
310+
enableWindySound = true;
311+
loadWindSound();
312+
console.log('not focus')
313+
}
314+
else {
315+
return;
316+
}
317+
}
318+
}
319+
}

effects/bird.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,8 @@ function landBird() {
259259
birdHeightLanding = -1;
260260
birdFlyingRight.src = "images/birdPixelLeft.png"
261261

262-
// },9000)
263262
},6000)
264263
}
265-
// setTimeout(function() {
266-
// birdCycleComplete = true;
267-
// console.log
268-
// repeatBirdCycle();
269-
// // },10000)
270-
// },7000)
271264
}
272265

273266
function idleBird() {

effects/plane.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ const yspeed2 = 0.02;
6262

6363
var enablePlane= false;
6464
// ctxPlane2.globalAlpha = 0.4;
65-
ctxPlane2.filter = "blur(1px)"
65+
// ctxPlane2.filter = "blur(1px)"
66+
// ctxPlane2.filter = "blur(1px)"
67+
ctxTrailOverlay.filter="blur(2px)"
68+
ctxTrailOverlay2.filter="blur(2px)"
6669

6770
function togglePlane() {
6871
enablePlane= !enablePlane
@@ -92,10 +95,10 @@ function togglePlane() {
9295
function movePlane() {
9396
if (!enablePlane) return
9497
ctxPlane.clearRect(0,0,canvasPlane.width, canvasPlane.height);
95-
ctxTrail.globalAlpha = 0.4;
98+
ctxTrail.globalAlpha = 0.1;
9699
ctxTrail.clearRect(x - 700, 0, 10, canvasTrail.height);
97-
ctxTrailOverlay.clearRect(x-400,0,10,canvasTrailOverlay.height);
98-
ctxTrailOverlay.globalAlpha = 0.7;
100+
ctxTrailOverlay.clearRect(x-600,0,10,canvasTrailOverlay.height);
101+
ctxTrailOverlay.globalAlpha = 0.4;
99102

100103
ctxPlane.drawImage(plane,x, y);
101104
ctxTrail.drawImage(trail,x,y);
@@ -114,10 +117,10 @@ function movePlane() {
114117
function movePlane2() {
115118
if (!enablePlane) return
116119
ctxPlane2.clearRect(0,0,canvasPlane2.width, canvasPlane2.height);
117-
ctxTrail2.globalAlpha = 0.4;
120+
ctxTrail2.globalAlpha = 0.1;
118121
ctxTrail2.clearRect(x2 +(700 + canvasTrail2.width), 0, canvasTrail2.width, canvasTrail2.height);
119-
ctxTrailOverlay2.clearRect(x2 +(400 + canvasTrailOverlay2.width),0,canvasTrailOverlay2.width,canvasTrailOverlay2.height);
120-
ctxTrailOverlay2.globalAlpha = 0.7;
122+
ctxTrailOverlay2.clearRect(x2 +(600 + canvasTrailOverlay2.width),0,canvasTrailOverlay2.width,canvasTrailOverlay2.height);
123+
ctxTrailOverlay2.globalAlpha = 0.4;
121124

122125
ctxPlane2.drawImage(plane2,x2,y2);
123126
ctxTrail2.drawImage(trail2,x2,y2);

effects/sound.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ function toggleSound() {
130130
if (enableCricketSound) {
131131
cricketSound.play();
132132
}
133+
if (enableWindySound) {
134+
windySound.play();
135+
}
133136

134137

135138
}
@@ -148,6 +151,7 @@ function toggleSound() {
148151
chatterSound.pause();
149152
nightAmbienceSound.pause();
150153
cricketSound.pause();
154+
windySound.pause();
151155

152156
console.log('sound', enableSound)
153157
}

effects/windows.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function repeatWindows() {
8686
},9000)
8787
}
8888
}
89-
if (currentImage === 'fullNight') {
89+
else {
9090
console.log('full night off')
9191
windowActive = false;
9292
ctxWindow1.clearRect(0,0,canvasWindow1.width,canvasWindow1.height)

0 commit comments

Comments
 (0)