API Reference

Events

Subscribe to an event with shader.on(eventName, callback) and remove a listener with shader.off(eventName, callback).

Core Events

EventArgumentsMeaning
updateResolution(width, height)drawing buffer resolution changed
playnonerender loop started
pausenonerender loop actually transitioned to paused
resetnoneframe/time and history were reset
destroynoneresources were released
beforeStep(time, frame, options?)before a render step
afterStep(time, frame, options?)after a render step
beforeDraw(options?)before a draw
afterDraw(options?)after a draw
initializeTexture(name, source, options?)texture initialized
initializeUniform(name, type, value, options?)uniform initialized
updateTextures(updates, options?)public texture update finished
updateUniforms(updates, options?)uniform update finished

Plugin Events

EventMeaning
autosize:resizeautosize plugin changed canvas dimensions
face:ready, face:resultface plugin lifecycle
pose:ready, pose:resultpose plugin lifecycle
hands:ready, hands:resulthands plugin lifecycle
segmenter:ready, segmenter:resultsegmenter plugin lifecycle
Previous
Methods