We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › dremerly - painting fun with image based colors
Page Index Toggle Pages: 1
dremerly - painting fun with image based colors (Read 327 times)
dremerly - painting fun with image based colors
Apr 2nd, 2008, 10:16am
 
hey guys

this is a unique flow painting style with image for coloring that and a particles for draw it. the theta was moved when a flow counter reach one and it was trailing. with fadeout, it was get flowized.

this is my code where i wrote


Quote:


//init moverline
int nmb=100;
moverline[] mvr;

void setup(){
 size(500,500,P3D);
 start();
}

void draw(){
 //create fadeout
 fill(0,5);
 rect(0,0,width,height);
 
 //draw it
 for(int a=0;a<nmb;a++){
   mvr[a].interact();
   mvr[a].trail();
 }
}

void start(){
 //initialize here
 background(0);
 for(int a=0;a<nmb;a++){
   mvr[a]=new moverline(250,250,"funkycliche.jpg");
 }
}

void mousePressed(){
 //generated by clicks
 start();
}

void keyPressed(){
 //save that
 if(key == 's'){
   String gal="dreamerly_"+day()+month()+year();
   save(gal);
 }
}

class moverline{
 PImage pim;
 color cp;
 int xd,yd;
 float flowc;
 float theta;
 float spd,spd2;
 float x,x2,x3,x4;
 float y,y2,y3,y4;
 int cn;
 
 moverline(int xd0,int yd0,String fname){
   //construct this
   xd=xd0;
   yd=yd0;
   pim=loadImage(fname);
   cp=pim.get(xd0*int(random(1,10)),yd0*int(random(1,10)));
   
   spd=random(0.5,2.5);
   spd2=random(0.995,1.005);
 }
 
 void interact(){
   //move that
   flowc+=random(0.01,0.1);
   
   //flow-the-position when flow counter reach out
   if(flowc>=1.0){
     setposition();
     flowc=0;
   }
   
   //trail that
   x2=x;
   y2=y;
   x3=x2;
   y3=y2;
   x4=x3;
   y4=y3;
 }
 
 void setposition(){
   //initialize radial moves
   theta=atan2(xd-mouseX,yd-mouseY)*(180/PI);
   x+=spd*cos(theta*PI/180);
   y+=spd*sin(theta*PI/180);
   
   //fadeout speed
   spd*=spd2;
 }
 
 void trail(){
   stroke(red(cp),green(cp),blue(cp),48);
   line(x,y,x4,y4);
 }
}



you can cmment about a problem, your modification, etc.
Page Index Toggle Pages: 1