Thread:4thDimensionTraveler/@comment-25768713-20141230014007/@comment-25768713-20141230183918

Rainbow slinky:

angleMode = "radians";

var period = 120;

var drawSlinky = function(centerX, startY, endY) {

noFill;

colorMode(HSB);

strokeWeight(2);

ellipseMode(CENTER);

var overlap = 0.8;

var space = (endY/overlap - startY)/30;

for (var i = 0; i < 30; i++) {

stroke(i*9, 200, 255);

ellipse(centerX, i*space*overlap + startY, 60, space);

}

};

draw = function {

background(255);

var x = sin(TWO_PI * frameCount / period);

drawSlinky(width/2, 10, x);

};