Copy link to clipboard
Copied
Hi, i'm animating a web banner, which is supposed to loop infinite times. The thing is, i learnt to use tweening prototype for my animation, so the entire code is written on a single frame.
Is there a way to loop the entire movie at the end?
use:
...
clearInterval(iniciarI);
var iniciarI:Number=setInterval(iniciar,2000);
iniciar();function iniciar (){
//INTRO//
_root.fondo._x=2632;
_root.fondo._y=223;
_root.fondo.tween("_x",-38,25,"easeOutCubic",0.5)
_root.bloqueintro._x=535
_root.bloqueintro._y=226
_root.bloqueintro.tween("_x",-600,1.5,"easeOutCubic",6.5)
_root.opt._x=468
_root.opt._y=-50
_root.opt.tween("_y",146,1.5,"easeOutCubic",1.5)
_root.opt.tween("_x",-270,1.5,"easeOutCubic",6.5)
_root.esp._x=530
_root.esp._y=198
_root.esp._yscale=0
_root.esp.twee
Copy link to clipboard
Copied
put whatever code that initiates your animation into a function body. call that function when your animation ends.
Copy link to clipboard
Copied
Thanks! but I still need help.
Ok, let's say this is the code:
function iniciar (){
//INTRO//
_root.fondo._x=2632;
_root.fondo._y=223;
_root.fondo.tween("_x",-38,25,"easeOutCubic",0.5)
_root.bloqueintro._x=535
_root.bloqueintro._y=226
_root.bloqueintro.tween("_x",-600,1.5,"easeOutCubic",6.5)
_root.opt._x=468
_root.opt._y=-50
_root.opt.tween("_y",146,1.5,"easeOutCubic",1.5)
_root.opt.tween("_x",-270,1.5,"easeOutCubic",6.5)
_root.esp._x=530
_root.esp._y=198
_root.esp._yscale=0
_root.esp.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.esp.tween("_x",-459,1.5,"easeOutCubic",6.5)
_root.de._x=621
_root.de._y=246
_root.de._yscale=0
_root.de.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.de.tween("_x",-368,1.5,"easeOutCubic",6.5)
_root.trab._x=664
_root.trab._y=292
_root.trab._yscale=0
_root.trab.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.trab.tween("_x",-325,1.5,"easeOutCubic",6.5)
//CONECTOR//
_root.conector._x=1659;
_root.conector._y = 244;
_root.conector.tween("_x",-800,1.5,"easeOutCubic",6.5);
_root.conector2._x=-800;
_root.conector2._y = 244;
_root.conector2.tween("_x",1924,1.5,"easeOutCubic",13);
_root.conector3._x=1924;
_root.conector3._y = 244;
_root.conector3.tween("_x",-800,1.5,"easeOutCubic",21);
_root.conector4._x=-800;
_root.conector4._y = 244;
_root.conector4.tween("_x",1924,1.5,"easeOutCubic",27);
};
iniciar();
So the whole animation is now into a function body. Still, how can i loop that function, if i only have one frame?
Copy link to clipboard
Copied
use:
clearInterval(iniciarI);
var iniciarI:Number=setInterval(iniciar,2000);
iniciar();function iniciar (){
//INTRO//
_root.fondo._x=2632;
_root.fondo._y=223;
_root.fondo.tween("_x",-38,25,"easeOutCubic",0.5)
_root.bloqueintro._x=535
_root.bloqueintro._y=226
_root.bloqueintro.tween("_x",-600,1.5,"easeOutCubic",6.5)
_root.opt._x=468
_root.opt._y=-50
_root.opt.tween("_y",146,1.5,"easeOutCubic",1.5)
_root.opt.tween("_x",-270,1.5,"easeOutCubic",6.5)
_root.esp._x=530
_root.esp._y=198
_root.esp._yscale=0
_root.esp.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.esp.tween("_x",-459,1.5,"easeOutCubic",6.5)
_root.de._x=621
_root.de._y=246
_root.de._yscale=0
_root.de.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.de.tween("_x",-368,1.5,"easeOutCubic",6.5)
_root.trab._x=664
_root.trab._y=292
_root.trab._yscale=0
_root.trab.tween("_yscale",100,1,"easeOutBounce",2.5)
_root.trab.tween("_x",-325,1.5,"easeOutCubic",6.5)
//CONECTOR//
_root.conector._x=1659;
_root.conector._y = 244;
_root.conector.tween("_x",-800,1.5,"easeOutCubic",6.5);
_root.conector2._x=-800;
_root.conector2._y = 244;
_root.conector2.tween("_x",1924,1.5,"easeOutCubic",13);
_root.conector3._x=1924;
_root.conector3._y = 244;
_root.conector3.tween("_x",-800,1.5,"easeOutCubic",21);
_root.conector4._x=-800;
_root.conector4._y = 244;
_root.conector4.tween("_x",1924,1.5,"easeOutCubic",27);
};
Find more inspiration, events, and resources on the new Adobe Community
Explore Now