reddish = color(204, 51, 0);
greenish = color(102, 153, 51);
blueish = color(51, 102, 153);
void sineCircle(float x, float y, float radius, float period, float amplitude, float rotations) {
float circleStepAngle = TWO_PI/stepsPerCircle;
int stopValue = round(rotations*stepsPerCircle);
float waveStepAngle = period*circleStepAngle;
for (int i = 0; i < stopValue; i++) {
int myColor = lerpColor (reddish, greenish, (float)i/stopValue);
float shift = amplitude*sin(i*waveStepAngle);
rotate (circleStepAngle);
void sineLine(float period, float amplitude) {
for (int x = 0; x < width; x+=5) {
int alpha = (int)map (abs(x-width/2), 0, width/2, 32, 255);
float angle = map (x, 0, width, 0, TWO_PI*period);
float shift = amplitude*sin(angle);
float period = map (mouseX, 0, width, 1f, 10f);
float amplitude = map (mouseY, 0, height, min(height, width) / 24f, min(height, width) / 6f);
sineLine(period, amplitude);
sineCircle(width/2, height/2, min(height, width)/3f, round(period), amplitude, 1f);