Last active
May 4, 2020 20:15
-
-
Save prideout/f519e8ae5e071e377b9929b7ea61aec9 to your computer and use it in GitHub Desktop.
getting-started-framevents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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