Processing Stillife

2015-08-09 [EverydaySketch]

by schrodingers

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.13/processing.min.js"></script>
<canvas></canvas>

CSS

</style> <script type="text/javascript"> window.addEventListener('load', function() {
    var scripts=document.body.getElementsByTagName('script');
    var canvases=document.body.getElementsByTagName('canvas');
    new Processing(canvases[0], scripts[0].text);
}
, false);
 // Here prevent javascript in body from throwing error </script> <style>

JavaScript

/* 
 title: bezier + mouseY
 date: 2015-08-09
 */
color[] spring = {
      #ff6699, #ff9900, #ffcc00, #9adb1b, #00cc66, #00cccc, #00ccff, #6633cc, #ff66cc
      };
color violet = color(58, 48, 66);
color yellow = color(237, 230, 35);
color cyan = color(5, 190, 255);
float y = 0;
      
void setup() {
    size(800, 600);
    smooth(5);
}
      
 void draw() {    
      background(222);
     // pushMatrix();
      translate(width/2, height/2);
      beginShape();
      noFill();
    for (int i = 1; i < spring.length; i++){      
    stroke(spring[i]);
    vertex(-150, y+i);
    bezierVertex(-150, y+i, 50,height/2-mouseY+i, 150, y+i);
      endShape();
     }

    ellipse(-150, 0, 16, 16);
    ellipse(150, 0, 16, 16);
       //     popMatrix();
}
vooid mouseMoved(){
	redraw();
}