Attract-Mode Support > Scripting

Boxart delay

(1/1)

clockman:
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:

--- Code: ---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;
}
}
--- End code ---

somthing like this should work for ya bud :P

clockman:
Thank you I will try it tomorrow.

clockman:

--- Quote from: jedione on August 15, 2023, 05:48:04 AM ---
--- Code: ---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;
}
}
--- End code ---

somthing like this should work for ya bud :P

--- End quote ---
Was not able to get it to work, I will try again in a week I to go out of town.

tankman37:
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.

Navigation

[0] Message Index

Go to full version