Best way to do a loading spinner?

5 views
Skip to first unread message

Brian Stafford

unread,
Nov 29, 2020, 4:23:31 AM11/29/20
to GoKi-Gi
Thanks for the awesome GUI package. I've really been enjoying exploring gi. 

I'd like to implement a loading spinner. My initial attempt was to set the `rotate` property of a png, but that didn't seem to work.

I then thought to load an svg and set the `transform` property on the `svg.Editor`, but it looks like the transform is hard coded and doesn't include a `rotate` value. 


I could also do a series of images, and rotate through the frames, but that is pretty tedious. 

Is my read correct so far? What would you recommend?

Thanks,
Brian


Brian Stafford

unread,
Nov 29, 2020, 6:49:33 AM11/29/20
to GoKi-Gi

When I said "set the rotate property", I probably should have said "animate the rotate property".

I do suspect that a good solution would be to draw the SVG frames manually. I just haven't gotten that deep into the svg package yet.

Randall O'Reilly

unread,
Nov 29, 2020, 8:12:40 AM11/29/20
to Brian Stafford, GoKi-Gi
SVG does have local transforms per entity, and having it rotate incrementally is probably the best way to do this. You could just put something in an SVG node and update its rotation in the transform -- should work! Call UpdateStart before updating the rotation, then UpdateEnd after which should then trigger the re-render. Don't use an Icon node because those assume static content which is cached and not re-rendered.

- Randy
> --
> You received this message because you are subscribed to the Google Groups "GoKi-Gi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to goki-gi+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/goki-gi/89cbb858-7af2-4866-b0f9-70c814db3875n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages