Skip to content

Instantly share code, notes, and snippets.

@govindlahoti
Created August 27, 2019 01:37
Show Gist options
  • Save govindlahoti/69016b797384796c123209e5f7440271 to your computer and use it in GitHub Desktop.
Save govindlahoti/69016b797384796c123209e5f7440271 to your computer and use it in GitHub Desktop.
#1
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
var w = window.innerWidth;
var h = window.innerHeight;
canvas.width = w;
canvas.height = h;
const ctx = canvas.getContext('2d');
var randomX = () => Math.random() * w;
var randomY = () => Math.random() * h;
var randomR = () => Math.random() * 100;
ctx.globalCompositeOperation = 'xor';
ctx.fillStyle = 'black';
for(var i=0; i<500; i++)
{
ctx.beginPath();
ctx.arc(randomX(), randomY(), 100, 0, 2 * Math.PI);
ctx.fill();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment