Learn Create Your Own Split Screen

Next Page

Here we're combining what we learned previously about for loops with what we now know about if else.

We're doing a loop very similar to before, but adding something to say when 'corner is less than 50, the strokes will be green, otherwise they'll be red'.

if (corner < 50) { ctx.strokeStyle= "green"; } else { ctx.strokeStyle= "red"; }