Trying to create a card flip effect
JackieMac
Member Posts: 14
I'm trying to create the effect of flipping a card without using a actual animation of the card flipping.
I've tried using a combination of a Time with a Change Size (-4) for 0.5 seconds constraining the height to 100 pixels. (With a mouse click to trigger it.) So, this part works fine. The image shrinks down to a sliver. Cool.
Now, my challenge: to substitute the image (with the other side of the card), and grow it back to normal size.
I tried using a similar combo, except I change that I added a Change Image behavior. And, of course changed the Change Size behavior to 4 instead of -4. As a trigger, I use is a check on the width. If its <4, I trigger the grow.
What I'm seeing the the image shrinks (cool.) But, it doesn't grow. The width stays the same. If I take away the constrain. The height does grow. So, for some reason, the width doesn't wanna change.
Maybe its a bug?
I more certain that I'm just doing something wrong.
Or, perhaps there's just a better way to do this?
Thanks for any help. :-)
I've tried using a combination of a Time with a Change Size (-4) for 0.5 seconds constraining the height to 100 pixels. (With a mouse click to trigger it.) So, this part works fine. The image shrinks down to a sliver. Cool.
Now, my challenge: to substitute the image (with the other side of the card), and grow it back to normal size.
I tried using a similar combo, except I change that I added a Change Image behavior. And, of course changed the Change Size behavior to 4 instead of -4. As a trigger, I use is a check on the width. If its <4, I trigger the grow.
What I'm seeing the the image shrinks (cool.) But, it doesn't grow. The width stays the same. If I take away the constrain. The height does grow. So, for some reason, the width doesn't wanna change.
Maybe its a bug?
I more certain that I'm just doing something wrong.
Or, perhaps there's just a better way to do this?
Thanks for any help. :-)
Comments
So here is the analogy:
You have $1 in the bank and it doubles at the end of the year. So now you have $2.
But you have $2million dollars and it doubles you have $4million dollars.
If you relate that to pixels, you don't see much of a change from 1 to 2, but 2 million to 4 million, that's very noticeable.
Hope that helps.
Hmm, so how do I ensure the card grows back to a certain size, let's say 100x150 pixels? Is there a way to constrain that?
Add a condition in your card flipping rule to check if self.size.width attribute changes and is less than 100.
I think that should work.
Thanks for your help!
Btw, folks who see this post in the future and want to know how I did a card flip effect, feel free to send me an email.
Jonathan, it'd be cool to have a way to post code code/behavior snippets. :-)
I've made a space for you to add that information if you would please do so. Thanks.
http://gamesalad.com/wiki/how_to_gsc_create_a_flip_card_no_animation
Let me know if I typo'd any of the code, or if you have any problems with it.
Also, I uploaded a demo of it, "Card Flip Demo" to the games area.