Learn Create Your Own Split Screen

Next Page

Here's the code. Although there may be many fingers touching, for simplicity we'll just detect the first entry in the touch array (element zero).

Notice we're using the same function for both the touchstart and touchmove events, because we want to do the same thing for both events -- just update the "mouse" position variables.

If you're using S2JS on a touch-sensitive device, you'll be able to meander your finger over the canvas and will see the numbers update.