你好，现在你是一名processing的专家，擅长用processing实现以下美丽的视觉效果和颇具趣味的鼠标交互。现在请你参考下面的动量定理的代码：
import controlP5.*; //<>//

ControlP5 cp5;

boolean iLinked = false;
PVector finger_velocity;

// Variables related to moving box, 1 stand for lefg box, 2 stand for right box
PVector center1, velocity1;
PVector center2, velocity2;
float boxHeight = 50;
float speed = 3.5;
float epsilon = 0;
float m1 = 100;
float m2 = 100;


void setup() {
  size(1200, 600);
  cp5 = new ControlP5(this);

  rectMode(CENTER);

  // add a horizonal slider for epsilon
  cp5.addSlider("slider")
    .setPosition(20, 20)
    .setSize(200, 20)
    .setRange(0, 1)
    .setValue(0.5)
    ;

  // reposition the Label for controller 'slider'
  cp5.getController("slider").getValueLabel().align(ControlP5.LEFT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
  cp5.getController("slider").getCaptionLabel().align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
  cp5.getController("slider").getCaptionLabel().setColor(#AAAAAA);
  cp5.getController("slider").getCaptionLabel().setText("Epsilon");
  cp5.getController("slider").getValueLabel().setColor(#AAAAAA);

  // add a vertical slider for masses of 2 boxes
  cp5.addSlider("Mass_Of_Left_Box")
    .setPosition(width-180, 20)
    .setSize(10, 100)
    .setRange(50, 150)
    .setValue(100)
    ; 
  cp5.getController("Mass_Of_Left_Box").getCaptionLabel().align(ControlP5.LEFT, ControlP5.TOP_OUTSIDE).setPaddingX(10);
  cp5.getController("Mass_Of_Left_Box").getCaptionLabel().setColor(#AAAAAA);
  cp5.getController("Mass_Of_Left_Box").getCaptionLabel().setText("m1");
  cp5.getController("Mass_Of_Left_Box").getValueLabel().setColor(#AAAAAA);

  cp5.addSlider("Mass_Of_Right_Box")
    .setPosition(width-80, 20)
    .setSize(10, 100)
    .setRange(50, 150)
    .setValue(100)
    ; 
  cp5.getController("Mass_Of_Right_Box").getCaptionLabel().align(ControlP5.LEFT, ControlP5.TOP_OUTSIDE).setPaddingX(10);
  cp5.getController("Mass_Of_Right_Box").getCaptionLabel().setColor(#AAAAAA);
  cp5.getController("Mass_Of_Right_Box").getCaptionLabel().setText("m2");
  cp5.getController("Mass_Of_Right_Box").getValueLabel().setColor(#AAAAAA);

  center1 = new PVector(m1/2, 3*height/4-boxHeight/2);
  center2 = new PVector(3*width/4-m1/2, 3*height/4-boxHeight/2);

  velocity1 = new PVector(0, 0);
  velocity2 = new PVector(0, 0);
}

void draw() {
  // draw background
  background(#F0FFF0);

  // draw base
  fill(#6C7B8B);
  noStroke();
  rect(width/2, 7*height/8, width, height/4);

  // draw two boxes
  m1 = cp5.getController("Mass_Of_Left_Box").getValue();//mass of Left box
  m2 = cp5.getController("Mass_Of_Right_Box").getValue();//mass of Right box

  //move Left Box
  center1.add(velocity1);
  center2.add(velocity2);

  noStroke();
  fill(199, 97, 20);
  rect( center2.x, center2.y, m2, boxHeight);
  rect( center1.x, center1.y, m1, boxHeight);

  if (checkCollisionsBetween2Boxes()) {
    //get epsilon
    epsilon = cp5.getController("slider").getValue();

    //calc V1f
    PVector v1i = velocity1.copy();
    PVector v2i = velocity2.copy();
    v1i.mult((m1-m2*epsilon)/(m1+m2));
    v2i.mult((1+epsilon)*m2/(m1+m2));
    PVector v1f = PVector.add(v1i, v2i);

    //calc V2f
    v1i = velocity1.copy();
    v2i = velocity2.copy();
    v1i.mult((1+epsilon)*m1/(m1+m2));
    v2i.mult((m2-epsilon*m1)/(m1+m2));
    PVector v2f = PVector.add(v1i, v2i);

    //set back
    velocity1.set(v1f.x, v1f.y);
    velocity2.set(v2f.x, v2f.y);

    PVector testVec = PVector.sub(velocity1, velocity2);
    if ( testVec.mag() < 1.0e-4) {
      iLinked = true;
    } else {
      iLinked = false;
    }
  }

  checkCollistionWithBorders();
}

boolean checkCollisionsBetween2Boxes() {
  //collisions between 2 boxes
  //  if(velocityLBox.x>0) {//the left Box moves towards the positive direction
  float widthSum = (m1+m2)/2;
  float distance = center2.dist(center1);
  if (distance <= widthSum) {
    return true;
  } else {
    return false;
  }
}

void checkCollistionWithBorders() {
  if (!iLinked) {
    if (velocity1.x>0)//the left Box moves towards the positive direction
    {
      float dist = center1.x+m1/2;
      if (dist>=width) {
        velocity1.set(-velocity1.x, 0);
      }
    } else {//the left Box moves towards the negative direction
      float dist = center1.x-m1/2;
      if (dist<=0) {
        velocity1.set(-velocity1.x, 0);
      }
    }

    if (velocity2.x>0)//the right Box moves towards the positive direction
    {
      float dist = center2.x+m2/2;
      if (dist>=width) {
        velocity2.set(-velocity2.x, 0);
      }
    } else {//the right Box moves towards the negative direction
      float dist = center2.x-m2/2;
      if (dist<=0) {
        velocity2.set(-velocity2.x, 0);
      }
    }
  } else {
    if (velocity2.x>0)//the left Box moves towards the positive direction
    {
      float dist = center2.x+m2/2;
      if (dist>=width) {
        velocity2.set(-velocity2.x, 0);
        velocity1.set(-velocity1.x, 0);
      }
    }

    if (velocity1.x<0)
    {//the left Box moves towards the negative direction
      float dist = center1.x-m1/2;
      if (dist<=0) {
        velocity1.set(-velocity1.x, 0);
        velocity2.set(-velocity2.x, 0);
      }
    }
  }
}

void keyPressed() {
  if (key == 'r' || key == 'R') {
    //reset velocity of 2 Boxes
    epsilon = 0.5;
    cp5.getController("slider").setValue(epsilon);

    m1 = 100;
    m2 = 100;
    cp5.getController("Mass_Of_Left_Box").setValue(m1);
    cp5.getController("Mass_Of_Right_Box").setValue(m2);

    center1.set(0, 0);
    center1 = new PVector(m1/2, 3*height/4-boxHeight/2);
    velocity1.set(0, 0);

    center2.set(0, 0);
    center2 = new PVector(3*width/4-m2/2, 3*height/4-boxHeight/2);
    velocity2.set(0, 0);
  } 
}

void mousePressed(){
  if (mouseY > 120)
    velocity1.add(new PVector(random(1, 5), 0.0));
}