CraigM
YaBB Newbies
Offline
Posts: 16
First Impressions
Dec 3rd , 2008, 5:45am
About two hours ago, I installed Processing on my Mac. I figured you guys might want some input from a new user. Install: Easy and standard. IDE: Simple, took only a few seconds to understand. Help: I tried the menu, I got what I wanted. Syntax etc.: Reference seemed good enough, though something a tad more advanced than getting started up front would be nice (Throw a block of code with some variables, ifs and a loop at the end?). It took me a bit to relaize how to to do if statements and loops; and that was found by scanning the referance. I did not read much so it may be there, but a not on the aparent case sensitivity would be good if missing. Results: I implimented a fractal generator with some user input. Heres my code: (Just click 3 points in a triangle to get started) void setup() { //import processing.opengl.*; size(400, 400, P2D); background(0, 0, 0); stroke(50,50,50); } float[] px = new float[0]; float[] py = new float[0]; float v = 0; float x = 0; float y = 0; boolean done=false; void draw() { if (!done && px.length>0){ for (int i = 0; i < 5000 && !done; i = i+1) { int p = round (random(0,px.length-1)); //print ("x"); x=(x-px[p])/2+px[p]; y=(y-py[p])/2+py[p]; color c=get(round(x),round(y)); v=red(c)+1; //print (nf(v,3,3)); if (v>255){ done=true; v=255; } set(round(x),round(y),color(v,v,v)); } } } void mousePressed() { background(0, 0, 0); px=append (px,mouseX); py=append (py,mouseY); x=mouseX; y=mouseY; done=false; } void keyPressed() { if (key == 'c') { px = new float[0]; py = new float[0]; background(0, 0, 0); } else if (key == '0') { background(0, 0, 0); done=false; } } The similar native app builds I made with RealBasic are over on my site at: http://www.spincraftsoftware.com/FractalChaos.html I'll be improving. I just need to add some GUI controlls for adjusting stuff, and maybe even comment my code... Thanks, looks like processing is a great and easy to use and free tool. Edit, about 4 hours in now with much better code (below). Use "c" to clear, and numbers for other stuff. Dragging on the bottom bar also works. Makes fractals via modified chaos game algorithm, enjoy. Edit2: Code removed (its long), applet hosted at: http://fg.98115.net:4520/~max/processing/applet/