[x3d-public] delay before animation

Andreas Plesch andreasplesch at gmail.com
Fri Sep 25 17:52:36 PDT 2015


I would like to automatically start a cyclic animation but after some initial delay (say 5s). My first approach was to use a looping timesensor with a startTime. However, setting a startTime on a looping timesensor turns out to be ignored since looping automatically activates the timesensor right after it is loaded (added to the scenegraph?). And active timesensors ignore attempts to set the startTime.

My second approach was then to disable the looping timesensor and use a second nonlooping timesensor with a setable startTime to enable it. This works by routing the isActive event issued by the second sensor after startTime has arrived to the enable field of the looping sensor. While this approach works in principle, it seems rather convoluted. Is there a better, third approach ?

Another issue is how to determine what the startTime is. In x3dom I can override the x3dom.runtime.ready function to get the current time with the JavaScript Date object and then add a delay to arrive at a startTime. (Why does x3dom not provide any of the timestamps such as touchtime or bindtime?)

How would it be best done in x3d ? Is there a sensor which produces a time event when the scene starts ? Use bindTime for the background node ? Is there a way to avoid a script ?

Andreas





-- 

Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453



More information about the x3d-public mailing list