I created a rectangle that covers the whole canvas.
I learned this new code
globalCompositeOperation
and here you can assign it: source-over
which puts the newer shapes on top the canvas and so on.In this case I'm using
source-over
this will make the new shapes be on top of the old ones.I created two triangles and moved them around, the first one was tricky, but for the second one you can use the same, just change the coordinates of the
x, y
.
Nice work! A more detailed explanation of it would be most helpful. I notice two calls to the beginPath() method. Why two? What ends a path? You have three calls to the fill() method. Again, why three fills and only two beginPaths?
ReplyDeleteYou don't need to have the beginPath, I made a mistake. Same goes for thefill(), we only need them to be called once.
ReplyDelete