Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*float xoff;
- void setup() {
- size(600, 600, P3D);
- background(0);
- }
- void draw() {
- background(0);
- xoff = xoff + .01;
- float n = noise(xoff) * width;
- noStroke();
- directionalLight(n+255, 255-n+255, 126, 0, 0, -1);
- for (int i=0; i<20; i++) {
- translate(width/2, height/2, -height/2);
- for (int j=0; j<20; j++) {
- rotateX(frameCount/200.0);
- rotateY(frameCount/100.0);
- box(200);
- }
- }
- }*/
- float taille = 5;
- float x = 100;
- float y = 80;
- float xoff;
- PVector[][] globe;
- int total = 15;
- float doff=0;
- //PGraphics ciel = new PGraphics();
- void setup() {
- size(1200, 1200, P3D);
- //ciel = createGraphics(width,height);
- background(27, 11, 61);
- frameRate(30);
- globe = new PVector[total+1][total+1];
- }
- float nombreEtoile;
- void draw() {
- //ciel.beginDraw();
- float bigEtoile = random(500);
- if (nombreEtoile <500) {
- fill(255, 255, 255);
- ellipse(random(width), random(height), random(5), random(7));
- nombreEtoile = nombreEtoile + 0.7 ;
- }
- //ciel.endDraw();
- if (nombreEtoile>490) {
- //fill(255);
- //xoff = xoff +.01;
- //float n = noise(xoff) * width;
- //noStroke();
- //directionalLight(n+255, 255-n+255, 126, 0, 0, -1);
- //for (int i=0; i<20; i++) {
- /* fill(0, 0, 0, 10);
- rect(0, 0, width, height);
- if (int(random(30))==int(random(30))) {
- eclair(int(random(5)+5), random(width), 0, 10);
- }*/
- /*translate(width/2, height/2, -height/2);
- for (int j=0; j<20; j+=20) {
- rotateX(frameCount/200.0);
- rotateY(frameCount/100.0);
- sphere(taille);
- }*/
- fill(0, 0, 0, 10);
- rect(0, 0, width, height);
- if (int(random(30))==int(random(30))) {
- eclair(int(random(5)+5), random(width), 0, 10);
- }
- fill(255, 255, 255);
- ellipse(random(width), random(height), random(5), random(7));
- nombreEtoile = nombreEtoile +0.5 ;
- }
- if (nombreEtoile>800) {
- background(0);
- fill(255, 255, 255);
- ellipse(random(width), random(height), random(5), random(7));
- nombreEtoile = nombreEtoile + 0.5 ;
- doff+=0.01;
- translate(width/2, height/2, -width/2);
- noStroke();
- lights();
- /*rotateX(map(mouseY, 0, height, -PI, PI));
- rotateY(map(mouseX, 0, width, -PI, PI));*/
- //rotateX(PI/3);
- //rotateY(PI/3);
- fill(50, 50, 50, 200);
- voule(0, 0, 250+noise(doff)*50);
- fill(50, 50, 50, 200);
- voule(220, 10, 50+noise(doff)*50);
- fill(50, 50, 50, 200);
- voule(-20, -0, 200+noise(doff)*50);
- fill(0, 0, 0, 10);
- rect(0, 0, width, height);
- if (int(random(30))==int(random(30))) {
- eclair2(int(random(5)+5), random(-150, 150), random(-150, 150), 10);
- }
- } else if (nombreEtoile>1000) {
- }
- taille = taille + 1;
- if (taille > 100) {
- taille = 100+noise(doff)*50;
- }
- }
- void voule(int cx, int cy, float cr ) {
- translate(cx, cy);
- float xoff=0.01;
- float r = cr;
- for (int i = 0; i < total+1; i++) {
- float lat = map(i, 0, total, 0, PI);
- for (int j = 0; j < total+1; j++) {
- xoff+=0.5;
- float lon = map(j, 0, total, 0, TWO_PI);
- float x = (r+noise(xoff)*100) * sin(lat) * cos(lon);
- float y = (r+noise(xoff)*100) * sin(lat) * sin(lon);
- float z = (r+noise(xoff)*100) * cos(lat);
- globe[i][j] = new PVector(x, y, z);
- }
- }
- for (int i = 0; i < total; i++) {
- float hu = map(i, 0, total, 0, 255*6);
- noStroke();
- strokeWeight(1);
- beginShape(TRIANGLE_STRIP);
- for (int j = 0; j < total+1; j++) {
- PVector v1 = globe[i][j];
- vertex(v1.x, v1.y, v1.z);
- PVector v2 = globe[i+1][j];
- vertex(v2.x, v2.y, v2.z);
- }
- endShape();
- }
- }
- void eclair(int lng, float cx, float cy, float cs) {
- pushMatrix();
- float x=cx;
- float y=cy;
- float s=cs;
- for (int i=0; i<lng; i++) {
- float vx = random(-50, 50);
- float vy = random(30, 200);
- s=s* 0.8;
- strokeWeight(s);
- stroke(255);
- line(x, y, x+vx, y+vy);
- if (int(random(5))==int(random(5))) {
- pushMatrix();
- eclair(int(random(5)), x, y, s);
- popMatrix();
- }
- x=x+vx;
- y=y+vy;
- }
- popMatrix();
- }
- void eclair2(int lng, float cx, float cy, float cs) {
- pushMatrix();
- float x=cx;
- float y=cy;
- float s=cs;
- for (int i=0; i<lng; i++) {
- float vx = random(-150, 150);
- float vy = random(-150, 150);
- s=s* 0.8;
- strokeWeight(s);
- stroke(255);
- line(x, y, x+vx, y+vy);
- if (int(random(5))==int(random(5))) {
- pushMatrix();
- eclair(int(random(5)), x, y, s);
- popMatrix();
- }
- x=x+vx;
- y=y+vy;
- }
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement