This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

Touch

I recommend using Pointer rather than touch.

playground({

  touchmove: function(event) {

    event.x           /* touchX */
    event.y           /* touchY */
    event.id          /* touch identifier */
    event.original    /* original DOM event */

  },

  touchstart: function(event) {

    event.x           /* touchX */
    event.y           /* touchY */
    event.id          /* touch identifier */
    event.original    /* original DOM event */

  },

  touchend: function(event) {

    event.x           /* touchX */
    event.y           /* touchY */
    event.id          /* touch identifier */
    event.original    /* original DOM event */

  }

});

You also have access to this.touch which holds current touch status.

this.touch.x /* last touch x */
this.touch.y /* last touch y */
this.touch.pressed
this.touch.touches

Multi Touch example

You need to run it on a mobile device.

var app = playground({

  render: function() {

    this.layer.clear("#024");

    for(var id in this.touch.touches) {

      var touch = this.touch.touches[id];

      this.layer.fillStyle("#fff").fillCircle(touch.x, touch.y, 48);

    }

  },

  container: exampleContainer

});

Ask question:

Fork me on GitHub