2D Toolkit Forum

2D Toolkit => Support => Topic started by: Disastercake on May 21, 2012, 02:07:14 am

Title: How do you animate transparency using iTween?
Post 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.
Title: Re: How do you animate transparency using iTween?
Post by: unikronsoftware on May 21, 2012, 02:42:41 am
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.
Title: Re: How do you animate transparency using iTween?
Post by: SyndicatePlus on July 07, 2012, 02:14:17 am
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.
Title: Re: How do you animate transparency using iTween?
Post by: fsadeq on July 07, 2012, 03:13:23 am
Are you using a transparent shader? It won't work on solid ones.
Title: Re: How do you animate transparency using iTween?
Post by: SyndicatePlus on July 07, 2012, 04:54:36 am
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?
Title: Re: How do you animate transparency using iTween?
Post by: unikronsoftware on July 07, 2012, 12:26:12 pm
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/