FB社交图像,fb社交,import proce
分享于 点击 30350 次 点评:265
FB社交图像,fb社交,import proce
import processing.opengl.*;void setup() { size(1100, 1100, OPENGL); background(0,30,60); PFont font; font = loadFont("SansSerif-48.vlw"); textFont(font); fill(255); translate(width/2, height/2); textAlign(RIGHT); textSize(10); String friends[] = loadStrings("friends"); //friend names sorted by id String connections[] = loadStrings("connections"); //comma separated friend ids float r = 420; stroke(255, 30); for (int j=0; j<connections.length; j++) { int[] node = int(split(connections[j], ',')); line(r*cos(PI + 2*PI/friends.length*(node[0]+0.5)), r*sin(PI + 2*PI/friends.length*(node[0]+0.5)), r*cos(PI + 2*PI/friends.length*(node[1]+0.5)), r*sin(PI + 2*PI/friends.length*(node[1]+0.5)) ); } for (int i=0; i<friends.length; i++) { //println(friends[i]); text(friends[i], -r-2, 0); rotate(2*PI/friends.length); } }void draw() { //nothing yet}
用户点评