home
|
featured sketchers
|
gallery
write a sketch
|
community
|
Copy sketch
Printouts
/** * by Evan Rakob AKA PixelPusher * // http://pixelist.info **/ // push the mouse to see it in action // this will be the lag variable float drag = 0.0; int maxRows = 2; int maxCols = 40; void setup() { size(480, 270); colorMode(HSB); drag = 0.0; maxRows = 2; maxCols = 40; } // When the mouse is pressed, jump our lag variable to its high value void mouseReleased() { drag = 6.0; } void draw() { background(80); // clear screen to gray noStroke(); // every time we draw, decrease our lag variable by some percent (the higher the value, // the slower the decrease drag *= 0.92; // the easy way: //int mx = (int) (drag * map(mouseX, 0, width, 1, 30)); // a bit more straightforward: int mx = 4 + (int) (maxCols * drag * (float)mouseX/(float)width + 1); float interval = (float)width/mx; for (int b=0; b < maxRows; b++) { // draw some alternating lines on the screen for (int c=0; c < mx; c++) { if (b % 2 == 0) fill(190.0 * c/(mx-1), 220, 200); else fill(190.0 - 190.0 * c/(mx-1), 220, 200); rect(c*interval, b*height/maxRows, interval, (b+1)*height/maxRows); } } }
Sketches you submit on sketchPatch will be licensed under the
Creative Commons Attribution 3.0 Unported License
. If you upload code based on other people's work, please check the licence compatibility.
Ooops, found some glitches.
Write your sketch here
Check the Processing language
reference
(
most
of it works).
Need inspiration? Play with the examples in
the gallery
.
Title
Tags
Publish
(come on, let other people see your sketch!)
Your comments about the sketch
Push the mouse button to see the colors "snap" back. This was an example sketch from one of my classes in Interactive Art on the Digital Screen Arts course at the University for the Creative Arts, Farnham (UK) http://ucreative.ac.uk