2D Toolkit Forum

2D Toolkit => Support => Topic started by: Tongie on September 22, 2012, 09:38:43 am

Title: animated sprite fade in and out possible?
Post by: Tongie on September 22, 2012, 09:38:43 am
can i make a animated sprite fade in and out in 2dtoolkit?
Title: Re: animated sprite fade in and out possible?
Post by: unikronsoftware on September 22, 2012, 10:47:45 am
Yes, the easiest way to do this is probably with something like HOTween or GoKit.

Edit: Or you could just write a coroutine to do it.
Title: Re: animated sprite fade in and out possible?
Post by: Tongie on September 22, 2012, 02:55:19 pm
I have to change the shader to transparent/diffuse and all the other texture become darker. Is there any other method to do a fade in?
Title: Re: animated sprite fade in and out possible?
Post by: unikronsoftware on September 22, 2012, 07:48:44 pm
You don't have to change the shader, just access use sprite.color property (color.a precisely). You can do that in the interface or from script.

Title: Re: animated sprite fade in and out possible?
Post by: Tongie on September 23, 2012, 04:26:02 am
I use itween.valueto and itween.fadeto on a animatedSprite but fail.

iTween.ValueTo(gameObject, iTween.Hash("from", 1.0f, "to", 0.0f,"time", 2.0f, "easetype", "easeInOutQuad", "onupdate", "setAlpha"));
      
iTween.FadeTo(gameObject, iTween.Hash("alpha", 0));

renderer.material.color = new Color(255,255,255,0);

none work.what am i doing wrong here?
Title: Re: animated sprite fade in and out possible?
Post by: unikronsoftware on September 23, 2012, 11:58:41 am
I don't use iTween, but here is an example of modifying a textmesh using HOTween -
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,542.msg2555.html#msg2555

With a sprite, the only difference will be that the call to Commit isn't necessary.