I am trying to use Shady to present a sequence of image frames. In the past I've done this by assigning to the stimulus.page attribute an animation callback. In the callback, which is called by Shady once for each monitor frame, I first check a global variable that keeps track of which stimulus frame should be displayed. If it is positive, I set the visibility of the stimulus to True and return the frame number; otherwise I set it to False and return 0. Works like a charm.
Now I need to extend this, because I need to select one among a number of sequences to display. Since loading a sequence can take some time, I load them all at the beginning of my program and associate each with a Stimulus object. Now, here is my question. Do I have to create a different animation callback function for each of the sequences (whose number is variable, and can be high). Or is there a more elegant way to have a single animation callback (or something similar) being called, and in there I determine which frame of which sequence to show (again, based on the current value of global variables)?