Up the volume, move your mouse to drop your finger in the water and see the tail ! Better experience in 1920*1080 ..
function g(t){return d.getElementById(t)}function r(){return Math.random()}var d=document,m=x=W=H=-1,M=40;B="background",P="px",A=new AudioContext,b.innerHTML="<style>*{position:absolute;width:100%;height:100%}#A{"+B+"-image:linear-gradient(to right,#09F,#06F 16%,#38C 32%,#06F 48%,#38C 64%,#06F 80%,#09F)}I{z-index:9;width:4px;height:4px;"+B+':#fff;opacity:.3}</style><B id="A"></B>';var S=4096,N=function(){var t=0,e=A.createScriptProcessor(S,1,1);return e.onaudioprocess=function(e){for(var n=e.outputBuffer.getChannelData(0),i=0;S>i;i++)n[i]=(t+.02*(2*r()-1))/1.02,t=n[i],n[i]*=3},e}();N.connect(A.destination),d.onmousemove=function(t){W=t.clientX,H=t.clientY},Z=g("A"),setInterval(function(){for(x*=-1,Z.style.backgroundPosition=9*x+"px",i=1;i<99;i++)if(j=g(i))u=j.style.top,y=parseInt(u.substr(0,u.length-2)),j.style.top=y+M+P,y-parseInt(j.Y)*r()>250&&(Z.removeChild(j),m-=1);else if(W*H>1&&99>m){var t=d.createElement("I");t.id=i,t.X=W,t.Y=H,Z.appendChild(t),t.style.top=M*r()+H+P,t.style.left=M*r()+W+P,m+=1}},200);
ZnVuY3Rpb24gZyh0KXtyZXR1cm4gZC5nZXRFbGVtZW50QnlJZCh0KX1mdW5jdGlvbiByKCl7cmV0dXJuIE1hdGgucmFuZG9tKCl9dmFyIGQ9ZG9jdW1lbnQsbT14PVc9SD0tMSxNPTQwO0I9ImJhY2tncm91bmQiLFA9InB4IixBPW5ldyBBdWRpb0NvbnRleHQsYi5pbm5lckhUTUw9IjxzdHlsZT4qe3Bvc2l0aW9uOmFic29sdXRlO3dpZHRoOjEwMCU7aGVpZ2h0OjEwMCV9I0F7IitCKyItaW1hZ2U6bGluZWFyLWdyYWRpZW50KHRvIHJpZ2h0LCMwOUYsIzA2RiAxNiUsIzM4QyAzMiUsIzA2RiA0OCUsIzM4QyA2NCUsIzA2RiA4MCUsIzA5Ril9SXt6LWluZGV4Ojk7d2lkdGg6NHB4O2hlaWdodDo0cHg7IitCKyc6I2ZmZjtvcGFjaXR5Oi4zfTwvc3R5bGU+PEIgaWQ9IkEiPjwvQj4nO3ZhciBTPTQwOTYsTj1mdW5jdGlvbigpe3ZhciB0PTAsZT1BLmNyZWF0ZVNjcmlwdFByb2Nlc3NvcihTLDEsMSk7cmV0dXJuIGUub25hdWRpb3Byb2Nlc3M9ZnVuY3Rpb24oZSl7Zm9yKHZhciBuPWUub3V0cHV0QnVmZmVyLmdldENoYW5uZWxEYXRhKDApLGk9MDtTPmk7aSsrKW5baV09KHQrLjAyKigyKnIoKS0xKSkvMS4wMix0PW5baV0sbltpXSo9M30sZX0oKTtOLmNvbm5lY3QoQS5kZXN0aW5hdGlvbiksZC5vbm1vdXNlbW92ZT1mdW5jdGlvbih0KXtXPXQuY2xpZW50WCxIPXQuY2xpZW50WX0sWj1nKCJBIiksc2V0SW50ZXJ2YWwoZnVuY3Rpb24oKXtmb3IoeCo9LTEsWi5zdHlsZS5iYWNrZ3JvdW5kUG9zaXRpb249OSp4KyJweCIsaT0xO2k8OTk7aSsrKWlmKGo9ZyhpKSl1PWouc3R5bGUudG9wLHk9cGFyc2VJbnQodS5zdWJzdHIoMCx1Lmxlbmd0aC0yKSksai5zdHlsZS50b3A9eStNK1AseS1wYXJzZUludChqLlkpKnIoKT4yNTAmJihaLnJlbW92ZUNoaWxkKGopLG0tPTEpO2Vsc2UgaWYoVypIPjEmJjk5Pm0pe3ZhciB0PWQuY3JlYXRlRWxlbWVudCgiSSIpO3QuaWQ9aSx0Llg9Vyx0Llk9SCxaLmFwcGVuZENoaWxkKHQpLHQuc3R5bGUudG9wPU0qcigpK0grUCx0LnN0eWxlLmxlZnQ9TSpyKCkrVytQLG0rPTF9fSwyMDApOw==
// "Water Gate" by Patrice CHASSAING
// JS1K 2016 - Let's get eleMental!
/********** DECLARATION **********/
//SAVE BYTES !!!
var d = document,
m = x = W = H = -1,
M = 40;//if you change this you could get a snowfall or a rain ...
B = 'background',
P = 'px',
A = new AudioContext();
// getElementById function
function g(U) {
return d.getElementById(U)
}
// random function
function r() {
return Math.random()
}
//Theme
//Use http://p.chas.free.fr/demo/shorthandcolors/index-short-shades.html to find similars Shorthand Hexadecimal Colors
b.innerHTML = '<style>*{position:absolute;width:100%;height:100%}#A{' B '-image:linear-gradient(to right,#09F,#06F 16%,#38C 32%,#06F 48%,#38C 64%,#06F 80%,#09F)}I{z-index:9;width:4px;height:4px;' B ':#fff;opacity:.3}</style><B id="A"></B>';
/********** SOUND **********/
//http://noisehack.com/generate-noise-web-audio-api/
//Brownian Noise
var S = 4096;
var N = (function() {
var O = 0;
var n = A.createScriptProcessor(S, 1, 1);
n.onaudioprocess = function(e) {
var o = e.outputBuffer.getChannelData(0);
for (var i = 0; i < S; i ) {
o[i] = (O (0.02 * (r() * 2 - 1))) / 1.02;
O = o[i];
o[i] *= 3; // (roughly) compensate for gain
}
}
return n;
})();
N.connect(A.destination);
/********** FINGER MVT **********/
//Try yourself : touchmove or pointermove for a wild ...
d.onmousemove = function(e) {
W = e.clientX; //mouse position
H = e.clientY; //mouse position
};
/********** LOOP INIT **********/
Z = g('A');
setInterval(function() {
//move background
x *= -1;
Z.style.backgroundPosition = 9 * x 'px';
//water tail
//not a physical algo but pretty visual effect ...
//or it's a snowfall !
for (i = 1; i < 99; i ) {
//move an element (particle)
if (j = g(i)) {
u = j.style.top;
y = parseInt(u.substr(0, u.length - 2));
j.style.top = y M P;
if (y-parseInt(j.Y)*r() > 250) {//time life has expired
Z.removeChild(j);
m-=1;
}
} else {
//create a new particle
if (W * H > 1 && m<99) {
var e = d.createElement('I');
e.id = i;
e.X = W;
e.Y = H;
Z.appendChild(e);
e.style.top = M*r() H P;
e.style.left = M*r() W P;
m =1;
}
}
} //for
}, 200);