If you really are happy to have them completely random each trial, then looks like around your
trials.data.add('onset', onset)
code line you should just use python’s random number functions (after including “import random”) to get random numbers on each trial to set the animation characteristics. Does that make sense?