Quantcast
Viewing all articles
Browse latest Browse all 40524

Using 'for' to loop a loop

Okay I am still missing something. I think I follow what you are doing in your example. But it caused the program to crash so for now if I just stick with the less efficient and probably more confusing method.

I have changed my code a little.

ofSetColor(abs(curserx-300),abs(curserx-300),abs(cursery-300));
ofRect(0,0,600,600);
for ( b = 5; b < 610 ; b += 30){
    for ( a = 0; a < 100 ; a++){
        ax1[a] = 5 + a * 30;
        ay1[b] = a;
        ax2[a] = (abs(curserx)/30 - a);
        ofSetColor(abs(curserx-300),abs(cursery - 300),180);
        ofSetLineWidth(2);
        ofCircle(ax1[a],ay1[a],ax2[a]);
    }
}

The result from this code is the image below:
Image may be NSFW.
Clik here to view.

I am more than confused what exactly I have done to now make the 6th circle offset down twice but nothing else...

What part of my code is causing this and can you explain why?


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>