Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: sickle on April 25, 2020, 04:10:44 PM

Title: how do you animate artwork?
Post by: sickle on April 25, 2020, 04:10:44 PM
I've been using the animate module to animate all of the images, but when I apply the same script to artwork, it only displays the animation after I change the selected game. why is it not showing the animation when I trigger it, and how can I fix it?

my current code is:
Code: [Select]
function click (str) {
if (str == "custom2"){
local pic = fe.add_artwork( "flyer", 300, 200, 200, 200 );
local pic_cfg = {property = "x",start = 300,end = 600,time = 1000}
local pic_cfg2 = {property = "x",start = 600,end = 300,time = 1000,delay = 1000}
local pic_cfg3 = {property = "alpha",start = 255,end = 0,time = 500,delay = 3000}



animation.add( PropertyAnimation( pic, pic_cfg ) );
animation.add( PropertyAnimation( pic, pic_cfg2 ) );
animation.add( PropertyAnimation( pic, pic_cfg3 ) );

}
}
fe.add_signal_handler(this, "click")
Title: Re: how do you animate artwork?
Post by: jedione on April 26, 2020, 06:50:48 AM
dont think, can be fixed ,,with the" custom2"

notice if you switch the string to "prev_game" or somthing els it works..

plus the animation module is far from perfect.

sucks that 'wait dont work right ,   every time you push it keeps stacking the imiges..if you do it quikley
Title: Re: how do you animate artwork?
Post by: sickle on April 26, 2020, 09:57:02 AM
ah, thanks for telling me.

I tried for a few hours yesterday with different methods, including making a class that included the images and the flyers and then animating the entire class, but I couldn't figure out how to correctly instantiate the class in a way that allowed it to be animated, though it worked just enough for me to see that the flyer still didn't appear correctly.

do you know of any other animation modules that I could use in place of the default animate?
Title: Re: how do you animate artwork?
Post by: sickle on April 26, 2020, 10:39:54 AM
or, do you know how the onStart function works? does it mean at the start of the layout or the start of an animation? and if it is the latter, how would I implement it in a way that would allow me to trigger the flyer animation at the same time as the image animation?
Title: Re: how do you animate artwork?
Post by: jedione on April 26, 2020, 03:39:59 PM
i think this might be what u want,,, just basic animation,,,

note:  notice the alpha has no delay,  it fucks it up,  so settle for a long fade,  tryed this before..

just both marquee and flyer running,  set to next and previous game,  asumming you could set it som how to custum2
not shure what you are doing..

Code: [Select]


fe.layout.width = 1250;
fe.layout.height = 1025;


# load module
fe.load_module("animate");


    #marquee--------------------------------------------------
local pic = fe.add_artwork( "marquee", 300, 200, 200, 200 );
local pic_cfg = { when=Transition.ToNewSelection,
property = "x",
start = 300,
end = 600,
time = 1000
}

local pic_cfg1 = { when=Transition.ToNewSelection,
property = "x",
start = 600,
end = 300,
time = 1000,
delay = 1000
}

local pic_cfg2 = { when=Transition.ToNewSelection,
property = "alpha",
start = 255,
end = 0,
time = 4000,

}

animation.add( PropertyAnimation( pic, pic_cfg ) );
animation.add( PropertyAnimation( pic, pic_cfg1 ) );
animation.add( PropertyAnimation( pic, pic_cfg2 ) );


    #flyer---------------------------------------------------
local pic = fe.add_artwork( "flyer", 300, 500, 200, 200 );
local pic_cfg = { when=Transition.ToNewSelection,
property = "x",
start = 300,
end = 600,
time = 1000
}

local pic_cfg1 = { when=Transition.ToNewSelection,
property = "x",
start = 600,
end = 300,
time = 1000,
delay = 1000
}

local pic_cfg2 = { when=Transition.ToNewSelection,
property = "alpha",
start = 255,
end = 0,
time = 4000,

}

animation.add( PropertyAnimation( pic, pic_cfg ) );
animation.add( PropertyAnimation( pic, pic_cfg1 ) );
animation.add( PropertyAnimation( pic, pic_cfg2 ) );


Title: Re: how do you animate artwork?
Post by: jedione on April 26, 2020, 03:44:00 PM
as to onstart,,,  im pretty shure,   that is when theme loads,  first time,, one time. ;)
Title: Re: how do you animate artwork?
Post by: sickle on April 27, 2020, 05:29:47 AM
I am making a turbografx 16 mini layout. I plan on making it as close as possible to the actual mini console. on the original console, when you select a game, it shows a quick animation the hucard (cartridge) being inserted into the console. you can see that here: https://www.youtube.com/watch?v=U6OsfZzd5-8&list=LL0YO3nJy9iqv8W6fOzvXDNg&index=2&t=0s.

I have most of that working, but the flyer that is on the hucard isn't displayed correctly (plus I'm working on it launching the game correctly, but that's a different post). as was stated before, if I change the input for example,  from custom2 to next_game; the flyer animates perfectly. I guess I could change the input to some other unused non-custom button, but I don't want the layout interacting strangely if somebody has things set up differently than me.
Title: Re: how do you animate artwork?
Post by: jedione on April 27, 2020, 06:24:22 AM
TG-16 mini,     bad ass bro...cant wait to see what you got...

if you need a tester.... ::)
Title: Re: how do you animate artwork?
Post by: sickle on April 27, 2020, 07:33:20 AM
TG-16 mini,     bad ass bro...cant wait to see what you got...

if you need a tester.... ::)


haha definitely! this is my first layout, and I only started learning squirrel two or three weeks ago, so it might take a while, but ill definitely hit you up when I feel like its good enough for testing
Title: Re: how do you animate artwork?
Post by: qqplayer on April 27, 2020, 08:11:01 AM
You can use this:
Code: [Select]
Transition.ToGame ,property = "y"

Code: [Select]
/////////////////////
//Layer1
/////////////////////
local layer1_fadein = fe.add_image("../../modules/fade_in/media/[Emulator]/_Default/Layer 1.png", flx*0, fly*0, flw, flh );
layer1_fadein.alpha=0;

 local move_layer1_fadein = {
    when = Transition.ToGame ,property = "y", start = fly*-10, end = fly*0.85, time = 100,
 }


animation.add( PropertyAnimation ( layer1_fadein, move_layer1_fadein ) );
Title: Re: how do you animate artwork?
Post by: sickle on April 27, 2020, 10:30:54 AM
ok, so i have an idea.
instead of using
Code: [Select]
fe.add_artwork {"flyer", ...} i could use
Code: [Select]
fe.add_image {".../scraper/turboEngine/flyer/[Title].jpg, ...} and then i wouldn't have to deal with any more complicated BS that i don't understand 8).

are there any problems with this method?


edit: nevermind, just tried this and it didn't fix anything
Title: Re: how do you animate artwork?
Post by: manzarek on April 27, 2020, 02:54:16 PM
wau beautiful theme, why don't you share it, you would make me happy.
Title: Re: how do you animate artwork?
Post by: sickle on April 27, 2020, 03:26:56 PM
wau beautiful theme, why don't you share it, you would make me happy.

heh heh, that video I shared was of an actual console, not my theme. I'm trying to emulate it. but ill be sure to share the theme when its finished