gauthiier 6b37eb529e day3
2015-03-04 09:33:55 +01:00

21 lines
344 B
Plaintext

class Oscillator {
float _step, _theta;
float _min, _max, _length;
public Oscillator(float min, float max, float step) {
_min = min;
_max = max;
_length = max - min;
_step = step;
_theta = 0;
}
public float update() {
_theta += _step;
return (sin(_theta) * _length / 2) + _length / 2;
}
}