Example #1
0
  public void applyPickColors() {
    float[] nodeHSV = new float[3];
    nodeHSV = Func.RGBtoHSV(app.pickGradEnd);
    float[] pickHSV = new float[3];
    pickHSV = Func.RGBtoHSV(app.pickGradStart);

    for (Node n : net.nNodes) {
      //	calculate hue based on network distance from selected node
      float max = app.getPickdepth();
      float grad = n.pickDistance / max;
      float hue = pickHSV[0] + grad * (nodeHSV[0] - pickHSV[0]);
      float[] result = new float[3];
      result = Func.HSVtoRGB(hue, nodeHSV[1], nodeHSV[2], 0.8f);
      //	set the color of the selection frame
      float alpha = Math.max(0f, Math.min(1, max - n.pickDistance + 1));
      result[3] = alpha;
      n.setPickColor(result);

      //			set the alpha of the node color	based on selection
      if (app.fadeNodes && !n.rollover && !n.isFrame()) n.setAlpha(Math.max(0.05f, alpha));
      else n.setAlpha(app.nodeColor[3]);

      n.genColorFromAtt();
    }
  }