How to get Actor bigger then smaller then bigger than small non stop?

How can I do this? An example would be the play button on ninjump. Thanks in advanced!

Comments

  • zzap64zzap64 Member Posts: 405
    Interpolate the actors width and height size between two values.
  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    Constrain width to AAA*sin(game.time*BBB)+CCC
    Constrain height to AAA*sin(game.time*BBB)+CCC

    AAA is how much you want the object to grow and shrink in size.
    BBB is how fast you want the change in size to happen.
    CCC is what you want the default size of your actor to be.

    So a 100x100 actor that grows to 120 and the shrinks to 80 would be:

    Constrain width to 20*sin(game.time*123)+100
    Constrain height to 20*sin(game.time*123)+100

    (the '123' speed value here is whatever you want it to be)
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Lol, I knew @Socks would chime in. ;)
  • SocksSocks London, UK.Member Posts: 12,822
    Lol, I knew @Socks would chime in. ;)
    I couldn't help myself. :)
  • JarrenHJarrenH Member Posts: 206
    I was just going to leave "@socks" :P
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Constrain width to AAA*sin(game.time*BBB)+CCC
    Constrain height to AAA*cos(game.time*BBB)+CCC

    AAA is how much you want the object to grown and shrink in size.
    BBB is how fast you want the change in size to happen.
    CCC is what you want the default size of your actor to be.

    So a 50x50 actor that grows to 75 and the shrinks to 25 would be:

    Constrain width to 25*sin(game.time*100)+50
    Constrain height to 25*cos(game.time*100)+50
    I'd like to interject that using both sine and cosine will give a weird effect that when sine is at its maximum or minimum, cosine will be at zero. And vice versa.
    If that is the effect you want, then go for it.
    If you want a square that pulsates like it grows in all directions, then just use either sine or cosine. Not both.


  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2013
    . . . I'd like to interject that using both sine and cosine will give a weird effect . . .
    Whoops ! Yep, it should have been 'sin' in both constrains.

    [I'll edit my post above]
  • Brand0n1210Brand0n1210 Member Posts: 12
    edited March 2013
    Thank you soo much =)
Sign In or Register to comment.