Hi everybody,
im new on gsap...playing with threejs, tween and audio visualizer.
I have a group with some mesh as child
1 - I would like to animate each element of the mesh with a value created in RAF .
2 - I would like to make endless tween on rotation (unfortunally , "repeat: -1" its not working).
Is there another elegant / better solution for do that.
Thanks in advance for any help...
On RAF i have some function:
1 for render() three scene and one for analyze the sound and pass the value on tween.
So this...
// The sound analyzer .
function soundAnalyzer() {
if ((cristal)&&(frequencyData)){
tl_cristal_rotationX = new TimelineMax({repeat:-1 });
analyser.getByteFrequencyData(frequencyData);
if(typeof frequencyData === 'object' && frequencyData.length > 0) {
scale_value = 9000 - frequencyData[1] * 35 ;
scale_value_Low = 1800 - frequencyData[1] * 5 ;
cristal.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
tl_cristal_rotation = new TimelineMax();
tl_cristal_rotation.to(child.rotation, scale_value_Low, { ease: Linear.easeNone, x: -360 , y: -360, repeat:-1 })
}
});
tl_cristal_rotationX.to(cristal.rotation, scale_value , { ease: Linear.easeNone, x: -360 })
}
}
}
// and here RAF loop and Render
// animation loop
function animate() {
if(dae) {
soundAnalyzer()
}
requestAnimationFrame( animate );
render();
stats.update();
}
TweenLite.ticker.addEventListener("tick", render);
//and render the scene
function render() {
renderer.clear();
camera.position.x += ( mouseX - camera.position.x ) * .015;
camera.position.y += ( - mouseY - camera.position.y ) * .015;
camera.lookAt(scene.position);
composer.reset();
composer.render(scene, camera);
composer.pass(OldVideoPass);
composer.pass(BrightnessContrastPass);
composer.pass(RGBSplitPass);
composer.toScreen();
}
Thank u very much and sorry for my English.. hope is readable..