Is it possible to control animations using a configuration?


(Patrioticcow) #1


I’m planing to use sketchfab to create a short car racing animation and display it in the browser.

Is it possible to control the animation using a configuration file (json, xml, …)?
either by using python or maybe lua

I would like to pass it is configuration file that will dictate witch car will move faster and win the race.

Any ideas?

(Shaderbytes) #2

the viewer API is written in javascript so you need to use javascript. You can write whatever server backend code or frontend code you like to parse your configuration data, but the api remains in javascript and you need to use that when working with it. There are api events for controlling animations. You can set the current animation to play and also control its timeline. But you can not play multiple animations at the same time so it would not be possible to have multiple race cars animations all playing at the same time at different interpolation rates. So your idea is not possible, at least via the animations route. It could be possible if you simply move the object to some position via the api, then you can move each car in a loop. This of coarse would become tricky if the cars are expected to follow some curved path because then you need to control the object rotation as well.