BrU32

Untitled

Apr 10th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <script>
  2. var audioCtx=new AudioContext();
  3. var oscillator = audioCtx.createOscillator();
  4. var gainNode = audioCtx.createGain();
  5. oscillator.connect(gainNode);
  6. gainNode.connect(audioCtx.destination);
  7. var WIDTH = window.innerWidth;
  8. var HEIGHT = window.innerHeight;
  9. var FreqMax = 300;
  10. var VolMax = 10.0;
  11. var Freq = 0;
  12. var Vol = 10.0;
  13. oscillator.type = 'sine';
  14. oscillator.frequency.value = Math.random()*Freq;
  15. oscillator.start();
  16. gainNode.gain.value = Math.random()*Vol;
  17. var CurX;
  18. var CurY;
  19. document.onmousemove = updatePage;
  20. function updatePage(e) {
  21. CurX = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
  22. CurY = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
  23. oscillator.frequency.value = (CurX/WIDTH) * FreqMax;
  24. gainNode.gain.value = (CurY/HEIGHT) * VolMax;
  25. osillator.detune=(0);
  26. canvasDraw();
  27. }
  28. </script>
  29. <html>
  30. <body onmousemove="drawe();
  31. drawf();" background-color="white">
  32. <canvas id="myCanvas" width="1000" height="1000" style="background:black;">
  33. </canvas>
  34. <script>
  35. function drawe(){
  36. var text = "";
  37. var possible = "FABCGDE0123456789";
  38. var canvas = document.getElementById("myCanvas");
  39. var ctx = canvas.getContext("2d");
  40. for(var i1=1;i1<20;i1++){
  41.  
  42. Line=Math.random()*CurX;
  43.  
  44. if(event.y>i1){
  45. Line1=Math.random()*CurY;
  46. }
  47. ctx.beginPath(Line1,Line1);
  48. ctx.moveTo(Line,Line1);
  49. for(var i=0; i!=6; i++)
  50. text+=possible.charAt(Math.floor(Math.random()*possible.length));
  51. ctx.strokeStyle='#'+text;
  52. text='';
  53. ctx.lineTo(event.x,event.y);
  54. ctx.stroke()
  55. ctx.paint();
  56. ctx.clear();
  57. }
  58. }
  59. </script>
Add Comment
Please, Sign In to add comment