title: Get Speed of Touchmove in HTML5
body: <p>How can i get speed(velocityX) with which my finger moved from one point to other in HTML5.I have used speed(velocityX) in android .like this</p>
  
  <pre><code>public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY){
  
      private static final int SWIPE_MIN_DISTANCE = 30;
  private static final int SWIPE_MAX_OFF_PATH = 200;
  private static final int SWIPE_THRESHOLD_VELOCITY = 400;
  
  
  try {
      if (Math.abs(e1.getY() - e2.getY()) &gt; SWIPE_MAX_OFF_PATH)
          return false;
      // right to left swipe
      if(e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
  
          startActivity( new Intent( this, x.class ) );
      }  else if (e2.getX() - e1.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
          //  Toast.makeText(getApplicationContext(), "Right Swipe", Toast.LENGTH_SHORT).show();
  
          startActivity( new Intent( this , aasas.class) );
  
  
  
  
      }
      else if(e1.getY() - e2.getY() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
  
      }  else if (e2.getY() - e1.getY() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY) {
  
      }
  } catch (Exception e) {
      // nothing
  }
  
  return true;
  </code></pre>
  
  <p>}</p>
  
  <p>and i want to implement same like this in html5 but i am unable to get velocityX and my html5 code is this</p>
  
  <pre><code>      this.downX = null;
     this.upX = null;
  
  document.body.addEventListener('touchstart', function(event) {
          event.preventDefault();
          console.log("movvv");
                  this.downX = event.touches[0].pageX;
  
      }, true);
  
      document.body.addEventListener('touchmove', function(event) {
          event.preventDefault();
          this.upX = event.touches[0].pageX;
      }, true);
  
  
      document.body.addEventListener('touchend', function(event) {
          event.preventDefault();
  
          if ((this.downX - this.upX) &gt; 50) {
  
              console.log("goooo");
  
          }
          if ((this.upX - this.downX) &gt; 50) {
  
          }
  
  
      }, true);
  </code></pre>
  
  <p>Actually i want to change this line of Android to Html5</p>
  
  <pre><code>if(e1.getX() - e2.getX() &gt; SWIPE_MIN_DISTANCE &amp;&amp; Math.abs(velocityX) &gt; SWIPE_THRESHOLD_VELOCITY)
  </code></pre>
  
  <p>if any plz guide if there is any function for single Touch in HTML5 like in Android onSingleTapUp</p>