Playing GLTF animation with start and end time #80
Answered
by
jnsmalm
goldenratio
asked this question in
Q&A
-
I have gltf animation model, duration is 2 minutes or so. I would need to categories those animations based on start and end, like in unity. |
Beta Was this translation helpful? Give feedback.
Answered by
jnsmalm
Feb 14, 2022
Replies: 1 comment 1 reply
-
It's not built in, but you can create this function yourself. function playAnimationClip(animation, fromTime, endTime, loop) {
animation.position = fromTime
let ticker = new PIXI.Ticker()
ticker.add(() => {
animation.position += ticker.deltaMS / 1000
if (animation.position < endTime) {
return
}
if (loop) {
if (animation.position > endTime) {
animation.position = fromTime
}
}
else {
animation.position = endTime
}
})
ticker.start()
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
goldenratio
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's not built in, but you can create this function yourself.