Share Posted January 23, 2012 Hi, Anybody can help me to optimizing this : TweenMax.to(elementsFlip[0], 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.2}); TweenMax.to(elementsFlip[1] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); TweenMax.to(elementsFlip[2], 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.2}); TweenMax.to(elementsFlip[3] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); TweenMax.to(elementsFlip[4] , 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.7}); TweenMax.to(elementsFlip[5] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.4}); TweenMax.to(elementsFlip[6] , 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.3}); TweenMax.to(elementsFlip[7] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.1}); TweenMax.to(elementsFlip[8] , 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); TweenMax.to(elementsFlip[9], 0.5, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.9}); TweenMax.to(elementsFlip[10] , 1, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:1}); TweenMax.to(elementsFlip[11] , 0.5, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.7}); TweenMax.to(elementsFlip[12], 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.4}); TweenMax.to(elementsFlip[13], 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.3}); TweenMax.to(elementsFlip[14], 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); TweenMax.to(elementsFlip[15] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.1}); TweenMax.to(elementsFlip[16] , 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.2}); TweenMax.to(elementsFlip[17] , 1, {alpha:0, x:-1000, y:Math.random()*1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); TweenMax.to(elementsFlip[18] , 0.5, {alpha:0, x:-1000, y:Math.random()*-1000, z:Math.random()*3000 , ease:Quad.easeInOut, delay:.5}); Thanks Link to comment Share on other sites More sharing options...

Share Posted January 23, 2012 its fairly easy to alternate the durations of the tweens as you have .5, 1, .5, 1, .5, 1 etc. I can't decipher any pattern or consistency to the delays you are using. at best they seem "pseudo-random", so I really don't know how to solve that problem for you other than suggest you just use delay:Math.random(); as for alternating between a short delay and long delay you can do something like this: import com.greensock.*; var mcs:Array = [mc0, mc1, mc2, mc3, mc4, mc5] for (var i:int = 0; i if( i % 2 == 0){ trace(i + " is even " ); //short duration go down TweenLite.to(mcs[i], .5, {y:String( Math.random()* 100 ), delay:Math.random()}); } else { trace(i + " is odd"); //long duration go up TweenLite.to(mcs[i], 1, {y:String( Math.random()* -100 ), delay:Math.random()}); } } the above code will alternate between moving items up and and down with different durations and random delays. feel free to modify it to suit your needs. cs4 fla attached. Link to comment Share on other sites More sharing options...

Author Share Posted January 24, 2012 Hey Carl ! thanks for tips ! this work fine for me, I don't know how to quantify benefits but work fine thanks again ! for (var i:int = 0; i < flipListArray.length; i++) { element = flipListArray[i] as CardFlip; element.flipToFront(); if( i % 2 == 0) TweenLite.to(element, .5, {alpha:0, x:-1000, y:String( Math.random()* 1000 ), delay:Math.random() * 1, z:Math.random()*3000 , ease:Quad.easeInOut}); else TweenLite.to(element, 1, {alpha:0, x:-1000, y:String( Math.random()* -1000 ), delay:Math.random() * 1, z:Math.random()*3000 , ease:Quad.easeInOut}); } 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 account## Sign in

Already have an account? Sign in here.

Sign In Now