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 › Noob needs simple help !
Page Index Toggle Pages: 1
Noob needs simple help ! (Read 696 times)
Noob needs simple help !
Apr 18th, 2010, 9:08pm
 
Hey, im learning processing at uni. We have our first assignment and the brief is very simple, create a small processing app that the user can interact with. what i have so far is a modified version of someones work which is allowed, but i need to add something else of my own.

int angle = 0;  
int objectMode=1;
int currcol=214;
color backCol = color(255,255,255);


void setup()  
{  
 size(300, 500, P2D);  
 colorMode(HSB, 360, 255, 255, 255);
 background(backCol);  
 smooth();  
 noStroke();  
 fill(0, 102);  
}  

void draw()
{  

 // Draw only when mouse is pressed  
 if (mousePressed) {  
   angle += 10;  
   float val = cos(radians(angle)) * 20.5;  
   for (int a = 0; a < 360; a += 20) {  
    float xoff = random(0, 5)*cos(radians(a)) * val;  
    float yoff = random(0, 5)*sin(radians(a)) * val;  
    fill(currcol,random(255),random(255), random(100, 255));  
       drawShape(new PVector(mouseX+xoff,mouseY+yoff),objectMode,val);
   }  
   currcol+=random(-20,20);
 }  
 float ab=avgbright();
 if(ab<200) filter(DILATE);
 else if (ab>250) filter(ERODE);
}

void mouseReleased()
{
    if (mouseButton==RIGHT) background(backCol);
}

void keyReleased()
{
 switch(key)
 {
   case 'm':
    objectMode++;
    if (objectMode>3) objectMode-=3;
   break;
 }
}

void drawShape(PVector Pos, int mode, float param1)
 {
   switch (mode)
   {
   case 1:
     rect(Pos.x,Pos.y,param1,param1);  
     break;
   case 2:
     ellipse(Pos.x,Pos.y,param1,param1);  
     break;
   case 3:
     float start=random(0,TWO_PI);
     arc(Pos.x,Pos.y,param1,param1,start,random(start,TWO_PI));  
     break;
   }
 }
 
float avgbright()
{
 float totalbright=0;
 loadPixels();
 for(int i=0; i<pixels.length; i++)
 {
   totalbright+=brightness(pixels[i]);
 }
 return totalbright/pixels.length;
}  


this is what i have so far, pretty simple. does anyone have any code i could integrate into this? i was thinking a slow moving spiral that would effect the drawing as its applied. ill be looking for something till thurs when its due, but would really, really appreciate some help !

really anything you could add to it would be great ! im soo friggin noob at this , coding really isnt my thing...
Re: Noob needs simple help !
Reply #1 - Apr 19th, 2010, 3:20pm
 
well you could make it simpler.. say just drawing a single square..

Once you do this, then you could think about other things that you could draw.. smilies or planes or whatever.. something funny and memorable!!

Re: Noob needs simple help !
Reply #2 - Apr 19th, 2010, 10:31pm
 
todles wrote on Apr 18th, 2010, 9:08pm:
i need to add something else of my own.
[...]
does anyone have any code i could integrate into this

I see a little contradiction here...
Re: Noob needs simple help !
Reply #3 - Apr 20th, 2010, 3:59am
 
Hello,
i' m a noobie as well.
What i can do is suggesting You to watch this video podcast tutorial
http://deimos3.apple.com/WebObjects/Core.woa/Browse/ilstu-public.3163972486
It's very simple and starts from the beginner level.
Hope it helped a little.
sh
Page Index Toggle Pages: 1