v155 · basic shapes

Cover a card

"The highlight should reach the corners" is a one-line brief and, before this, a small pile of arithmetic that broke on every resize. Change the card's shape below and watch which approaches keep covering it.

Resize the card and see what still covers it

Each card is checked by sampling its four corners: a corner is covered when the highlight's geometry reaches it. The check is arithmetic on the rendered box, so it stays honest at any aspect ratio.

see also