SHARE
TWEET

JS Image Oscillator SRC

a guest Aug 12th, 2017 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <canvas id="canv" width="1000" height="1000">
  2. </canvas>
  3. <script>
  4. c = document.getElementById("canv");
  5. var ctx = c.getContext("2d");
  6.  
  7. id = ctx.createImageData(1000,1000);
  8.  
  9. function draw() {
  10. var w=c.width;
  11. var h=c.height;
  12. window.requestAnimationFrame(draw);
  13. var r;
  14. for (var p = 4 * (w * h - 4); p>= 4; p -= 4) {
  15. r = Math.random();
  16. id.data[p] = id.data[p+p] = id.data[p+p] = 256 * Math.pow(r, 1.6);
  17. id.data[p++] = 256;
  18. }
  19. ctx.putImageData(id, 0, 0);
  20. }
  21.  
  22. draw();
  23.  
  24. </script>
RAW Paste Data
Top