<canvas id="canvas"></canvas>
const canvas = document.querySelector('#canvas')
const ctx = canvas.getContext('2d')
canvas.width = window.innerWidth
canvas.height = window.innerHeight
ctx.fillStyle = 'black'
let point = {x: canvas.width/2,
y: canvas.height/2}
function render(){
point.x += (Math.random()-.5)*5
point.y += (Math.random() -.5)*5
ctx.rect( point.x, point.y, 5, 5)
ctx.fill()
window.requestAnimationFrame(render);
}
render()
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.