Author Topic: animation.add will hang with using wait=1 WITHOUT when= option  (Read 4006 times)

popoklo

  • Full Member
  • ***
  • Posts: 50
    • View Profile
hi and thx for this great Project!

i use the Signal function to check my downkey. after pressing down 4 times i want to Animation.add WITH wait function.
i don't want to usee the When Option, because i want to start the Animation only after 4 key downs.
it seems the wait=true Option sticks in a Loop wihtout using a whenoption.
when i use when= When.ToNewSelection , the wait Option works.
is there o way to make a wait Thing on my own? or how can i manipulate an existing Animation (start, stop or delete)?




local movey_cfg = {
   //when = When.ToNewSelection,
    property = "y",
    end = -y*300-100,
    time = 800, wait=1
}

fe.add_signal_handler( "on_signal" );
function on_signal( sig )
   {
      switch ( sig )   
      {
         case "down":
         {
            if (frame_y < y-1)
            {
               frame_y += 1;

            } else {
                     animation.add( PropertyAnimation( gamegrid_surface, movey_cfg ) );  <------------
                fe.list.index += x*y;
            }
            return true;
         }
...............



thx

bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #1 on: April 15, 2017, 09:16:11 AM »
I dont think is a good idea to use the wait option, some times it could freeze the entire theme and you need to restart your attractmode, beside the wait function is only to -wait- or put a hold in everthing until you finish the animation, he best thing is call you animation after your counter meet your conditions and use the when option with always, in that way you assure that you call your animation always.

popoklo

  • Full Member
  • ***
  • Posts: 50
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #2 on: April 20, 2017, 09:53:57 AM »
thx for ur answer, but i tried many Things with no Progress.
is there a way to get an Information if an Animation has ended?

i want to update my indexoffset only after Animation end.
i want to scroll a gamegrid with 12 games up with nice Animation.add. only after Scrolling up 1000 Pixel, i want to update the gameindex.

does anybody know a nice solution?

in my attachment there is the .nut file. the theme works. but adding animations is now a pain with my Code. i think my Code sux.

and heres a pic of my theme. ist like the grid BUT the game_index only Progresses by going down the grid end or up. you can move free left to right and up and down and the list stays. the favorits Switch only if you go beyond 4 games left or right.


bjose2345

  • Sr. Member
  • ****
  • Posts: 107
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #3 on: April 23, 2017, 02:41:52 PM »
Well, lets see, you want something like Kent79, a smooth transition, my best beat would be that you need to review the grid theme and the converyor.nut module, and search for this words for some ideas ---

Conveyor.nut:
stride,
transition_swap_point,
transition_progress,
function on_transition,
o.on_progress( o.m_base_progress + move_progress, var )

grid:
function on_progress

you need somehow that in the "second to the last row" (that would be something like : last_row = obj.len()-2)
call some maths in the on_progress and tiggrer the redraw while  you are pressing down or up and finish it when you stop to hold up or down.

popoklo

  • Full Member
  • ***
  • Posts: 50
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #4 on: April 24, 2017, 01:31:30 AM »
hey bjose!

thx for your ideas, but i don't use the conveyor.nut. i wanted to understand Scripting not by copying any Code without understanding it. so i dont understand all Relations in the GRID.NUT example layout and the conveyor class.
my TestTheme above is very short only for understanding it. ist not a nice Code.

i tryed also the NxL theme by atrfate. he has a theme with a grid like i want but it doesn't work in my attractmode :(

i will try some Things in my Code this week.

thx anyway! really nice of u.

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #5 on: April 24, 2017, 07:49:38 AM »
I have completed the code referred by default grid theme. It works very well.  :)

popoklo

  • Full Member
  • ***
  • Posts: 50
    • View Profile
Re: animation.add will hang with using wait=1 WITHOUT when= option
« Reply #6 on: April 24, 2017, 04:51:57 PM »
nice!
looking Forward to see ur Code!

greets