Based on some PICO-8 code by Luca Harris @lucatron_ https://twitter.com/lucatron_/status/1203444384357683200