todles
YaBB Newbies
Offline
Posts: 1
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...