Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.hamoid.*;
- import peasy.*;
- import peasy.org.apache.commons.math.*;
- import peasy.org.apache.commons.math.geometry.*;
- VideoExport videoExport;
- PeasyCam cam;
- PGraphics pg;
- int counter;
- float r;
- void setup() {
- size(600, 600, P3D);
- pg = createGraphics(width, height);
- pg.beginDraw();
- pg.noStroke();
- float maxW = width*2.0;
- for (float w = maxW; w > 0; w -= 2) {
- float f = map(w, maxW, 0, 0, 255);
- pg.fill(f);
- pg.ellipse(width/2, height/2, w, w);
- }
- pg.endDraw();
- videoExport = new VideoExport(this, "internetVideo.mp4");
- videoExport.setFrameRate(30);
- videoExport.setQuality(85, 128);
- //videoExport.startMovie();
- cam = new PeasyCam(this, width/2, height/2, 0, 800);
- cam.setMinimumDistance(50);
- cam.setMaximumDistance(1000);
- frameRate(30);
- }
- void draw() {
- background(pg);
- //lights();
- //background(0);
- strokeWeight(2);
- stroke(0, 150);
- colorMode(HSB, 360, 100, 100);
- r = 150;
- counter = 0;
- pushMatrix();
- translate(width/2, height/2, 200);
- rotateY(frameCount/50.0);
- rotateX(frameCount/75.0);
- rotateZ(frameCount/200.0);
- latitudes();
- colorMode(RGB, 255);
- //videoExport.saveFrame();
- }
- void keyPressed() {
- if (key == 'q') {
- videoExport.endMovie();
- exit();
- }
- }
- void latitudes() {
- float pR = map(sin(frameCount/50.0), -1, 1, 5, 10);
- for (float p = -PI/2; p< PI/2; p += radians(pR)) {
- if (counter%2==0) {
- fill(255);
- } else {
- fill(255, 0, 0);
- }
- float h = map(p, -PI/2, PI/2, 80, 300);
- fill(h, 100, 100, 150);
- beginShape();
- for (float t = 0; t < TWO_PI; t += radians(3)) {
- float x = r * cos(p)*cos(t)*sin(2*p+t);
- //float x = r * cos(p)*cos(t);
- float y = r * cos(p)*sin(t);
- float z = r*sin(p);
- vertex(x, y, z);
- }
- endShape(CLOSE);
- counter++;
- }
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement