For those of you crying "What about mobile devices? Desktops and laptops are a thing of the past!" – this recipe is just for you. As Internet surfers migrate away from their giant tethered desktops and begin consuming Internet content from mobile devices, it's becoming more evident every day that the future of the Web, including canvas, will reside mostly in the mobile space.
Unlike web applications running on desktops and laptops, where user interactions are detected using the mouse from mousedown
, mouseup
, mouseover
, mouseout
, and mousemove
events, web applications running on mobile devices are interacted with touch events from touchstart
, touchend
, and touchmove
events.
In this recipe, we'll create a mobile version of the previous recipe by adding touch event listeners to the triangle and circle.
As mentioned earlier, any of the recipes in this chapter could be modified to support mobile devices by adding touch event listeners...