import draw
val cwidth = 800, cheight = 600
fn getRandomInt(min:: number, max:: number) -> number =
Math.floor(Math.random() * (max - min + 1)) + min
fn createCircle() -> object {
return {
x: getRandomInt(0, cwidth),
y: getRandomInt(0, cheight),
radius: getRandomInt(10, 50),
color: `rgba(0, 0, ${getRandomInt(150, 255)}, 0.1)`,
dx: (Math.random() - 0.5) * 2,
dy: (Math.random() - 0.5) * 2
}
}
onready(fn() {
let canvas = doc.make("canvas")
canvas.width = cwidth
canvas.height = cheight
doc.body.put(canvas)
drawCircles(canvas.getContext("2d"), Array.from({ length: 20 }, createCircle))
})