code your own t-shirt

/*
Use the HTML canvas to code your t-shirt's image
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial
Global variables:
canvas: HTML Canvas element, 2400x3200 pixels
ctx: Canvas context
WIDTH: 2400 (image width in pixels)
HEIGHT: 3200 (image height in pixels)
Tips:
- Click 'Run' to render your image to the canvas
- Click 'Save' to save your code to your browser's local storage
- Runtime errors will appear in the debug console
- avoid using opacity, it probably won't print well
https://blog.redbubble.com/2017/03/tips-on-designing-for-t-shirts/
*/
const SIZE = 900
// Draw the design to the canvas
const drawImage = (x, y, size) => {
const level = Math.sqrt(size / SIZE)
ctx.fillStyle = `rgb(${255 * level}, 0, 255)`
drawCircle(x, y, size)
if (size <= 20) return
drawImage(x + size / 3, y + size / 2, 3 * size / 4)
}
// Draw a circle to the canvas
const drawCircle = (x, y, size) => {
ctx.beginPath();
ctx.arc(x, y, size / 2, 0, Math.PI * 2)
ctx.fill();
}
// Run the drawing
drawImage(SIZE / 2 + WIDTH / 10, SIZE / 2 + HEIGHT / 10, SIZE)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX