Author Topic: start layout transition?  (Read 5731 times)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
start layout transition?
« on: May 18, 2020, 05:43:22 PM »
so what im trying to do is

when theme starts, it is automatically passed one signal , prev_game" or  "next_game"

because all my animations are set to, Transition.ToNewSelection`

not `Transition.StartLayout`


if any one can do this, or knows a work around......thanks
help a friend....

sickle

  • Full Member
  • ***
  • Posts: 65
    • View Profile
Re: start layout transition?
« Reply #1 on: May 18, 2020, 09:05:10 PM »
try changing this:
Code: [Select]
if (ttype == Transition.StartLayout){
to:
Code: [Select]
if (ttype == Transition.StartLayout || Transition.ToNewSelection){
"||" means either true if StartLayout or ToNewSelection are true

or, if you want an easier fix, just add:
Code: [Select]
fe.add_transition_callback( this, whenStart )
function whenStart ( ttype, var, transition_time )
{
if (ttype == Transition.StartLayout)
{
fe.signal("next_game")
}
}

(found this info here https://developer.electricimp.com/squirrel/squirrel-guide/operators)
« Last Edit: May 18, 2020, 10:44:37 PM by sickle »

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: start layout transition?
« Reply #2 on: May 19, 2020, 06:39:20 AM »
i tryed

fe.add_transition_callback( this, whenStart )
function whenStart ( ttype, var, transition_time )
{
if (ttype == Transition.StartLayout)
{
fe.signal("next_game")
}
}

does not seem to work,  ,,,   it says "the the index 'whenStart' does not exist"
so i added "local whenStart;     

and now it doesent throw that "whenStart' does not exist"      but doesent do anything,
help a friend....

sickle

  • Full Member
  • ***
  • Posts: 65
    • View Profile
Re: start layout transition?
« Reply #3 on: May 19, 2020, 09:46:53 AM »
maybe try putting fe.add_transition_callback after the whenStart function:

Code: [Select]
function whenStart ( ttype, var, transition_time )
{
if (ttype == Transition.StartLayout)
{
fe.signal("next_game")
}
}
fe.add_transition_callback( this, whenStart )

did you try the  (ttype == Transition.StartLayout || Transition.ToNewSelection)?
« Last Edit: May 19, 2020, 09:48:35 AM by sickle »

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: start layout transition?
« Reply #4 on: May 19, 2020, 12:37:55 PM »
ill try when i get home from work,,  thanks for your help....
help a friend....

beccobunsen

  • Jr. Member
  • **
  • Posts: 22
    • View Profile
Re: start layout transition?
« Reply #5 on: May 19, 2020, 03:55:07 PM »
You can try a much simpler approach..


Code: [Select]

local your_animation_on_old_or_new = {
when = Transition.FromOldSelection,
property = "x",
start = flx*0.294,
end = flx*0,
time = 0

}

local your_animation_on_StartLayout = {
when = Transition.StartLayout,
property = "x",
start = flx*0.294,
end = flx*0,
time = 0

}



animation.add( PropertyAnimation( your_object, youranimation_on_old_or_new) );
animation.add( PropertyAnimation(  your_object, youranimation_on_StartLayout) );


jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: start layout transition?
« Reply #6 on: May 20, 2020, 06:40:08 AM »
function whenStart ( ttype, var, transition_time )
{
if (ttype == Transition.StartLayout || Transition.ToNewSelection)
{
fe.signal("next_game")
}
}
fe.add_transition_callback( this, whenStart );

not working,  for me..    this method would work best,  if it can work,   
help a friend....

sickle

  • Full Member
  • ***
  • Posts: 65
    • View Profile
Re: start layout transition?
« Reply #7 on: May 20, 2020, 07:18:51 AM »
try just replacing any previous
Code: [Select]
.StartLayout transitions with

Code: [Select]
Transition.StartLayout || Transition.ToNewSelection
do this to all transitions you want to apply this to

sickle

  • Full Member
  • ***
  • Posts: 65
    • View Profile
Re: start layout transition?
« Reply #8 on: May 20, 2020, 10:39:15 AM »
You can try a much simpler approach..


Code: [Select]

local your_animation_on_old_or_new = {
when = Transition.FromOldSelection,
property = "x",
start = flx*0.294,
end = flx*0,
time = 0

}

local your_animation_on_StartLayout = {
when = Transition.StartLayout,
property = "x",
start = flx*0.294,
end = flx*0,
time = 0

}



animation.add( PropertyAnimation( your_object, youranimation_on_old_or_new) );
animation.add( PropertyAnimation(  your_object, youranimation_on_StartLayout) );


yeah, that would work too