Animations steps should be faded in/out

MarcoColMarcoCol Member, PRO Posts: 279
edited October 2012 in Working with GS (Mac)
Hi,

how is it possible, that the single animation-pictures fade in/out each?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2012

    @MarcoCol

    Hi Marco, use Interpolate on the actor, as usual, that has the Animate Behaviour. So for instance:

    When StartFade is true
    Interpolate Actor1.Color.Alpha to 0 -- Duration .5 second

    Timer:
    After .5 second
    Interpolate Actor1.Color.Alpha to 1 -- Duration .5 second

    -----

    or, depending on what effect you're after:

    Timer: Ever 1 second
    Interpolate Actor1.Color.Alpha to 0 -- Duration .5 second
    Timer: -(---nested in the above)
    After .5 second
    Interpolate Actor1.Color.Alpha to 1 -- Duration .5 second

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hmmm. In the actor I put the interpolate-behavior and after that what should I do there?
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hmmm. It doesn't work.
    So should I use instead of the animation behavior the interpolate-behavior?
    Should I also add a self-attribute for it?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2012

    Hello Marco, still put your Animate Behaviour, and next put the Interpolate Behaviour; I've double-checked and it works fine. :-)

    If you want each frame to fade, then base the interpolate time on your fps in the Animate Behaviour, example, say 10 fps:

    Timer: Ever 0.1 second
    Interpolate Actor1.Color.Alpha to 0 -- Duration 0.1 second
    Timer: ---nesting in above
    After 0.1 second
    Change Attribute Actor1.Color.Alpha to 1

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi Gyroscope,

    well, I didn't get it run!

    So I put the Animate behavior with 10fps and 2 images inside.
    After that I made the timer with the 0.1 sec and the interpolate-behavior?
    And after that another new timer or must I put a timer inside that rule?

    Thank you for your help.
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi Gyroscope,

    I've tried it today again, but I can't get it to work.
    Can you please detailed specifiy how I must set the behaviors?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2012

    Hi Marco, OK, we'll get this sorted for you but two questions first:

    1) You've only 2 frames in your animation, and so at 10fps, you've an animation of 1 frame every half a second; just to confirm, this is what you have and want?

    2) Do you want the animation sequence over one second to fade in and out? Or each frame (in your case, only 2) to fade in and out, making two fade ins and two fade outs in this case?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi Gyroscope,

    well, that is great. Thank you.

    Regarding your questions:
    to 1) yes. 2 frames in the animation with 10 fps.
    to 2) it can be one or two seconds and it should go on.
    So for example Image1 should be fade after 2 seconds into image2 (fading time 0.5 sec). After 2 seconds should it fade to image1 (fading time 0.5 sec) and so on.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2012

    OK, I think I understand your second answer....

    If you want your first image, as it fades out, for the other image to fade in, then the Animate Behaviour won't work for you.

    So if I've understood you correctly, the following would be a way to achieve the effect you're after; (it's untested but should work) :

    Set your actor with the second image. Lets call this actor Image2. Next, make a copy of this actor, unlock it, change its image to the first image, call it Image1. Then place it over the top of the other one.

    In its rules:

    ---the following 2 constraints are only needed if the actor is moving)

    Constrain self.Actor1.Position.x to scene.Background.Position.Actor2.x
    Constrain self.Actor1.Position.y to scene.Background.Position.Actor2.y

    ---

    Timer: Every 2 seconds
    Rule: --nested in above Timer)-- When self.Actor1.Color.Alpha = 1
    Interpolate self.Actor1.Color.Alpha to 0
    time, 0.5 seconds
    Otherwise
    Interpolate self.Actor1.Color.Alpha to 1
    time, 0.5 seconds

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi,

    If I understand you correctly, then it is for a placed actor in the scene.
    In my case the actor will be spawned by a spawner actor, together with other actors in this spawner actor.
    Must I change there anything?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi Marco, if the actor whose image fades out while another image fades in is spawned, then yes, you'd need to spawn another actor with the second image exactly in the same place...

    Just to underline the point, if your first image faded out and only then the next image faded in, you wouldn't need two actors, and you could do this a couple of different ways, using Animate behaviour included, as you first was doing.

    But because you want an image to fade in as the other one is fading out, there's no alternative that I know of, to having two separate actors....

    Hope I haven't confused you...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi Gyroscope,

    yes, both images of the actor should be fade in/out. So the image of the actor should smooth switch between those two images. And when the actor moves, then it will be hard to set the second actor on the same point, right?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    If your actor is moving, then use the constrain behaviours as I mentioned above with the other actor with the other image.... it'll follow it exactly (be over the top of the first actor). Does that answer it for you?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ElfizmElfizm Member Posts: 489
    Hello guys

    After reading what came to mind was that @MarcoCol just wants to fade from image one to image 2 and fade again.

    Why not just put this in a paint program, make a new image everytime you change the alpha of the image. Then put it into animate and click loop.

    Just putting an idea out there ad it may be easier then having timers and rules


    Elfizm
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2012

    @Elfizm

    Hi Elfizm, nice idea, and feasible; the only thing is you'll need at least 16 frames of the two images fading in and out over each other for it to look smooth, I'm thinking, so you'd add to the game file size more... just sayin'... :-) Plus, the way I suggested, it'd be much easier to update one or both of the images, or change the images completely if needed...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ElfizmElfizm Member Posts: 489
    @gyroscope

    That's cool :) was only putting in some ideas, only because you used timers which most people try to avoid so personally I would rather have a bit extra file size then a bit extra decrease on proformace. But good to see it was considered :)

    Elfizm
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi,

    I've done it, but I will not use it in my project, because it looks not as good as I want. But I will remember it for upcoming-projects.
Sign In or Register to comment.