Make an animated, clickable button with jit.mgraphics, jit.gl or similar?
Hi there, I'm looking for a lightweight way to create some interactive, animated sprites. For example, I'd like to make a circle that gets bigger and smaller in regular cycles (perhaps triggered by a met), and responds when clicked.
In an early iteration of my work I was able to achieve this by manipulating the presentation_rect of a [panel]. Or even a [button]. But I quickly discovered that animating max objects this way is extremely inefficient. My performance quickly tanked, especially once I got into fullscreen pageantry with dancing panels, etc. Here's a simple example of the kind of thing I was doing:
As fun and easy as this is, the real answer is probably in Jitter. jsui might be an intermediate step, but ultimately I would like to begin exploring all the fun jitter stuff through a lens of building interactive effects.
For my simple case above, I thought jit.mgraphics might be a solution. But animating it is not trivial like it is in my example. I think I would have to draw the circle. Then erase it and redraw it with different dimensions ~60 time/second. I would also need to update my click detection rule each frame as well: if mouseclick is within the dimensions of the most recent circle then bang. (and still, the click detection box would be a square, not a circle)
That is probably do-able. But before I embark on building a bunch of animation scripts and click detection tools for jit.mgraphics, I thought I'd post here for a sanity check and to see if this lovely crowd could get me pointed in the right direction.
Another solution might be to dive right into jit.gl and draw a sphere and manipulate the size from a fixed camera angle. But I didn't see an obvious way to detect when the shape was clicked that I could use to bang something else in the patch. (again, super new to Jitter)
Thanks for any input!