Skip to content

Commit 9b07111

Browse files
committed
update the single page version
1 parent b613088 commit 9b07111

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

audio_visualizer_single_page_version.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
</footer>
4545
<script type="text/javascript">
4646
/*
47-
*An audio spectrum visualizer built with HTML5 Audio API
48-
*Author:Wayou
49-
*License:feel free to use but keep this info please!
50-
*Feb 15 2014
51-
*Need support you can :
52-
*view the project page:https://github.com/Wayou/HTML5_Audio_Visualizer/
53-
*view online demo:http://wayouliu.duapp.com/mess/audio_visualizer.html
54-
view the blog on how this is done:http://www.cnblogs.com/Wayou/p/html5_audio_api_visualizer.html
55-
*or contact me:liuwayong@gmail.com
47+
* An audio spectrum visualizer built with HTML5 Audio API
48+
* Author:Wayou
49+
* License:feel free to use but keep this info please!
50+
* Feb 15, 2014
51+
* For more infomation or support you can :
52+
* view the project page:https://github.com/Wayou/HTML5_Audio_Visualizer/
53+
* view online demo:http://wayouliu.duapp.com/mess/audio_visualizer.html
54+
* view the blog on how this is done:http://www.cnblogs.com/Wayou/p/html5_audio_api_visualizer.html
55+
* or contact me:liuwayong@gmail.com
5656
*/
5757
window.onload = function() {
5858
new Visualizer().ini();
@@ -82,7 +82,7 @@
8282
try {
8383
this.audioContext = new AudioContext();
8484
} catch (e) {
85-
that._updateInfo('!Your browser does not support AudioContext', false);
85+
this._updateInfo('!Your browser does not support AudioContext', false);
8686
console.log(e);
8787
}
8888
},
@@ -109,6 +109,7 @@
109109
};
110110
//listen the drag & drop
111111
dropContainer.addEventListener("dragenter", function() {
112+
document.getElementById('fileWrapper').style.opacity = 1;
112113
that._updateInfo('Drop it on the page', true);
113114
}, false);
114115
dropContainer.addEventListener("dragover", function(e) {
@@ -118,6 +119,7 @@
118119
e.dataTransfer.dropEffect = 'copy';
119120
}, false);
120121
dropContainer.addEventListener("dragleave", function() {
122+
document.getElementById('fileWrapper').style.opacity = 0.2;
121123
that._updateInfo(that.info, false);
122124
}, false);
123125
dropContainer.addEventListener("drop", function(e) {
@@ -202,7 +204,6 @@
202204
canvas = document.getElementById('canvas'),
203205
cwidth = canvas.width,
204206
cheight = canvas.height - 2,
205-
/*2 is the gap between meter and cap*/
206207
meterWidth = 10, //width of the meters in the spectrum
207208
gap = 2, //gap between meters
208209
capHeight = 2,
@@ -227,7 +228,7 @@
227228
allCapsReachBottom = allCapsReachBottom && (capYPositionArray[i] === 0);
228229
};
229230
if (allCapsReachBottom) {
230-
cancelAnimationFrame(that.animationId);//since the sound is top and animation finished, stop the requestAnimation to prevent potential memory leak,THIS IS VERY IMPORTANT!
231+
cancelAnimationFrame(that.animationId); //since the sound is top and animation finished, stop the requestAnimation to prevent potential memory leak,THIS IS VERY IMPORTANT!
231232
return;
232233
};
233234
};

0 commit comments

Comments
 (0)