2D Toolkit Forum
2D Toolkit => Support => Topic started by: Disastercake on May 21, 2012, 02:07:14 am
-
I'm trying to use iTween to animate the transparency of a 2D Toolkit sprite object.
However, when trying to use a change color function, I am getting a compiler error that states the "material does not have a color attribute" or something along those lines.
Any idea how to add a color value to my 2D Toolkit Sprite? Or is there a work around that I should be using?
Thanks.
-
You shouldn't be animating the .color attribute on a material. This will globally change everything and isn't a good idea at all. What you should be animating is the .color property of the sprite.
-
Yeah, I can't figure this out either
iTween.FadeTo( SpriteName.color , iTween.Hash( "alpha" , 0.0f , "time" , .3 , "easeType", "easeInSine") );
or
iTween.FadeTo( SpriteName.gameObject , iTween.Hash( "alpha" , 0.0f , "time" , .3 , "easeType", "easeInSine") );
Do not work.
-
Are you using a transparent shader? It won't work on solid ones.
-
I tried changing the shader type. This works and it will animate, however the Sprites are very opaque/transparent no matter what value I give it.
If I do this : sprite.color = new Color(1, 1, 1, 0.5f); It will give me what I am looking for, just not as an animation. Are there any other Tween tools that can do this correctly?
-
I could be completely wrong here, but I don't belive iTween will interpolate properties. I've not spent enough time trying it that's for sure.
The excellent HOTWEEN does work though. I was happy enough with it that I didn't bother with anything else. It comes with a visual editor - you can use that to figure out what you need to call should you wish to code everything.
http://www.holoville.com/hotween/