SHARE
TWEET
Untitled
a guest
Oct 31st, 2015
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public void render(ShapeRenderer renderer, float cameraX) {
- float waveWidth = _screenWidth / _numWavesToShow;
- float angle;
- float prevX = cameraX, prevY = waveEquation(0.0f);
- for (int i = 0; i < _numWaveToShow; i++) {
- for (angle = 0.0f; angle < 2 * Math.PI; angle += 2 * Math.PI / numLinesPerWave) {
- float x = cameraX + getXForAngle(angle) + i * waveWidth;
- float y = waveEquation(phase, angle);
- drawLine(renderer, prevX, prevY, x, y, _lineThickness);
- prevX = x;
- prevY = y;
- }
- }
- }
- protected float waveEquation(float angle) {
- return (float) Math.sin(angle) * _amplitude * (0.5f + (float) Math.random()) + _screenHeight / 2.0f;
- }
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.

