mirror of
https://github.com/tweenjs/tween.js.git
synced 2025-12-08 20:16:12 +00:00
13 lines
396 B
JavaScript
13 lines
396 B
JavaScript
// For sake of example, we put animate() in a separate file, and import it into index.js.
|
|
import * as TWEEN from '@tweenjs/tween.js'
|
|
|
|
//If we register the callback animate, but the TWEEN.update(time) returns false,
|
|
//cancel/unregister the handler
|
|
export function animate(time) {
|
|
var id = requestAnimationFrame(animate)
|
|
|
|
var result = TWEEN.update(time)
|
|
|
|
if (!result) cancelAnimationFrame(id)
|
|
}
|