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_SFXMember, Sous Chef, Bowlboy SidekickPosts: 9,273
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.
Comments
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)
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.
[I'll edit my post above]