I have done something similar with glTF. The trick was to run a Python script which exports a file for each timestep. In the animation view, you can add a track called Python. If you double-click the new track, it will show a window where you can edit the script. Then I used the Python trace feature while exporting a glTF to find the Python function I needed.
See more here.