Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: kent79 on January 01, 2016, 05:56:40 AM
-
I am working on animation, but facing some issue. I would like a image in and out with animation in 2 conditions (Transition.ToNewList & Transition.ToNewSelection)
When I startup AM, then trigger Transition.ToNewList. At this moment, press key to select new game. It will trigger second animation. Then it runs 2 times. How to modify the code to run one time only? Thanks.
::OBJECTS <- {
marquee = fe.add_artwork("marquee", flx*-0.2, fly*0.69, flw*0.18, flh*0.1 ),
}
local move_marquee1 = {
when = Transition.ToNewList ,property = "x", start = flx*-0.2, end = 0, time = 600
}
local move_marquee2 = {
when = Transition.ToNewSelection ,property = "x", start = flx*-0.2, end = 0, time = 600,
}
local move_marquee3 = {
when = Transition.ToNewList ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
}
local move_marquee4 = {
when = Transition.ToNewSelection ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
}
animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee1 ) );
animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee3 ) );
animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee4 ) );
-
This is a bit tricky if I'm understanding correctly..
If you don't want it to happen for each game, you could use Transition.StartLayout and Transition.ToNewList - this will make the animation happen when AM starts up and when you switch to a different list.
If you do want it to happen on each game selected - when you switch lists I believe it does both a ToNewList and ToNewSelection transition. If you assign the animation to a variable, you could probably stop the one you don't want to happen in your own transition callback when you switch lists, something like:
local move2anim = animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
function on_transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewList ) move2anim.stop();
}
This could probably work for you. Animate v2 has a bit more control of animations, but I still have a little ways to go to get it finished :/
-
https://www.youtube.com/watch?v=tAo0e53VFCQ
It seems not ok. The code is not running. Could you help me to double check as below ? Thanks.
::OBJECTS <- {
marquee = fe.add_artwork("marquee", flx*-0.2, fly*0.69, flw*0.18, flh*0.1 ),
}
local move_marquee1 = {
when = Transition.ToNewList ,property = "x", start = flx*-0.2, end = 0, time = 600
}
local move_marquee2 = {
when = Transition.ToNewSelection ,property = "x", start = flx*-0.2, end = 0, time = 600,
}
local move_marquee3 = {
when = Transition.ToNewList ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
}
local move_marquee4 = {
when = Transition.ToNewSelection ,property = "x", start = 0, end = flx*-0.2, time = 1000, delay = 3000
}
local move2anim = animation.add( PropertyAnimation( OBJECTS.marquee, move_marquee2 ) );
function on_transition( ttype, var, ttime )
{
if ( ttype == Transition.ToNewList ) move2anim.stop();
}
fe.add_transition_callback("on_transition" );
-
whoops, sorry - getting confused with my new animate.. it shoud actually be:
local move2anim = PropertyAnimation( OBJECTS.marquee, move_marquee2 );
animation.add( move2anim );
I couldn't figure out where it was running twice for you, but you now should be able to use the stop() function at the appropriate time.
-
I know it is hard to say since you are not the script. I would like to provide a full script to you later. Anyway, the issue is not big deal, please put effort on scrolling text first :P
You may see 0:04 - 0:06. It has twice marquee animation ( from right to left)
https://www.youtube.com/watch?v=tAo0e53VFCQ