Author Topic: animate.nut question  (Read 116 times)

FrizzleFried

  • Full Member
  • ***
  • Posts: 86
    • View Profile
    • Idaho Garagecade
animate.nut question
« on: May 04, 2018, 07:00:01 AM »
OK,  I can easily make,  for instance,  the "wheel" or "marquee" of the next game that pops up appear and animate without issue...

...but how do I take an image that is already on screen (the last game selected) and animate THAT out of existence as the new games marquee/wheel image is being animated in to existence....

For example,  one of my current animations is a marquee image that "slides" from the top border down to be visible at game change.  How do I then make that image continue to slide down and under the preview below it (and out of existence) when the next game is selected.  I'm sure there is a simple setting to "choose" which game on the gamelist to pull art for,  right?   I'm just missing what is right in front of me I am sure.
Visit my arcade blog ... www.idahogaragecade.com (updated 03-14-18)

FrizzleFried

  • Full Member
  • ***
  • Posts: 86
    • View Profile
    • Idaho Garagecade
Re: animate.nut question
« Reply #1 on: May 04, 2018, 01:57:40 PM »
...and I figured it out.  (x.index_offset = -1)....

Visit my arcade blog ... www.idahogaragecade.com (updated 03-14-18)

FrizzleFried

  • Full Member
  • ***
  • Posts: 86
    • View Profile
    • Idaho Garagecade
Re: animate.nut question
« Reply #2 on: May 04, 2018, 04:09:12 PM »
OK... I am coming up against an issue that I think it beyond my ability.   I've managed to get the behavior I want ... but only in one direction (if I choose the "next" game it works fine as the "last" game image continues on and then zooms out as intended)... but if I go the other direction and choose the "prior" game,  instead of the current logo animating out of existence,  the code pulls up the wrong image...

The code in question is:

Code: [Select]
local marquee2 = fe.add_artwork( "wheel", flx*0.150, 5, flw*0.700, flh*0.200 );
marquee2.index_offset = -1

local marquee2_scale_cfg = {
when =Transition.ToNewSelection,
property = "scale",
start = 0.9,
end = 0.1,
time = 0700,
tween = Tween.Linear,
}
local marquee2_move_cfg = {
when =Transition.ToNewSelection,
property = "y",
start = fly*0.090,
end = fly*-0.120,
time = 0700 ,
}
animation.add( PropertyAnimation( marquee2, marquee2_scale_cfg ) );
animation.add( PropertyAnimation( marquee2, marquee2_move_cfg ) );

The marquee.index_offset works great going forward...  as it's moving to the next game,  it reads the last game,  which happens to be the game that is being switched from and supplies the artwork for that game... GREAT!  If going the other direction though,  it then starts to switch over to the PRIOR game... then reads that -1 setting and supplies up the artwork for the game prior to IT when it needs to be doing the exact opposite and supply up the artwort from the game AFTER (ie: index_offset = 1 rather than -1). 
Visit my arcade blog ... www.idahogaragecade.com (updated 03-14-18)

FrizzleFried

  • Full Member
  • ***
  • Posts: 86
    • View Profile
    • Idaho Garagecade
Re: animate.nut question
« Reply #3 on: May 04, 2018, 07:49:51 PM »
... and I do believe I worked my way around this issue using...

when = function( anim ) { if ( anim.transition.ttype == Transition.FromOldSelection && anim.transition.var == -1 ) return true; return false; },

to isolate next game and previous game... then repeat for the other direction.
Visit my arcade blog ... www.idahogaragecade.com (updated 03-14-18)