Author Topic: Animation issue  (Read 6282 times)

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
Animation issue
« on: January 01, 2016, 05:56:40 AM »
I am working on animation, but facing some issue. I would like a image in and out with animation in 2 conditions (Transition.ToNewList  & Transition.ToNewSelection)

When I startup AM, then trigger Transition.ToNewList. At this moment, press key to select new game. It will trigger second animation. Then it runs 2 times. How to modify the code to run one time only? Thanks. 

Code: [Select]
::OBJECTS <- {
 marquee = fe.add_artwork("marquee", flx*-0.2, fly*0.69, flw*0.18, flh*0.1 ),
}

 local move_marquee1 = {
   when = Transition.ToNewList ,property = "x", start = flx*-0.2, end = 0, time = 600
 }
 local move_marquee2 = {
    when = Transition.ToNewSelection ,property = "x", start = flx*-0.2, end = 0, time = 600,
 }
 local move_marquee3 = {   
  when = Transition.ToNewList ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
 }
 local move_marquee4 = {   
  when = Transition.ToNewSelection ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
 }

 animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee1 ) );
 animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
 animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee3 ) );
 animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee4 ) );

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Animation issue
« Reply #1 on: January 01, 2016, 06:56:14 AM »
This is a bit tricky if I'm understanding correctly..

If you don't want it to happen for each game, you could use Transition.StartLayout and Transition.ToNewList - this will make the animation happen when AM starts up and when you switch to a different list.

If you do want it to happen on each game selected - when you switch lists I believe it does both a ToNewList and ToNewSelection transition. If you assign the animation to a variable, you could probably stop the one you don't want to happen in your own transition callback when you switch lists, something like:

Code: [Select]
local move2anim = animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
function on_transition( ttype, var, ttime )
{
  if ( ttype == Transition.ToNewList ) move2anim.stop();
}

This could probably work for you. Animate v2 has a bit more control of animations, but I still have a little ways to go to get it finished :/

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
Re: Animation issue
« Reply #2 on: January 02, 2016, 06:31:31 AM »
https://www.youtube.com/watch?v=tAo0e53VFCQ

It seems not ok. The code is not running. Could you help me to double check as below ?  Thanks.

Code: [Select]
::OBJECTS <- {
 marquee = fe.add_artwork("marquee", flx*-0.2, fly*0.69, flw*0.18, flh*0.1 ),
}

 local move_marquee1 = {
   when = Transition.ToNewList ,property = "x", start = flx*-0.2, end = 0, time = 600
 }
 local move_marquee2 = {
    when = Transition.ToNewSelection ,property = "x", start = flx*-0.2, end = 0, time = 600,
 }
 local move_marquee3 = {   
  when = Transition.ToNewList ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
 }
 local move_marquee4 = {   
  when = Transition.ToNewSelection ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
 }

local move2anim = animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
function on_transition( ttype, var, ttime )
{
  if ( ttype == Transition.ToNewList ) move2anim.stop();
}


fe.add_transition_callback("on_transition" );

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Animation issue
« Reply #3 on: January 02, 2016, 02:28:14 PM »
whoops, sorry - getting confused with my new animate.. it shoud actually be:

Code: [Select]
local move2anim = PropertyAnimation( OBJECTS.marquee, move_marquee2 );
animation.add( move2anim );

I couldn't figure out where it was running twice for you, but you now should be able to use the stop() function at the appropriate time.

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
Re: Animation issue
« Reply #4 on: January 02, 2016, 04:04:34 PM »
I know it is hard to say since you are not the script. I would like to provide a full script to you later. Anyway, the issue is not big deal, please put effort on scrolling text first  :P

You may see 0:04 - 0:06. It has twice marquee animation ( from right to left)
https://www.youtube.com/watch?v=tAo0e53VFCQ
« Last Edit: January 02, 2016, 04:06:13 PM by kent79 »