add before-frame handler
before-render and after-render