Animating an ellipse

219 views
Skip to first unread message

Bram

unread,
Oct 18, 2021, 12:00:27 PM10/18/21
to Bonsai Users
Hi,

We'd like to animate an ellipse (moving from one end of the screen to the other), but the circle animation module of bonvision doesn't allow changing the two axes of the circle separately. On the other hand, the ellipse tool isn't compatible with the animation modules. Is there a way to solve this?

Thanks in advance!
Bram

brunocruz

unread,
Oct 19, 2021, 8:19:42 AM10/19/21
to Bonsai Users
Hey Bram,

There might be other ways of doing this, but one that came to mind:
The "drawCircle" is actually a grouped node made up of other nodes (press F12 when selecting this node). 
Since before performing the "UpdateUniform" on a specific shader, drawCircle seems to scale both Y and X axis, we can draw ellipses by passing different values to these two parameters. To do this, we need to slightly modify the code that exists inside drawCircle however, since by default it passes a single value to both X and Y.

Basically instead of :
Capture.PNG

parameterize ExtentX and Y with different input values:

Capture.PNG
This should allow you to draw an ellipse using the shaders package! I have attached a modified workflow just in case. It seems to work on my PC as far as I can tell :P

Hope it helps,

Bruno
drawEllipse.bonsai

Bram

unread,
Oct 27, 2021, 9:22:15 AM10/27/21
to Bonsai Users
Hi Bruno,

This worked perfectly, thank you so much!
Reply all
Reply to author
Forward
0 new messages