Attract-Mode Support > Scripting

Timed Event

(1/2) > >>

FrizzleFried:
Is it possible to have a video snap window with ZERO alpha for 'x' number of seconds... at which time the alpha would jump to 100% only to drop back to ZERO at change of game.

Essentially,  I have a snap on a "carrier" that I want to overlay a video on after 3 or 4 seconds...

I have the video positioned,  but the conveyor runs behind the video.  I found a neat bit of code that pauses the video for a time at selection,  but the video "box" remains opaque.... not transparent... so you can't see the snap behind it. 

Ideally I'd have a video box sitting there with zero alpha for x seconds at which time alpha would change to 100... again changing back to 0 at selection for a new game.    I've tried a few different timing methods ...all fail... but I'm merely a hack... so I figured I'd ask.

:D

keilmillerjr:
Yes. Check out my fadetogame module transitions function for changing alpha over time. Your going to want to create a class/transitions that will wait a certain amount of ticks and then do the fade like in my module. Could even make a module/class that would create the transitions for objects, wait time, and fade time - if you wanted to get fancy and end up reusing it often.

https://github.com/keilmillerjr/fadetogame-plugin/blob/master/plugin.nut

jedione:
sounds like your back on  SD  :D  hope that u succeed in what your after...
it will be cool.....thanks

qqplayer:

--- Quote from: FrizzleFried on April 10, 2018, 01:41:12 PM ---Is it possible to have a video snap window with ZERO alpha for 'x' number of seconds... at which time the alpha would jump to 100% only to drop back to ZERO at change of game.

Essentially,  I have a snap on a "carrier" that I want to overlay a video on after 3 or 4 seconds...

I have the video positioned,  but the conveyor runs behind the video.  I found a neat bit of code that pauses the video for a time at selection,  but the video "box" remains opaque.... not transparent... so you can't see the snap behind it. 

Ideally I'd have a video box sitting there with zero alpha for x seconds at which time alpha would change to 100... again changing back to 0 at selection for a new game.    I've tried a few different timing methods ...all fail... but I'm merely a hack... so I figured I'd ask.

:D

--- End quote ---

This is what I made for "videothemes" just change for snap or wathever you want.


--- Code: ---/////////////////////
// Videotheme
/////////////////////
::OBJECTS1 <- {
artwork_videotheme = fe.add_artwork("videotheme", 0, 0 flw, flh),
}

OBJECTS1.artwork_videotheme.visible=false;

::videoSound <- Vid.NoAudio;
OBJECTS1.artwork_videotheme.video_flags = videoSound;

local settings = {
   delay_timer = 0,
   play_delay = 25000,
   stop_play = 35000,
}

function on_transition_videotheme( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.StartLayout:
  case Transition.ToNewSelection:
  case Transition.ToNewList:
  case Transition.EndNavigation:
        OBJECTS1.artwork_videotheme.video_flags = Vid.NoAutoStart;
        settings.delay_timer = fe.layout.time;
        OBJECTS1.artwork_videotheme.visible=false;
       break;
  }
 return false;
}

fe.add_transition_callback( "on_transition_videotheme" );

function on_tick_videotheme(tick_time) {
   if ( !OBJECTS1.artwork_videotheme.video_playing && tick_time - settings.delay_timer >= settings.play_delay ) {
   
        OBJECTS1.artwork_videotheme.video_playing = true;
       
        ::videoSound <- Vid.NoAudio;
        OBJECTS1.artwork_videotheme.video_flags = videoSound;       
       
        OBJECTS1.artwork_videotheme.visible=true;
       
        OBJECTS1.artwork_videotheme.alpha = 0
        local alpha_artwork_videotheme_0 = {
        property = "alpha", start = 0 end = 255, time = 2000 easing = Easing.Out,
        }
 
        animation.add( PropertyAnimation( OBJECTS1.artwork_videotheme, alpha_artwork_videotheme_0 ) );
       
    }
   
    else if ( tick_time - settings.delay_timer >= settings.stop_play ) {
       
        OBJECTS1.artwork_videotheme.visible=false;
       
    }
   
}

fe.add_ticks_callback(this, "on_tick_videotheme");
--- End code ---

This is the delay time to play and the total time before close the snap.


--- Code: ---   play_delay = 25000,
   stop_play = 35000,
--- End code ---

FrizzleFried:
AWESOME... I will try these two solutions out today likely...

:D

Thanks...

Navigation

[0] Message Index

[#] Next page

Go to full version