I was taking a look at Mr. Doob’s wonderful sketches on his website and you can open them all up in the three.js Editor and view the actual scene setup/code. I’m unfamiliar with the editor though as I’ve been doing all my sketches on codepen and using renderer.render(scene, camera) to render all my scenes, I don’t see that in any render() functions in the editor. Instead I see a function called update(event) in all the objects that are animated. Within the method the event object is being used to get the time, at the point the method is called I assume, as event.time. I know this isn’t a standard javascript event object because the javascript event object uses Event.timeStamp, but I can’t find it in any of the three.js docs or examples on the actual website. Does anyone know more about this object/method?
Unfortunately, there is no documentation about the editor. The actual event object is created at the following place:
If you create a function with name update
in an editor script, it will be mapped to the events.update
array. dispatch()
is responsible to call all update functions in events.update
and provide the mentioned event object with timing values as a parameter.
BTW: event.timeStamp
does not exist. Where have you seen this?
Thank you for the very informative reply, this helps a lot.
And on Event.timeStamp i found it listed in the mdn web docs:
I’ve personally never used it, but it is there
I think you have mixed up two things. The posted Event
interface has nothing to do with the event object generated in the editor.
Yes I realize that now, but because there is no documentation for the editor I wasn’t sure if the event object being used was the js Event object or a Three.js generated object. Again, thank you for the help
At least there is already an issue which tracks this request