add note in console to use seconds [not frames] for animations

This commit is contained in:
Leon van Kammen 2024-12-10 14:36:11 +00:00
parent edfab56347
commit 9c23a6e2a3
1 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,6 @@
xrf.frag.t = function(v, opts){ xrf.frag.t = function(v, opts){
let { frag, mesh, model, camera, scene, renderer, THREE} = opts let { frag, mesh, model, camera, scene, renderer, THREE} = opts
// handle object media players // handle object media players
if( mesh && mesh.media ){ if( mesh && mesh.media ){
for( let i in mesh.media ) mesh.media[i].set("t",v) for( let i in mesh.media ) mesh.media[i].set("t",v)
@ -52,13 +51,14 @@ xrf.addEventListener('parseModel', (opts) => {
model.animations.map( (a) => mixer.duration = ( a.duration > mixer.duration ) ? a.duration : mixer.duration ) model.animations.map( (a) => mixer.duration = ( a.duration > mixer.duration ) ? a.duration : mixer.duration )
} }
model.animations.map( (anim) => { model.animations.map( (anim) => {
anim.optimize() console.log("animation action: "+anim.name)
if( xrf.debug ) console.log("action: "+anim.name)
mixer.actions.push( mixer.clipAction( anim, model.scene ) ) mixer.actions.push( mixer.clipAction( anim, model.scene ) )
}) })
mixer.play = (t) => { mixer.play = (t) => {
let msg = `media fragment: ${t.x}-${t.y} seconds`
if( t.x > 49 ) msg += ", not frames (!)"
console.log(msg)
mixer.isPlaying = t.x !== undefined && t.x != t.y mixer.isPlaying = t.x !== undefined && t.x != t.y
mixer.updateLoop(t) mixer.updateLoop(t)
xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying}) xrf.emit( mixer.isPlaying === false ? 'stop' : 'play',{isPlaying: mixer.isPlaying})