Try this modified code, select option 1 or 2 or 3.
---option=1 //with noise
---option=2 //with double image
---option=3 //with noise and double image
Code:color _edgeColor,
_colors[];
float _edgeAlpha, _colorsAlpha;
int _generation[],
_iteration;
float _image[],
_imageDepth,
_phaseResolution,
_phaseVelocity[],
_phaseDepth,
_phaseAcceleration,
_edgeThreshold;
boolean _returning[];
boolean toggle=true;
int widthheight;
void setup() {
size(800,800);
widthheight=width*height;
//colorMode(HSB, 255);
println("sinks and fountains - created by jeremy awon, jeremyawon.info, contact@jeremyawon.info, jeremy.awon@gmail.com");
initalize();
reset();
}
void mousePressed() {
reset();
}
void initalize() {
_phaseResolution = 3;
_imageDepth = 255; // initially image depth was gray scale pixel color
_phaseDepth = 10;
_phaseAcceleration = 0.001;
_edgeThreshold = 50;
_edgeAlpha = 30;
_colorsAlpha = 50;
String param_phaseResolution = param("phaseResolution");
String param_imageDepth = param("imageDepth");
String param_phaseDepth = param("phaseDepth");
String param_phaseAcceleration = param("phaseAcceleration");
String param_edgeThreshold = param("edgeThreshold");
String param_edgeAlpha = param("edgeAlpha");
String param_colorsAlpha = param("colorsAlpha");
if(param_phaseResolution!=null) {
println("found param_phaseResolution "+param_phaseResolution);
_phaseResolution = max(0,float(param_phaseResolution));
}
else {
_phaseResolution = 3;
}
if(param_imageDepth!=null) {
println("found param_imageDepth "+param_imageDepth);
_imageDepth = max(0,float(param_imageDepth));
}
else {
_imageDepth = 255;
}
if(param_phaseDepth!=null) {
println("found param_phaseDepth "+param_phaseDepth);
_phaseDepth = max(0,float(param_phaseDepth));
}
else {
_phaseDepth = 10;
}
if(param_phaseAcceleration!=null) {
println("found param_phaseAcceleration "+param_phaseAcceleration);
_phaseAcceleration = max(0,float(param_phaseAcceleration));
}
else {
_phaseAcceleration = 0.01;
}
if(param_edgeThreshold!=null) {
println("found param_edgeThreshold "+param_edgeThreshold);
_edgeThreshold = max(0,float(param_edgeThreshold));
}
else {
_edgeThreshold = 50;//0.01
}
if(param_edgeAlpha!=null) {
println("found param_edgeAlpha "+param_edgeAlpha);
_edgeAlpha = max(0,float(param_edgeAlpha));
}
else {
_edgeAlpha = 30;
}
if(param_colorsAlpha!=null) {
println("found param_colorsAlpha "+param_colorsAlpha);
_colorsAlpha = max(0,float(param_colorsAlpha));
}
else {
_colorsAlpha = 50;
}
_colors = new color[100];
_image = new float[width*height];
_generation = new int[width*height];
_phaseVelocity = new float[width*height];
_returning = new boolean[width*height];
_edgeColor = color(0,0,0,_edgeAlpha);
}
void reset() {
_iteration = 0;
//colorMode(HSB, 255);
for(int i=01;i<_colors.length;i++) {
_colors[i] = color(random(100,255),random(100,255),random(100,255),_colorsAlpha);
//_colors[i] = color(random(0,255),100,200,_colorsAlpha);
}
float r = random(0,100);
for(int x=0;x<width;x++) {
for(int y=0;y<height;y++) {
int i = x+(y*width);
_generation[i] = 0;
_image[i] = 0;
_phaseVelocity[i] = noise((x/(float)width)*_phaseResolution, (y/(float)height)*_phaseResolution, r)*_phaseDepth;
_returning[i] = false;
}
}
}
void draw() {
loadPixels();
if((_iteration*_phaseAcceleration)>_phaseDepth) {
reset();
}
for(int i=0;i<width*height;i+=1) {
_image[i] += _phaseVelocity[i];
_phaseVelocity[i] = (_phaseVelocity[i]+_phaseAcceleration);
if(_phaseVelocity[i]>_phaseDepth) {
_phaseVelocity[i] = _phaseVelocity[i]%_phaseDepth;
_returning[i] = true;
}
if(_image[i]>_imageDepth) {
_generation[i] += 1;
_generation[i] %= _colors.length;
_image[i] = _image[i]%_imageDepth;
}
if((_image[i]<_edgeThreshold)&&(!_returning[i])) {
pixels[i] = _edgeColor;
}
else {
pixels[i] = _colors[_generation[i]];
}
}
//@@@@@.added.@@@@@---------------->>>
int option=3;// <<<@@@@@@@ TRY OPTION 1 OR 2 OR 3 @@@@@@@>>>
if (option==1) {//with noise
for(int i=0;i<widthheight;i+=3) {
pixels[i]=pixels[(int)random(widthheight)];
}
}
else if (option==2) {//with double image
for(int i=0;i<widthheight;i+=2) {
pixels[i] = pixels[widthheight-i-1];
}
}
else if (option==3) {//with noise and double image
toggle=!toggle;
if (toggle) {
for(int i=0;i<widthheight;i+=3) {
pixels[i]=pixels[(int)random(widthheight)];
}
}
else {
for(int i=0;i<widthheight;i+=2) {
pixels[i] = pixels[widthheight-i-1];
}
}
}
//@@@@@.added.@@@@@----------------<<<
updatePixels();
_iteration++;
}