-
change create canvas(400,400) to something with a longer y value (e.g. 400,900) so that it fits your phone length
-
change the the if (yPosition X >400) to whatever your Y value for create canvas is
-
click share- present
-
screen record about ten seconds of the program running using the iOS screen record or other program
-
download an app that changes videos into Live Photos- this one for example https://apps.apple.com/us/app/videotolive-live-photo-maker/id136143238
-
use the app to convert your video of the program to a Live Photo
-
select the Live Photo you created in photos and select use as wallpaper and crop and set as your Lock Screen.
Turn on and off your phone and press and hold down on the Lock Screen to see it animate
Thanks to Owen Scheetz for these instructions