xxxxxxxxxx
//reference: my lightning is from https://www.openprocessing.org/sketch/152492
// have to open from computer
PVector startPoint;
//building b= new building ();
Tree tree1;
//saron s = new saron ();
boolean show = false;
PImage p;
float h [] = new float [10];
float d [] = new float [10];
float w [] = new float [10];
float X [] = new float [10];
int m;
float circW = 40;
int totalCirc = 20;
float translateAmount = 30;
float rotationDeg = -5;
float counter = 0;
float counter1 = 0;
float counter2 = 0;
float counter3 = 0;
float counter4 = 0;
float counter5 = 0;
float [] x = new float [100];
float [] y = new float [100];
float [] speedx = new float [100];
float [] speedy = new float [100];
float [] r = new float [100];
color [] c = new color [100];
float ml [] = new float [4];
float speed = 0;
void setup () {
size(1500, 1000);
background(0);
p = loadImage("Yogg-Saron small.png");
for(int i = 0; i < 100; i++){
x[i] = random(width);
y[i] = random(height);
speedx[i] = random(-7,1);
speedy[i] = random(5,20);
r[i] = random(100);
c[i] = color(random(123,214),9,237);
}
for (int i = 0; i < 10; i++) {
if (i<4) {
h[i] = 700+i*50+random(-60, 60);
} else if (i==4) {
h[i]=550;
} else {
h[i] = 350+(i-4)*60+random(-40, 40);
}
}
for (int i = 0; i < 10; i++) {
if (i==4) {
d[i] = 250;
} else {
d[i] = random(-50, 150);
}
}
for (int i = 0; i < 10; i++) {
w[i] = random(80, 120);
}
for (int i = 0; i < 10; i++) {
if (i>1)
{
X[i] = w[i]+d[i]+X[i-1];
} else {
X[i]=0;
}
}
for(int i = 0; i <4;i++){
ml[i] = 0+i*15;
speed = 2;
}
startPoint = new PVector(random(0, width), -10);
}
void draw() {
fill(0,5);
rect(0,0,3000,2000);
if (show) {
fill(60,50);
rect(0,0,3000,2000);
startPoint = new PVector(random(0, width), -10);
PVector direction = new PVector(mouseX-startPoint.x, mouseY-startPoint.y);
tree1 = new Tree(startPoint, direction, 0.025*direction.mag());
tree1.displayGND();
tree1.displayBODY();
noStroke();
fill(60,30);
rect(0,0,2000,2000);
for(int i = 0; i < 100; i++){
noStroke();
fill(c[i]);
triangle(x[i],y[i]-5-noise(y[i]),x[i]-5,y[i],x[i]+5,y[i]);
ellipse(x[i], y[i], 20, 20);
if(r[i]<=5){
}
x[i]+=speedx[i]+noise(speedx[i]);
y[i]+=speedy[i]+noise(speedy[i]);
if(x[i]>=width||x[i]<=0||y[i]>=height){
x[i] = random(width);
y[i] = 0;
speedx[i] = random(-5,5);
speedy[i] = random(5,20);
r[i] = random(100);
c[i] = color(random(123,214),9,237);
}
}
frameRate(5);
//arms
pushMatrix();
rotationDeg = map(sin(counter2)+2*noise(counter), -1, 1, -20, 20);
counter2-= 0.01;
translate(230,470);
for (int num = 0; num <= totalCirc; num++) {
translate(0,-translateAmount + num);
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 40, 5);
fill(24,61,0);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();// arm3
//arms
pushMatrix();
rotationDeg = 2*map(sin(counter3)+noise(counter), 0, 1, -20, 20)/3;
counter+= 0.01;
translate(540, 480);
for (int num = 0; num <= totalCirc; num++) {
translate(5,-translateAmount + num);
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 20, 5);
fill(8,145,137);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();// arm4
//arms
pushMatrix();
rotationDeg = map(sin(counter4), -1, 1, -20, 20)/2;
counter4-= 0.05;
translate(375,512);
for (int num = 0; num <= totalCirc+12; num++) {
translate(-5,-translateAmount + num);
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 40, 5);
fill(58,142,62+num*2);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();//arm5
//arms
pushMatrix();
rotationDeg = map(sin(counter5), -1, 1, -20, 20);
counter5-= 0.01;
translate(110,575);
for (int num = 0; num <= totalCirc; num++) {
translate(5,-translateAmount + num);
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 40, 5);
fill(2,11,31);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();//arm6
image (p, -270, -200) ;//show saron
//arms
pushMatrix();
rotationDeg = 2*map(sin(counter), -1, 1, -20, 20)/3;
counter+= 0.01;
translate(600, 675);
for (int num = 0; num <= 35; num++) {
translate(translateAmount - num,-1*(translateAmount - num));
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 60, 5);
fill(8,145,137);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();// arm1
//arms
pushMatrix();
rotationDeg = 2*map(noise(counter), 0, 1, -20, 20);
counter1+= 0.001;
translate(77,770);
for (int num = 0; num <= totalCirc-5; num++) {
translate(0,-translateAmount + num);
rotate (radians(rotationDeg));
circW = map(num, 0, totalCirc, 60, 5);
fill(2,5,42);
noStroke();
ellipse(0, 0, circW, circW);
}
popMatrix();// arm2
noStroke();
fill(0);
rect(0, 750, 1500, 300);//ground
rect(300,700,450,100);
for (int i =0; i < 10; i ++) {
rect(X[i], h[i], w[i], 1000);
}
rect(1100, 100, 150, 1000);
rect(1250, 280, 110, 1000);
rect(840, 650, 1000, 200);
rect(1100, 490, 1000, 200);
rect(0, 740, 350, 100);
} else {
//image (p, 0, 0) ;//show saron
background(0);
for(int i = 0; i < 4; i++){
strokeWeight(5);
stroke(255,0,0);
ellipse(mouseX,mouseY,ml[i],ml[i]);
ml[i]+=speed;
if(ml[i]>=100){
ml[i]=0;
}
}
}
}
void mousePressed() {
show = true;
}
void mouseReleased() {
show = false;
background(0);
}
//void drawBuild() {
// noStroke();
// fill(0);
// rect(0, 800, 1500, 200);//ground
// for (int i =0; i < 10; i ++) {
// rect(x[i], h[i], w[i], 1000);
// }
// rect(1100, 100, 150, 1000);
// rect(1250, 280, 110, 1000);
// rect(840, 650, 1000, 200);
// rect(1100, 490, 1000, 200);
// rect(0, 740, 350, 100);
//}