title: Balance a number between three variables with bias
body: <p>I have a problem that i'm having issuing seeing a solution too. I have three variables A, B and C. what i'm needing to do is based on a Fourth number (input) balance a value of 100 between the three variables with a bias (I think thats the right word)</p>
  
  <p>So, at the start A would be 100 and B and C would be 0. Then as Input is increased A would decrease and B would increase by the same value (so that A + B + C is always equal to 100). Then when B hits 100 increasing input would then increase C while decreasing B. The reverse would also be true so decreasing Input would make the value move from C > B > A.</p>
  
  <p>I hope i've explained this well enough.</p>
  
  <p>Edit : My attempt so far is this, in this case A, B and C are vCam.m_weight0, vCam.m_weight1, vCam.m_weight2</p>
  
  <p>My problem with this is that i trips up when switching activeCam so the next jumps to 100 instantly. I beleive this is bad code, but i'm struggling to think of another way.</p>
  
  <pre><code>//Input is clamped between 0 - 100
  private void HandleCameraSwitching(float newWeight)
  {
      if (activeCam == 0)
      {
          vCam.m_Weight1 = newWeight;
          vCam.m_Weight0 = 100 - newWeight;
      }
      else if (activeCam == 1)
      {
          vCam.m_Weight2 = newWeight;
          vCam.m_Weight1 = 100 - newWeight;
      }
      else if (activeCam == 2)
      {
          vCam.m_Weight2 = newWeight;
          vCam.m_Weight1 = 100 - newWeight;
  
      }
  
      if (vCam.m_Weight0 == 100)
      { activeCam = 0; }
      else if (vCam.m_Weight1 == 100)
      {
          if (zoomingIn)
          {
              activeCam = 1;
          } else
          {
              activeCam = 0;
          }
      }
      else if(vCam.m_Weight2 == 100)
      {
          if (zoomingIn)
          {
              activeCam = 2;
          }
          else
          {
              activeCam = 1;
          }
      }
  }
  </code></pre>