import processing.net.*;
Client myClient;
String input="";
String displayString="";
float myScale=1.0, myRatioX = 0.0, myRatioY = 0.0;
void setup() {
myClient = new Client(this, "baike.baidu.com", 80);
myClient.write("GET /view/460250.htm HTTP/1.1\n");
myClient.write("Accept: text/html, text/xml\n");
myClient.write("Host: baike.baidu.com\n\n");
size(900, 300, P3D);
PFont font = loadFont("ArialMT-48.vlw");
textFont(font, 48);
frameRate(20);
smooth();
}
void draw()
{
background(100);
if (myClient.available() > 0) {
input += myClient.readString();
String tokens[] = splitTokens(input, "<>\n");
for (int i = 0 ; i < tokens.length ; i++) {
if (tokens.equals("Title")) {
displayString = tokens[i+1];
}
}
}
if ((displayString.length() > 0) && (myScale > 0)) {
myRatioX += (PI/300);
myRatioY += (PI/460);
myScale -= 0.005;
scale(myScale);
pushMatrix();
translate( 50, height/2, 0);
rotateX(myRatioX);
rotateY(myRatioY);
rotateZ(myRatioY/4);
text(displayString, 0, 0);
popMatrix();
}
}
哪里错了呢?