Пример #1
0
  public void render(PGraphics g) {
    if (parent != null) rot = PApplet.lerp(rot, parent.rot, 0.25f);

    g.rotate(rot);
    g.textSize(txtSize);
    g.text(txt, 0, 0);
    g.translate(g.textWidth(txt) * kerning, 0);

    for (int i = 0; i < children.size(); i++) children.get(i).render(g);
  }
Пример #2
0
  /**
   * Calculates the new height to assign to a vertex and stores that value in our array of vertex
   * heights.
   *
   * @param inpVertexIdx The index of this vertex in our arrays.
   * @param inpPrevAudioFrameLvlNbr The level number of the previous audio frame.
   * @param inpCurrAudioFrameLvlNbr The level number of the current audio frame.
   * @return The height at which to draw the vertex.
   */
  private float calcAndStoreNewVertexHghtNbr(
      int inpVertexIdx, float inpPrevAudioFrameLvlNbr, float inpCurrAudioFrameLvlNbr) {
    float rtnVertexHghtNbr = 0;

    rtnVertexHghtNbr =
        _modelRadiusNbr
            + _parApp.random(
                0,
                AMPLITUDE_SCALE_NBR
                    * PApplet.lerp(
                        inpPrevAudioFrameLvlNbr, inpCurrAudioFrameLvlNbr, HGHT_INTERPOLATION_NBR));

    _radiusLenNbrs[inpVertexIdx] = rtnVertexHghtNbr;
    return rtnVertexHghtNbr;
  }