Author Topic: Animations  (Read 3297 times)

Yaron2019

  • Guest
Animations
« on: March 22, 2020, 03:40:36 AM »
Hi,
How can I delay a start of one animation until another one is finished?

For example, in this code I have an animation that runs when the layout starts (Transition.StartLayout) and I want the next animation that should run when navigating the wheel Transition.ToNewSelection to NOT run until the StratLayout is complete.


if ( my_config["enable_gboxart"] == "Yes" )
{
   local y = 0.45;
   
   if ( my_config["enable_frame"] == "No" )
      y = 0.47;
      
   local boxart = fe.add_artwork("boxart", flx*0.38, fly*y flw*0.2, flh*0.6 );

   boxart.preserve_aspect_ratio = true;

   local start_transition1 = {
      when = Transition.StartLayout,
      property = "y",
      start = fly*2,
      end = fly*y,
      time = (ini_anim_time+400)
   }
   animation.add( PropertyAnimation( boxart, start_transition1 ) );
   
        // ADD CODE -  DON'T RUN THE NEXT ANIM UNTIL THE FIRST ONE IS FINSIHED
   local move_transition1 = {
      when = Transition.ToNewSelection,
      property = "y",
      start = fly*2,
      end = fly*y,
      time = 1200
   }
   animation.add( PropertyAnimation( boxart, move_transition1 ) );
}

Thnx

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Animations
« Reply #1 on: March 22, 2020, 01:15:34 PM »
Maybe this will work "wait = true,"
Im not sure because you are triggering the second animation with  "when = Transition.ToNewSelection,"



Code: [Select]
   local start_transition1 = {
      when = Transition.StartLayout,
      property = "y",
      start = fly*2,
      end = fly*y,
      time = (ini_anim_time+400)
      wait = true,
   }
   animation.add( PropertyAnimation( boxart, start_transition1 ) );

« Last Edit: March 22, 2020, 01:18:51 PM by qqplayer »

Yaron2019

  • Guest
Re: Animations
« Reply #2 on: April 13, 2020, 11:34:32 PM »
This is the solution, it's somewhat of a hack but it works very well:

if ( my_config["enable_gboxart"] == "Yes" )
{
   local boxart = fe.add_artwork("boxart", flx*x, fly*y, flw*w, flh*h );
   boxart.preserve_aspect_ratio = true;
   
   local start_transition1 = {   when = Transition.StartLayout, property = "y", start = fly*2.5, end = fly*y, time = my_delay+200 }
   animation.add( PropertyAnimation( boxart, start_transition1 ) );

   // stop StartLayout animation when ToNewSelection begins
   function art_transition( ttype, var, ttime )
   {
      if ( ttype == Transition.ToNewSelection)
         start_transition1.time = 1;

      return false;
   }
   fe.add_transition_callback( "art_transition" );

   local move_transition2 = { when = Transition.ToNewSelection, property = "y", start = fly*2.5, end = fly*y, time = my_delay+200 }
   animation.add( PropertyAnimation( boxart, move_transition2 ) );      
}