We are about to switch to a new forum software. Until then we have removed the registration on this forum.
thanks in advance!
Please explain in more detail. I can't understand the question.
here is the main code and the problem i have
import processing.opengl.*; int leth=100,star_size=1; float x[]=new float[leth],y[]=new float[leth]; float angle=0.0,step=2*PI/360,round_a=5,round_b=4,terminate=0; void setup(){ size(900,600,OPENGL); background(0); smooth(8); noStroke(); rdm(); } void draw(){ color blk=color(0,0,0); color blu=color(100,255,252); int size=100; float number=0.01; color change=lerpColor(blk,blu,0); clear(); for(int i=0;i<100;i++){ if(number<=1){ change=lerpColor(blk,blu,number); number=number+0.01; fill(change,30); } else{ fill(blu,30); } if(size>0){ ellipse(300,200,size,size); } size=size-1; } rotte(); star(); } void rdm(){ for(int i=0;i<leth;i++){ x[i]=int(random(0,900)); y[i]=int(random(0,600)); } } void star(){ color blc=color(0,0,0); color org=color(255,252,45); float size_1=5.0,size_2=5.0; float number; color change; for(int i=0;i<leth;i++){ if(x[i]>=0&&x[i]<300){ if(y[i]>=0&&y[i]<200){size_1=7;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=11;} } else if(x[i]>=300&&x[i]<600){ if(y[i]>=0&&y[i]<200){size_1=5;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=13;} } else if(x[i]>=600&&y[i]<=900){ if(y[i]>=0&&y[i]<200){size_1=7;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=11;} } size_2=size_1; number=1/size_1; for(int j=0;j<size_1;j++){ if(number<=1){ change=lerpColor(blc,org,number); number=number+1/size_1; fill(change,30); } else{ fill(org); } if(size_2>0){ ellipse(x[i],y[i],size_2,size_2); } size_2=size_2-1; } } } void rotte(){//here i want the star to rotate with the center of the main star with oval orbit but i dont //know how to int i; if(terminate>=360){terminate=0;} for(i=0;i<leth;i++){ x[i]=x[i]+round_a*cos(angle); y[i]=y[i]+round_b*sin(angle); } angle+=step; terminate++; }
all star move with the center of the main star not each one has its center
or if still cant how to make one star move with the center that can be set?
import processing.opengl.*; int leth=100,star_size=1; float x[]=new float[leth],y[]=new float[leth]; float angle=0.0,step=2*PI/360,round_a=20,round_b=20,center_X=1,center_Y=1,terminate=0; void setup(){ size(900,600,OPENGL); background(0); smooth(8); noStroke(); rdm(); } void draw(){ color blk=color(0,0,0); color blu=color(100,255,252); int size=100; float number=0.01; color change=lerpColor(blk,blu,0); clear(); for(int i=0;i<100;i++){ if(number<=1){ change=lerpColor(blk,blu,number); number=number+0.01; fill(change,30); } else{ fill(blu,30); } if(size>0){ ellipse(300,200,size,size); } size=size-1; } rotte(); star(); } void rdm(){ for(int i=0;i<leth;i++){ x[i]=int(random(0,900)); y[i]=int(random(0,600)); } } void star(){ color blc=color(0,0,0); color org=color(255,252,45); float size_1=5.0,size_2=5.0; float number; color change; for(int i=0;i<leth;i++){ if(x[i]>=0&&x[i]<300){ if(y[i]>=0&&y[i]<200){size_1=7;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=11;} } else if(x[i]>=300&&x[i]<600){ if(y[i]>=0&&y[i]<200){size_1=5;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=13;} } else if(x[i]>=600&&y[i]<=900){ if(y[i]>=0&&y[i]<200){size_1=7;} else if(y[i]>=200&&y[i]<400){size_1=9;} else if(y[i]>=400&&y[i]<=600){size_1=11;} } size_2=size_1; number=1/size_1; for(int j=0;j<size_1;j++){ if(number<=1){ change=lerpColor(blc,org,number); number=number+1/size_1; fill(change,30); } else{ fill(org); } if(size_2>0){ ellipse(x[i],y[i],size_2,size_2); } size_2=size_2-1; } } } void rotte(){ int i; if(terminate>=360){terminate=0;} for(i=0;i<1;i++){ x[i]=center_X+x[i]+round_a*cos(angle); y[i]=center_Y+y[i]+round_b*sin(angle); } angle+=step; terminate++; }
here i change to move only one star but still the center is not the main star
The center of the ellipse is (width / 2, height / 2) :
size(400, 400); translate(width / 2, height / 2); for (float i = 0; i < TWO_PI; i += PI / 40) { point(120 * cos(i), 80 * sin(i)); }
Comments
Please explain in more detail. I can't understand the question.
here is the main code and the problem i have
all star move with the center of the main star not each one has its center
or if still cant how to make one star move with the center that can be set?
here i change to move only one star but still the center is not the main star
The center of the ellipse is (width / 2, height / 2) :