Drawing and animating

by soggydoughnut54

HTML

<canvas width="500" height="500" id="myCanvas"></canvas>

CSS

#myCanvas {
    border:1px solid #000;
}

JavaScript

/*************
variables to make program work
*************/
//access the canvas
var canvas = document.getElementById('myCanvas');
//access drawing environment
var context = canvas.getContext("2d");
//create a new image
var space = new Image();
space.src = "https://i.postimg.cc/DyNVWvJm/space.jpg";
//variables for rectangles

/***********
function for drawing stuff
ALL OF YOUR CODE GOES HERE vvvv
************/
function draw(rect) {
    //color
    context.fillStyle = "blue";
    //shape
    context.fillRect(20, 20, 100, 100);
    //size
    context.fillSize
}
/************
Call the function
************/
draw();
//start game loop

//grow rectangle
var size = y
var y = y+1