I wanted to make an image and I figured this was the quickest way. The idea is that there are rows with lines 5 pixels high, and every new row, the amount of pixels in between the lines are 1 pixel more than the previous row. It's been a while since I have used java and this is so far what I came up with
size(800,800);
int z = 2;
int w = 5;
int max = 800;
for(int y = 0;y<max;y++){
for(int x = 0;x<max;x=x+z){
point(x,y);
if(y%10 == 0)z++;
}
}
This code is not quite giving me what I expected, and I can't figure out why. any help would be appreciated
Wow, I feel dumb.
size(800,800);
int z = 2;
int w = 5;
int max = 800;
for(int y = 0;y<max;y++){
for(int x = 0;x<max;point(x,y)){
x=x+z;
}
if(y%5 == 0)z++;
}
all I had to do was move the if statement out of the second loop.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.