Author Topic: Boxart delay  (Read 3855 times)

clockman

  • Sr. Member
  • ****
  • Posts: 109
    • View Profile
Boxart delay
« on: August 06, 2023, 12:49:09 PM »
So when I am scrolling for a game and I stop on a game I want a 3 second delay before the boxart shows. This is what I have so far
local artwork = fe.add_artwork("boxart", 15, 34, 661, 1018)
What would I add to this so it will delay for 3 seconds before showing?

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Boxart delay
« Reply #1 on: August 15, 2023, 05:48:04 AM »
Code: [Select]
local last_nav = 0;
local gtime = 0;
local art_flag = false;

local artwork = fe.add_artwork("boxart", 15, 34, 661, 1018)

fe.add_transition_callback( "my_transition" );
function my_transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewSelection )
{
last_nav = gtime;
art_flag = true;
}
}

fe.add_ticks_callback( this, "on_tick" );
function on_tick( ttime )
{
    gtime = ttime;
if (art_flag && (ttime - last_nav > 3000)) 
{
artwork.file_name = fe.get_art("boxart");
art_flag = true;
}
}

somthing like this should work for ya bud :P
help a friend....

clockman

  • Sr. Member
  • ****
  • Posts: 109
    • View Profile
Re: Boxart delay
« Reply #2 on: August 18, 2023, 03:52:35 PM »
Thank you I will try it tomorrow.

clockman

  • Sr. Member
  • ****
  • Posts: 109
    • View Profile
Re: Boxart delay
« Reply #3 on: August 21, 2023, 02:22:39 PM »
Code: [Select]
local last_nav = 0;
local gtime = 0;
local art_flag = false;

local artwork = fe.add_artwork("boxart", 15, 34, 661, 1018)

fe.add_transition_callback( "my_transition" );
function my_transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewSelection )
{
last_nav = gtime;
art_flag = true;
}
}

fe.add_ticks_callback( this, "on_tick" );
function on_tick( ttime )
{
    gtime = ttime;
if (art_flag && (ttime - last_nav > 3000)) 
{
artwork.file_name = fe.get_art("boxart");
art_flag = true;
}
}

somthing like this should work for ya bud :P
Was not able to get it to work, I will try again in a week I to go out of town.

tankman37

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Boxart delay
« Reply #4 on: October 10, 2023, 09:38:24 PM »
fe.load_module( "animate" );


local box =fe.add_artwork( "boxes", 0, 0, 460, 545 )

local ani1 = { when=Transition.StartLayout, property="alpha", start=0, end=0,time=1 }
animation.add( PropertyAnimation( box, ani1) );

local ani2 = { when=Transition.StartLayout, property="alpha", start=0, end=255,delay =2000,time=50 }
animation.add( PropertyAnimation( box, ani2 ) );

local ani3 = { when=Transition.ToNewSelection, property="alpha", start=0, end=255,delay =2000,time=50 }
animation.add( PropertyAnimation( box, ani3 ) );

   local ani4 = { when=Transition.FromOldSelection, property="alpha", start=0, end=0,time=1 }
animation.add( PropertyAnimation( box, ani4 ) );
   

This is what i use, found part of the code and some suggestions on the forums. A delay on the alpha messes things up big time, so the Alpha=0 for 1ms helps. You can change the delay and time to suit. i am sure someone could come up with a more elegant solution but this works for me.
« Last Edit: October 10, 2023, 09:54:54 PM by tankman37 »