SHARE
TWEET

Untitled

a guest Oct 31st, 2015 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public void render(ShapeRenderer renderer, float cameraX) {
  2.                 float waveWidth = _screenWidth / _numWavesToShow;
  3.                 float angle;
  4.                 float prevX = cameraX, prevY = waveEquation(0.0f);
  5.                 for (int i = 0; i < _numWaveToShow; i++) {
  6.                         for (angle = 0.0f; angle < 2 * Math.PI; angle += 2 * Math.PI / numLinesPerWave) {
  7.                                 float x = cameraX + getXForAngle(angle) + i * waveWidth;
  8.                                 float y = waveEquation(phase, angle);
  9.                                 drawLine(renderer, prevX, prevY, x, y, _lineThickness);
  10.                                 prevX = x;
  11.                                 prevY = y;
  12.                         }
  13.                 }
  14.         }
  15.         protected float waveEquation(float angle) {
  16.                 return (float) Math.sin(angle) * _amplitude * (0.5f + (float) Math.random()) + _screenHeight / 2.0f;
  17.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top