Author Topic: Timed Event  (Read 3751 times)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 243
    • View Profile
    • Idaho Garagecade
Timed Event
« 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

Visit my arcade blog ... www.idahogaragecade.com (updated 06-27-19)

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1167
    • View Profile
Re: Timed Event
« Reply #1 on: April 10, 2018, 05:51:03 PM »
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

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Timed Event
« Reply #2 on: April 10, 2018, 06:14:45 PM »
sounds like your back on  SD  :D  hope that u succeed in what your after...
it will be cool.....thanks
help a friend....

qqplayer

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
Re: Timed Event
« Reply #3 on: April 11, 2018, 04:21:34 AM »
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

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

Code: [Select]
/////////////////////
// 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");

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

Code: [Select]
   play_delay = 25000,
   stop_play = 35000,


FrizzleFried

  • Sr. Member
  • ****
  • Posts: 243
    • View Profile
    • Idaho Garagecade
Re: Timed Event
« Reply #4 on: April 11, 2018, 05:50:12 AM »
AWESOME... I will try these two solutions out today likely...

:D

Thanks...
Visit my arcade blog ... www.idahogaragecade.com (updated 06-27-19)

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 243
    • View Profile
    • Idaho Garagecade
Re: Timed Event
« Reply #5 on: April 11, 2018, 07:59:05 AM »
qqplayer...

YOU'RE THE MAN!

https://youtu.be/fDfYnC1WnJk

All I need to do now is figure out how to handle the small audio issue... (no time,  going to work).  Basically,  if the movie volume is up,  you get about 1/4-1/2 second of audio then silence...ideally the volume would "fade in" as well... we'll see.  Set movie volume to zero and it works great (with no volume of course,  but who uses volume in their front ends?!?  :) )

Durr... a simple one word change from NoAudio to Default and BOOM... it's working!

THANKS MAN!

You can grab it HERE if you want it!

« Last Edit: April 11, 2018, 09:06:04 AM by FrizzleFried »
Visit my arcade blog ... www.idahogaragecade.com (updated 06-27-19)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Timed Event
« Reply #6 on: April 11, 2018, 06:53:08 PM »
i new it...  thanks for the quick upload of it.....great work

now i love this theme.......even moore :D
help a friend....

FrizzleFried

  • Sr. Member
  • ****
  • Posts: 243
    • View Profile
    • Idaho Garagecade
Re: Timed Event
« Reply #7 on: April 12, 2018, 09:48:15 AM »
I dig the simplicity of it... it just... works great.

Visit my arcade blog ... www.idahogaragecade.com (updated 06-27-19)