Last active
May 4, 2020 20:27
-
-
Save prideout/ed3bd33c901d9ae953096dac8527f50b to your computer and use it in GitHub Desktop.
getting-started-animation
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 { | |
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