title: Convert processing to javascript
body: <p>I wrote this code in processing which allows an image to move vertically based on where the mouse position is. Now I want to post it on a website and understand why the code needs to be converted to javascript.</p>
  
  <pre><code>
  float xpos1;
  int one = 0;
  PImage alpha;
  
  
  void setup()
  {
    alpha = loadImage("Alpha.png");
    size (800, 300);
    smooth();
    xpos1 = width/2;
    }
  
    void draw() {
      fill(0, 55);
      rect(0, 0, width, height);
      noStroke();
      fill(255, 200);
      float mx = mouseX * 0.4 - width/5.0;
  
    xpos1 += mx/8;
  
    if(xpos1 &lt; -700) { xpos1 = width;}
    if(xpos1 &gt; width) { xpos1= -700;}
  
   image(alpha, xpos1, 90); 
  
  }
  </code></pre>
  
  <p>Is it best or even possible to convert or is it best to do it from scratch in another way?</p>