PFont f; XMLElement xml; int n = 96; PImage[] images = new PImage[n]; String[] lis; String[] lis2; int[] c = {0, 125, 200}; int h =3200; void setup() { size(740,h+30); smooth(); f = loadFont("SansSerif.bold-16.vlw"); textFont(f,20); textAlign(LEFT); noStroke(); background(255); noLoop(); xml = new XMLElement(this, "achievementslist.xml"); XMLElement thing = xml; XMLElement[] achievement = thing.getChildren("achievement"); System.out.println(achievement.length); String[] name = new String[n]; String[] values = new String[n]; for(int k = 0; k< n; k++) { name[k] = achievement[k].getChild("name").getContent(); values[k] = achievement[k].getChild("earned").getContent(); images[k] = loadImage("http://www.spore.com/static/war/images/achievements/" + achievement[k].getChild("guid").getContent() + ".png"); } lis=name; lis2 = values; } void draw(){ fill(0.85*c[0], 0.85*c[1], 0.85*c[2]); rect(5, 2, width-10, 26); for(int j = 1; j<=n; j++) { float cF = colorFactor(j, n); if( j % 2 == 0) { fill(c[0], c[1], c[2], cF*255); }else{ fill(182); } System.out.println(lis2[j-1]); drawSquare(lis[j-1], lis2[j-1], n-j, n); } fill(255); rect(55, 0, 2, height); rect(610, 0, 2, height); textFont(f,14); textAlign(LEFT); text("ACHIEVEMENT", 120, 20); textAlign(LEFT); text("EARNED", 646 ,20); save("achievementslist.png"); } void drawSquare(String txt1, String txt2, int pos, int n){ float a = h*pos/n; int b = round(a); rect(0+5, b+30, width-10, h/n-2); fill(0); textFont(f,16); textAlign(RIGHT); text(Integer.toString(pos+1) + ".", 40, b+h/(n)+20); textAlign(LEFT); System.out.println(txt1); text(txt1, 115, b+h/(n)+20); textAlign(RIGHT); text(txt2, 30*width/32, b+h/(n)+20); image(images[n-pos-1], 75 , b+h/(n)-2, 30,30); } float colorFactor(int i, int n) { float ff = 1.1/(1-1/n)*(i)/n ; return ff; }