API Reference

Events

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

Core Events

EventArgumentsMeaning
updateResolution(width, height)Drawing buffer resolution changed.
playnoneRender loop started.
pausenoneRender loop 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
Properties