Created
March 4, 2015 21:22
-
-
Save gregtatum/700348203b6033c829ab to your computer and use it in GitHub Desktop.
Sine wave in the URL bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy/paste into your console | |
| (function() { | |
| var t = 0 | |
| var values = [] | |
| var msg = [] | |
| function loop() { | |
| t++ | |
| if( t % 3 === 0 ) { | |
| for( var i=0; i < 80; i++ ) { | |
| values[i] = Math.sin( (t + i) * 0.4 ) | |
| var msg = values.map(function( v ) { | |
| if( v >= -1 && v < -0.66 ) { | |
| return "▁" | |
| } else if( v >= -0.66 && v < -0.33 ) { | |
| return "▃" | |
| } else if( v >= -0.33 && v < 0 ) { | |
| return "▅" | |
| } else if( v >= 0 && v < 0.33 ) { | |
| return "▆" | |
| } else if( v >= 0.33 && v < 0.66 ) { | |
| return "▇" | |
| } else { | |
| return "█" | |
| } | |
| }) | |
| } | |
| window.history.replaceState( {} , 'wavey', msg.join('') ) | |
| } | |
| requestAnimationFrame(loop) | |
| } | |
| loop() | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment