Skip to content

Instantly share code, notes, and snippets.

@prideout
Last active May 4, 2020 20:15
Show Gist options
  • Save prideout/f519e8ae5e071e377b9929b7ea61aec9 to your computer and use it in GitHub Desktop.
Save prideout/f519e8ae5e071e377b9929b7ea61aec9 to your computer and use it in GitHub Desktop.
getting-started-framevents
private val frameCallback = object : Choreographer.FrameCallback {
override fun doFrame(currentTime: Long) {
choreographer.postFrameCallback(this)
modelViewer.render(currentTime)
}
}
override fun onResume() {
super.onResume()
choreographer.postFrameCallback(frameCallback)
}
override fun onPause() {
super.onPause()
choreographer.removeFrameCallback(frameCallback)
}
override fun onDestroy() {
super.onDestroy()
choreographer.removeFrameCallback(frameCallback)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment