Share Posted July 4, 2013 code: function mostrar_musica () { abrircompuertas.play (); TweenLite.to (columnas, 3, {_x:235, _y:765, ease:Strong.easeOut} ) ;} function mostrar_dvds () { abrircompuertas.play (); TweenLite.to (columnas, 3, {_x:623, _y:457, ease:Strong.easeOut} ) ;} function mostrar_cds () { abrircompuertas.play (); TweenLite.to (columnas, 3, {_x:233, _y:865, ease:Strong.easeOut} ) ;} and so on... var abrircompuertas:TimelineLite = new TimelineLite ( {paused:true} );abrircompuertas.insert (new TweenLite (compuertas.hoja1, 6, {_x:-51.65, _y:51.90 } ) );abrircompuertas.insert (new TweenLite (compuertas.hoja2, 6, {_x:135.60, _y:133.75 } ) ); --------------------------------------------------------------------------------------------------- Is it possible to execute each red line code only after "abrircompuertas.play ();" is completed? Putting the tween that "abrircompuertas.play ();" calls, inside the function is not an option, because i have several functions that are running "abrircompuertas.play ();". Hence i dont want to have to go through all of them if i have to make a change in var abrircompuertas. Link to comment Share on other sites More sharing options...
Share Posted July 4, 2013 you could create a function that creates the same timeline for you every time you need it and that will allow you to re-use that code. Each time one of your 3 functions above is called you create a new timeline that contains the abrircompuertas timeline AND the custom tween at the end assuming v12: function getTimeline() { compuertas.hoja1._x = 0; //or whatever the starting value should be each time the timeline plays from beginning compuertas.hoja1._y = 0; compuertas.hoja2._x = 0; compuertas.hoja2._y = 0;var abrircompuertas:TimelineLite = new TimelineLite ( {} ); abrircompuertas.insert (new TweenLite (compuertas.hoja1, 6, {_x:-51.65, _y:51.90 } ) ); abrircompuertas.insert (new TweenLite (compuertas.hoja2, 6, {_x:135.60, _y:133.75 } ) ); return abrircompuertas;} var mostraTimeline = new TimelineLite(); mostraTimeline.add(getTimeline()); mostraTimeline.to(columnas, 3, {_x:235, _y:765, ease:Strong.easeOut} ) ; function mostrar_musica () { mostraTimeline.restart(); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now