Ciao 访客, welcome back to old school! :p
import processing.opengl.*;void setup(){ size(600,600,OPENGL); lights(); smooth(); background(0);}void draw(){pushMatrix(); fill(255); translate(300,600,-50);//set 300,550,0 zero point pushMatrix(); translate(100,0,0); pushMatrix(); for (int m=0;m<30;m++){ box(120,5,5); translate(0,-30,0); rotateY(-PI/6); } popMatrix(); pushMatrix(); for(int n=0;n<30;n++){ pushMatrix(); translate(-60*cos(PI/6*n),0,-60*sin(PI/6*n)); fill(255); sphereDetail(4); sphere(10); popMatrix(); translate(0,-30,0); } popMatrix(); pushMatrix(); for(int b=0;b<30;b++){ pushMatrix(); translate(60*cos(PI/6*b),0,60*sin(PI/6*b)); fill(255); sphereDetail(4); sphere(10); popMatrix(); translate(0,-30,0); } popMatrix();}
int totalAmount;void setup() { size(500, 500, P3D); lights(); totalAmount = 20;}void draw() { background(255); translate(width/2, height/2); rotateX(mouseY * 0.05); rotateY(mouseX * 0.05); for (int i=0;i<totalAmount;i++){ DrawDna(i*30-height/2); rotateY(10); }}void DrawDna(int Y_) { pushMatrix(); translate(-50, Y_, 0); sphereDetail(4); sphere(10); popMatrix(); pushMatrix(); translate(50, Y_, 0); sphereDetail(4); sphere(10); popMatrix(); line(50, Y_,-50, Y_);}
void setup(){ size(400, 600, P3D); smooth();}void draw(){ background(0); translate(width/2, height/2); rotateX(radians((height/2 - mouseY)*0.6)); rotateY(radians((mouseX))); for (int i=0; i<20;i++){ pushMatrix(); rotateY(radians(30*i)); drawSphere(-50, i, color(255,0,0));//draw first sphere drawSphere(50, i, color(0,0,255));//draw second sphere stroke(150); line(-50, -height/2+30*i, 0, 50, -height/2+30*i, 0); popMatrix(); }}void drawSphere(int transX, int a, int color_){ pushMatrix(); translate(transX, -height/2+30*a); noStroke(); fill(color_); sphere(8); popMatrix();}