Skip to content

Instantly share code, notes, and snippets.

@prideout
Last active May 4, 2020 20:27
Show Gist options
  • Save prideout/ed3bd33c901d9ae953096dac8527f50b to your computer and use it in GitHub Desktop.
Save prideout/ed3bd33c901d9ae953096dac8527f50b to your computer and use it in GitHub Desktop.
getting-started-animation
private val frameCallback = object : Choreographer.FrameCallback {
private val startTime = System.nanoTime()
override fun doFrame(currentTime: Long) {
val seconds = (currentTime - startTime).toDouble() / 1_000_000_000
choreographer.postFrameCallback(this)
modelViewer.animator?.apply {
if (animationCount > 0) {
applyAnimation(0, seconds.toFloat())
}
updateBoneMatrices()
}
modelViewer.render(currentTime)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment