Clarification Question about Draw()
in
Programming Questions
•
2 years ago
Hi All,
I have a sketch in processing that currently includes a loading feature, where my program reads through a large array and loads information from each location in the array, in a manner similar to the following:
int length = array.length();
for(int i = 0; i < length; i++)
{
load information at current location;
}
I'm trying to add a progress bar to this feature where I draw rectangles with increasing widths starting from the same location as different indices in the array are reached. Upon browsing through these forums for a while, I figured that if I want something to animate this way, I would have to have the loading code running from within draw(). As such, I rewrote my code to be called from within draw(), but nothing is getting displayed. I have print statements that concurrently print out the progress the load function is making, so I know that the code is otherwise running properly.
The only explanation that I can think of is that processing draws all the stuff from within draw() only after an entire iteration through the function is completed. I've spent the past 30-40 minutes or so browsing around online trying to find some technical documentation for the draw() function, but I haven't had any luck finding something of that sort. Can anybody on this forum point me to such a page, or alternatively confirm/deny my hypothesis?
Best, and thanks for reading this post,
Sami
1