title: Particles "run away" from mouse
body: <p>Im creating a simple particle experiment on canvas. Now i want them to "run away" from mouse coursor over canvas. detecting the distance from the mouse is not a problem, but how to code their behaviour?</p>
  
  <p>each particle is created as following:</p>
  
  <pre><code>    var particle = {
          x: Math.floor(Math.random() * width),
          y: Math.floor(Math.random() * height),
          xVel: Math.random() * 10 - 5,
          yVel: Math.random() * 10 - 5,
      }
  </code></pre>
  
  <p>so i assume i should also save the direction somehow, and if the distance from pointer is &lt; x, reverse the direction? maybe also save old speed, and decrease it slowly while moving away?</p>
  
  <p>how to detect the direction?</p>