{
const canvas = html`<canvas width = 500 height = 500 style = "border:1px black solid;"/>`
const ctx = canvas.getContext("2d")
let x = 250
let y = 250
let stepSize = 10
const framesPerTick = 50
let frame = 0
let tick = 0
const loop = () => {
ctx.beginPath()
ctx.arc(x,y,5,0,2*Math.PI)
ctx.fill()
ctx.closePath()
if(frame%framesPerTick == 0){
const dx = d3.randomUniform(-1,1)()
x = x + Math.sign(dx)*stepSize
const dy = d3.randomUniform(-1,1)()
y = y + Math.sign(dy)*stepSize
tick = tick + 1
}
if(tick < 100){
frame = frame + 1
window.requestAnimationFrame(loop)
}
}
loop()
return canvas
}