Hey, guys. I was really inspired by one of the generative posters created by the extremely talented Tim Rodenbröker (https://www.instagram.com/p/B8oM8r7i1ns/?utm_source=ig_web_copy_link), so I tried to create something similar as a part of one of my school projects. The idea was to create a poster of two rasterized images with different color values, which will blend into each other with the help of lerpColor()
and some oscillating waves.
I did my best and for the most part, my attempt wasn’t that bad. However, I found an issue while playing around with my code. Basically, processing doesn’t recognize that there is a second image being imported to the sketch and projects 2 rasterized duplicates of the first one. Any ideas on how to fix this?
I tried using blendMode()
but I wasn’t exactly sure how to integrate it within the code. Other than that I also wanted to ask if you guys have any suggestions for achieving smoother wave transitions. In my case the wave transition equals trans = width*0.01*cos(radians(frameCount));
but its kinda aggressive compared to example from Instagram. Here is another example for smooth transition https://www.instagram.com/p/B35F69mC8-e/?utm_source=ig_web_copy_link
P.S you can use whatever .jpg images you find. Just rename them to image.jpg
and image2.jpg
Size doesn’t matter because they both will be resized.
Thanks in advance for any help you are able to provide
PImage img;
PImage img2;
float tilesX = 200;
float tilesY = 200;
float tileW;
float tileH;
color c;
color c2;
color c3;
float bri;
float bri2;
float waveX;
float waveX2;
float wave3;
float trans;
void setup(){
size(600,900,P3D);
img= loadImage("image.jpg");
img2= loadImage("image2.jpg");
img.resize (600,0);
img2.resize (600,0);
tileW = width/tilesX;
tileH = height/tilesY;
noCursor();
noStroke();
fill(0);
}
void draw(){
background(255);
for(int x = 0; x < tilesX; x++){
for(int y = 0; y < tilesY; y++){
c = img.get(int(x*tileW) ,int(y*tileH));
c2 = img2.get(int(x*tileW) ,int(y*tileH));
bri = map(brightness(c),0,255,4,1);
bri2 = map(brightness(c2),0,255,4,1);
waveX = tan(radians(frameCount*6-0.5*x));
waveX2 = -tan(radians(frameCount*10-0.5*x));
wave3 = tan(radians(frameCount*5+x*1+y*1));
c3 = lerpColor(c, c2, wave3);
trans = width*0.01*cos(radians(frameCount));
stroke(21);
strokeWeight(bri);
stroke(80,255,50); //here I define the first color using rgb values
point(x*tileW + waveX*trans, y*tileH + waveX*trans);
stroke(80,200,210); //here I define the second color using rgb values
point(x*tileW + waveX2*trans, y*tileH + waveX2*trans);
}
}
}