three-sketch
Events and Overwriting Event Handlers
The sketch emits update
, resize
, and mousemove
events at the times you
would expect. Most of the time, the default render/resize/mousemove event
handlers will do everything you need. If you need to do something in addition,
you can use the events to create side effects. If you need to do something
completely different, you can overwrite some of the key handlers:
sketch; sketch { // The default render loop doesn't render to a texture. But now it will! sketchrenderer; }
Example
;; window { const sketch = ; documentbody; const geo = 1 1 1; const mat = color: 0xff0000 ; const box = geo mat; sketchscene; sketchcamerafov = 60; sketchcamerapositionz = 5; sketchcamera; sketch; sketch; sketch; sketchstart; };